I’ve been searching the web for a solution but couldn’t find any so here is what we came up with (there might be better ways but at least this is a start if someone else runs into this).
Specify the dtype
parameter in to_sql
.
We went from:df.to_sql(table_name, analytics_db)
to df.to_sql(table_name, analytics_db, dtype={'name_of_json_column_in_source_table': sqlalchemy.types.JSON})
and it just works.