sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) can't adapt type 'Series'

Viewed 720

I am trying to insert rows into a Postgres database from a pandas dataframe. I am packaging up the dataframe as follows:

records = records.apply(lambda row: records(**row), axis=1)

Then committing as follows:

for record in records:
if not records(database.config.db_session, record.id_coda):
    database.config.db_session.add(record)
    database.config.db_session.flush()
    database.sqlalchemy.db_session.commit()

However I keep getting the error:

sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) can't adapt type 'Series'

I have checked all datatypes which match the expected values for the class and I've removed any functions i was applying to the series elements. Neither has worked.

Would really appreciate some help.

0 Answers
Related