79102910

Date: 2024-10-18 16:37:07
Score: 2
Natty:
Report link

The issue I was having was due to passing an instance of a Session to the "con" in pandas.DataFrame.to_sql and not the issues with the data type as I previously suspected.

According to pandas' docs DataFrame.to_sql

parameter "con" should have "sqlalchemy.engine.(Engine or Connection) or sqlite3.Connection"

Thanks to @GordThompson pointing me in the right direction, I checked through the SQLAlchemy docs on the Session.connection() which it starts transaction and is used to procure a new connection on the session's bound engin, that is exactly what my df.to_sql(con=) needed.

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Long answer (-0.5):
  • No code block (0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: iGRiK