0
我有一个熊猫数据框44k行表。当我尝试将此表(或任何其他表)导出到Redshift数据库时,该过程需要很长时间。我使用的SQLAlchemy来创建这样一个conexion:SQLalchemy缓慢与红移
import sqlalchemy as sal
engine = sal.create_engine('redshift+psycopg2://blablamyhost/myschema')
我用导出表的方法是大熊猫to_sql
这样的:
dat.to_sql(name="olap_comercial",con=eng,schema="monetization",index=False,if_exists="replace" ,dtype={"description":sal.types.String(length=271),"date_postoffer":sal.types.DATE})
这是正常的,它是如此之慢?我说的是15分钟以上。
您的Python脚本进行协调,我写了周围boto3和psycopg2的包装解决这一确切的问题:https://github.com/agawronski/pandas_redshift – AidanGawronski