I need to call a database function from grafana.
Function definition is as below
CREATE OR REPLACE FUNCTION functionTest( fromTime TIMESTAMP, toTime TIMESTAMP)
result text = ‘’;
After creation when I tested it manually through SQL Editor using Query-1. It works fine:
Query-1: select functionTest(timestamp ‘2020-01-23 06:54:13’, timestamp ‘2020-01-24 06:54:13’)
When I try to call this function through grafana it gives me error.
I tried to create one query variable and used below syntax to call the function as explained https://grafana.com/docs/grafana/latest/variables/variable-types/global-variables/
I get error as
Template variables could not be initialized: pq: invalid input syntax for type timestamp: "[[__from:date:YYYY-MM-DD HH:mm:ss]]"
Query-2: select functionTest(timestamp ‘[[__from:date:YYYY-MM-DD HH:mm:ss]]’, timestamp ‘[[__to:date:YYYY-MM-DD HH:mm:ss]]’);
When I used Query-1 just for verification purpose then it worked as expected.
Am I using the correct syntax?
Anyone any idea as what is wrong with the above syntax? Any quick help would be highly appreciated.