I'm trying to speed-up the way to write my DataFrame in a SQLite database.
To do so, I'm trying to use Method 4 on this website.
I also found a more elegant way to change the variable cursor.fast_executemany = True
thanks to a post on Stack Overflow.
The problem is that this error occurs:
TypeError: Invalid argument(s) 'fast_executemany' sent to create_engine(), using configuration SQLiteDialect_pysqlite/NullPool/Engine. Please check that the keyword arguments are appropriate for this combination of components.
I'm using sqlalchemy version 1.3.23 and pandas version 1.14.0.
import pandas as pd
from sqlalchemy import create_engine # database connection
from sqlalchemy import event
from IPython.display import display
disk_engine = create_engine('sqlite:///2021_database.db',fast_executemany=True)
data.to_sql('data', disk_engine, if_exists='replace')
Here, data
is my DataFrame. When I run this code without fast_executemany=True
, it works.
Someone has any idea?