-
Let's go through an example, and tell if understanding is correct, pointing to respective code. We have in file two statements: SELECT
'chart' as component,
'Quarterly Revenue' as title,
'area' as type;
SELECT
quarter AS x,
SUM(revenue) AS y
FROM finances
GROUP BY quarter These get fed into database via driver. And returned tabulated data,
and second
Renderer then interprets these tabulated structures to produce html, in this case. Is this a correct impression? In the above example renderer gets display/rendering structure from the first table. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Yes, that's all correct ! If you want to dig into deeper details about how sqlpage works, you should check out this section of our README file on github. In the example above, the first select query is so simple that it will be optimised away by sqlpage; it will not even be sent to the database, and sqlpage will immediately recognize that it needs to open the handlebars template for the chart component and start rendering it with the parameters {
"title": "Quarterly Revenue",
"type": "area"
} It will render it until the line that says Then it will process the second query. This time it is not a simple query that can be optimised away, so SQLPage will send it to the database : SELECT
quarter AS x,
SUM(revenue) AS y
FROM finances
GROUP BY quarter The database will then start returning rows, one by one. For each new row, sqlpage will render the part of the component template that is between When the database says it is done with the query and there is no more rows to process, sqlpage finally renders the last part of the template (after |
Beta Was this translation helpful? Give feedback.
Yes, that's all correct ! If you want to dig into deeper details about how sqlpage works, you should check out this section of our README file on github.
In the example above, the first select query is so simple that it will be optimised away by sqlpage; it will not even be sent to the database, and sqlpage will immediately recognize that it needs to open the handlebars template for the chart component and start rendering it with the parameters
It will render it until the line that says
{{~#each_row~}}
, and immediately send the beginning of the page to the browser.Then it will process the second query. This time it is not a simple quer…