I have an SQL query that works through a Grafana dashboard is this possible to recreate in Pandas?
In Grafana:
SELECT
"time" AS "time",
metric AS metric,
value
FROM volttron
WHERE
$__timeFilter("time") AND
kv_tags->'equip_name' = '["35201"]' AND
'power' = any(m_tags)
ORDER BY 1,2
Trying to recreate in Pandas postgress connection with psycopg2:
eGauge35201 = pd.read_sql('SELECT "time" AS "time", metric AS metric, value FROM volttron WHERE $__timeFilter("time") AND kv_tags->equip_name = ["35201"] AND power = any(m_tags) ORDER BY 1,2', dbconn)
This throws a lot of errors:
DatabaseError: Execution failed on sql 'SELECT "time" AS "time", metric AS metric, value FROM volttron WHERE $__timeFilter("time") AND kv_tags->equip_name = ["35201"] AND power = any(m_tags) ORDER BY 1,2': syntax error at or near "$"
LINE 1: ...c AS metric, value FROM slipstream_volttron WHERE $__timeFil...
Im trying to build a dataframe directly... Sorry still learning db any tips greatly appreciated...