I am trying to use Django's db connection variable to insert a pandas dataframe to Postgres database. The code I use is
df.to_sql('forecast',connection,if_exists='append',index=False)
And I get the following error
Execution failed on sql 'SELECT name FROM sqlite_master WHERE type='table' AND name=?;': relation "sqlite_master" does not exist LINE 1: SELECT name FROM sqlite_master WHERE type='table' AND name=?...
I think this happens because the Django connection object is not an sqlalchemy object and therefor Pandas assumes I am using sqlite. Is there any way to use .to_sql other than make another connection to the database?
django.db.connectionwould have worked, auto-selecting the default connection setting.