I think to fulfill the syntax requirements and already tried a lot...
I have subsequent variables set up:
db_uri = "postgres://{}:{}@{}/{}".format(user, pwd, server, db)
engine = create_engine(db_uri)
con = engine.connect()
What already works:
df_sql = pd.read_sql_table('TABLE', engine)
What also works:
query = 'SELECT * FROM "TABLE" WHERE id_column = 12564993'
df = pd.read_sql_query(query, con)
But when I change the id_column to a date_column nothing works anymore:
query = 'SELECT * FROM "TABLE" WHERE CAST(ts_column as date) = ts_column "2019-06-19"'
df = pd.read_sql_query(query, con)
Indepently from all syntax options available I get an error code:
ProgrammingError: (psycopg2.errors.SyntaxError) syntax error at or near ""2019-06-19""
LINE 1: ...LECT * FROM "TABLE" WHERE CAST(ts_column as date) = ts_column "2019-06-1...
There is a ^ below the " of "2019-06.1... Any idea what to fix? I consulted the docs and searched for any kind of conditional where statement topic, but I still don't get it. Why can't I just select a specific date attribute to get matching rows?