Skip to content
Advertisement

psycopg2 takes a value as a column

I’m trying to create a table using psycopg2 and then insert outer data from some jsons. For this reason I defined 2 function: create_words_table() and insert_data():

So, attempting to execute them:

I got further error:

Looking at documentation, I don’t see any mistake applying simple INSERT query and can’t understand why psycopg2 takes a tuple after word VALUE as a table’s fields. If anybody could clear me this, I’ll be very grateful.

Advertisement

Answer

the problem is in your query , you need to change your query to this and pass the tuple as param:

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