frappe / insights

Open source analytics / business intelligence tool (BI)
https://frappe.io/insights
GNU Affero General Public License v3.0
406 stars 199 forks source link

Chart is not updating when database is updated #169

Closed devarshi-007 closed 11 months ago

devarshi-007 commented 11 months ago

When I write a query to visualize it into a chart, It will visualize it. But when in live system new data added or updated, I have to execute query again to see updated visualization in chart. Is there any way that chart will update automatically (or query will execute automatically) when data source's some table are updated ?

devarshi-007 commented 11 months ago

As per my knowledge, insights using query result to build a chart. So, every time I have to execute a query to get updated result. Am I correct ? or is there any other way ... ?

nextchamp-saqib commented 11 months ago

If I understood correctly, you want to refresh the chart every time the database table data is updated?

It's not possible in Insights. As far as I know, there's not way to trigger an event on Insights when database table is updated. The best we can do is set the chart to get refreshed every 5 seconds.

devarshi-007 commented 11 months ago

Ok thanks. So that mean we also cannot write dynamic queries (like query contains variable like

select $a from table;

and we pass $a as column name

devarshi-007 commented 11 months ago

If I understood correctly, you want to refresh the chart every time the database table data is updated?

It's not possible in Insights. As far as I know, there's not way to trigger an event on Insights when database table is updated. The best we can do is set the chart to get refreshed every 5 seconds.

And also as I know, there is no need for chart refresh because once query result is updated, chart is updated

nextchamp-saqib commented 11 months ago

It's not possible to use variables in SQL queries currently but I plan to do it. You can however try to use Script Query which is a lot more flexible as it's plain Python code

And yes, the chart will be updated if the query result is updated.

devarshi-007 commented 11 months ago

Okay thanks.