How to add presto data source in Grafana version 6.5.0

I even tried to try this solution but I got this error.

SELECT *
FROM kimchi
WHERE $__dateFilter(CAST(format(‘%04d-%02d-%02d’, DATE_KEY / 10000, (DATE_KEY / 100) % 100, DATE_KEY % 100) as DATE))
GROUP BY DATE_KEY

error:

Could not apply macros: expected 1 argument, received 4: unexpected number of arguments

Read the trino documentation

Macros is related to Grafana and not Trino :frowning: Can you guide me?

Yes macros are grafana.

  • $dateFilter($column) - replaced with a range condition for the currently selected “Time Range” as dates, on a column passed as the $column argument. Use it in queries or query variables as ...WHERE $dateFilter($column)... or ...WHERE $dateFilter(created_at).....
  • $timeFilter($column) - replaced with a range condition for the currently selected “Time Range” as timestamps, on a column passed as the $column argument.
    But you need to pass them not numeric date values but real timestamps

DATE_KEY is a numeric value not a timestamp

SELECT * 
FROM kimchi 
WHERE DATE_KEY BETWEEN ${__from:date:YYYYMMDD} AND ${__to:date:YYYYMMDD} 
GROUP BY DATE_KEY

this works for me

Excellent solution! Totally forgot about that approach. Re learned that gem @zahrazare313

1 Like