Question:
I have a code that automatically identifies for what table, which columns and what the values to parse into sql insert statement. It works well with all of my tables, except only one. This is a structure of the model of this table:syntax error at or near "current_time"
.
And this values were parsed into the hourly_weather
table:current_time
is before the last one value.And yes, I use both psycopg2 and sqlalchemy. There are some reasons for that.
Answer:
I’m not sure I follow all that is going on here (actually, I’m sure that I don’t…) but I think thatYour issue is that
current_time
is a keyword in PostgreSQL, andthat you should probably use the SQL building features of psycopg2 to handle the necessary quoting for you.
If you have better answer, please add a comment about this, thank you!