How to pass timerange filter for Sqlite query

Hi Community,
I’m new to Grafana so I would need your help on below query
We are using sqlite datasource to build dashboards. we are getting data with below query but we want to filter it based on time range and also real time data. ex: every 6m the dashboard to be refresh and change the values. So, can some one help me to how we can pass the time interval of 6m in query to refresh it every time.

Select Date_n_Time, SensorID, Temperature from dht22_temperature_Data

Thank you in advance!

Regards,
Eshwar

Welcome @eshwar6264 to the Grafana forum.

Here’s the docs on how to incorporate the Grafana time picker into your SQL query. SQLite is not explicitly mentioned, but I believe it will be either WHERE $timeFilter or WHERE $__timeFilter

You can select the auto refresh interval of 5m here:

Hi @grant2,

I had tried to give $timeFilter or $__timeFilter in where condition but I am getting below error.
SQL logic error: near “)”: syntax error (1)

Data for date is in unix timestamp and I am converting it into datetime format even though it is throwing an error.

If you have any other suggestions please let me know.

it’s working in below condition but when I use getting above error

Regards,
Eshwar

Just try

$__timeFilter(date_n_time)