I am trying to load timeseries data from QuestDb to Pandas Dataframe. I'm trying to use Postgres driver like
import pandas as pd
from sqlalchemy import create_engine
from datetime import datetime
engine = create_engine('postgresql://admin:quest@localhost:8812/mydb')
df = pd.read_sql_query(
"select * from cases where ts between %(dstart)s and %(dfinish)s",
con=engine,
params={"dstart":datetime(2020,12,24,16,0),"dfinish":datetime(2021,1,1,0,0)})
But got back
DatabaseError: (psycopg2.DatabaseError) between/and parameters must be constants
LINE 1: ...etry where ts between '2020-12-24T16:00:00'::timestamp ...
I also tried to use > and < instead of BETWEEN
df = pd.read_sql_query(
"select * from cases where ts > %(dstart)s and ts < %(dfinish)s",
con=engine,
params={"dstart":datetime(2014,6,24,16,0),"dfinish":datetime(2014,6,24,17,0)})
But still no luck
DatabaseError: (psycopg2.DatabaseError) unsupported class
LINE 1: ... > '2020-06-24T16:00:00'::timestamp and ts < '2021-01-0...
It works without parameters so it's not entirely wrong but I'm missing something here.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…