使用to_sql()时无效的参数'fast_executemany'

时间:2019-11-28 04:33:40

标签: python sqlalchemy pandas-to-sql

我正在尝试使用fast_executemany加快to_sql()的速度。但是我遇到了错误,

TypeError:使用配置PGDialect_psycopg2 / QueuePool / Engine将无效的参数'fast_executemany'发送到create_engine()。请检查关键字参数是否适合此组件组合。

我一直在参考上一个问题Speeding up pandas.DataFrame.to_sql with fast_executemany of pyODBC

database_url = 'postgresql://{user}:{password}@{host}:5432/{database_name}'.format(
    user=user,
    host=host,
    password=password,
    database_name=database_name,
)
engine = create_engine(database_url, echo=False, fast_executemany=True)
df.to_sql('parquet', con=engine,if_exists='replace')

如果我删除fast_executemany参数,则会执行此代码,但是会花费很长时间。我正在使用Python 3.7。

0 个答案:

没有答案