When trying to read a pandas dataframe into a newly created postgresql table, I get a "FeedParserDict" error message. I'm fairly new to this and cannot figure out what the issue is or where I went wrong. I have had other dataframe load into other postgresql table successfully using the same method. Any help I can get to fix this issue is greatly appreciated.
Pandas Dataframe
Screenshot of Dataframe
The dataframe contains two columns: tags, tags_id
Sample data of the dataframe from the tags column is:
[{'term': 'CODWarzone','scheme': None,'label': 'r/CODWarzone'}]
The tags_id column is an integer and acts as the primary key
Schema for Table created in Database
CREATE TABLE ncw01.tags (tag_id SERIAL PRIMARY KEY,scheme TEXT,label TEXT,term TEXT,link_id INT,FOREIGN KEY (link_id) REFERENCES link
Code to load dataframe into postgresql table
INSERT_SQL = 'INSERT INTO ncw01.tags 'INSERT_SQL += ' (tags, tags_id) VALUES 'INSERT_SQL += '(%s,%s)'with connection, connection.cursor() as cursor: for row in tags.itertuples(index=False, name=None): print(row) cursor.execute(INSERT_SQL,row)
Error Code
([{'term': 'CODWarzone', 'scheme': None, 'label': 'r/CODWarzone'}], 0)---------------------------------------------------------------------------ProgrammingError Traceback (most recent call last)<ipython-input-65-6f04784ed783> in <module> 33 # 34 # Insert the row---> 35 cursor.execute(INSERT_SQL,row)ProgrammingError: can't adapt type 'FeedParserDict'