Skip to content
Advertisement

declare variable with pd.read_sql_query

Can someone explain why do I get an error when executing the following simple query with pandas:

I understand that I can pass the variable t as a parameter to pandas and it will work, but I want to understand in principle what is causing the error, what are the restrictions on queries that can be passed to pandas. The query seems to work fine with cursor.execute(query).

Advertisement

Answer

You passed the arguments to .read_sql_query() in the wrong order. You used

when it should be

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement