Migrating pandas dataframe from local computer using odo

408 Views Asked by At

Loading a pandas dataframe into postgres using odo does not work.

I first use SQLalchemy to create a table object. The name of the table on my local postgres instance is testaccounts.

meta = MetaData(bind=engine)
table = Table('testaccounts', meta, schema='custom')
odo(df, table)`enter code here

When I tried the code above, I got this error:

ValueError: Column names of incoming data don't match column names of
existing SQL table
Names in SQL table: []
Names from incoming data: ['id', 'name', 'country']

I also tested this by manually creating the table with these 3 columns but it still shows the same error. I think i'm doing something wrong but not sure what. Can someone point me in the right direction?

0

There are 0 best solutions below