Skip to content
Advertisement

Mysql / Maridb Python Connector is not loading data into table

The code checks if there is a table with the same name in the db and then potentially drops it, creates a new table and loads the data of the csv file into the table. When executing the code it seems like everything is working but when going in the mariadb command prompt the created table is empty even though when outputting the table in the code it is filled.

Advertisement

Answer

By default MariaDB Connector/Python doesn’t use autocommit mode.

You need either set autocommit=True when establishing the connection or you have to commit your changes with conn.commit().

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