Skip to content
Advertisement

Python problem with adding table to Database with sql

Hi, I’m trying to create a function that will take a table in insert(add) to the database.
My Code :

this is the old code when i didn’t create a function:

Advertisement

Answer

You seem to have put table_name under quotations in your to_sql function.

Also, you seem to be tackling the issue of data model creation and maintenance, which already has a lot of tooling in Python around it. Consider using something like alembic

Hope this helps.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement