Python 错误:\将数据帧上载到红移时获取\列\信息()
我正在尝试使用Python 错误:\将数据帧上载到红移时获取\列\信息(),python,sql,pandas,amazon-redshift,etl,Python,Sql,Pandas,Amazon Redshift,Etl,我正在尝试使用to_sql函数将pandas数据帧直接上传到Redshift connstr = 'redshift+psycopg2://%s:%s@%s.redshift.amazonaws.com:%s/%s' % (username, password, cluster, port, db_name) def send_data(df, block_size=10000): engine = create_engine(connstr) with
to_sql
函数将pandas数据帧直接上传到Redshift
connstr = 'redshift+psycopg2://%s:%s@%s.redshift.amazonaws.com:%s/%s' %
(username, password, cluster, port, db_name)
def send_data(df, block_size=10000):
engine = create_engine(connstr)
with engine.connect() as conn, conn.begin():
df.to_sql(name='my_table_clean', schema='my_schema', con=conn, index=False,
if_exists='replace', chunksize=block_size)
del engine
表my\u schema.my\u table\u clean
存在(但为空),并且使用connstr
构建的连接也有效(通过相应的检索\u数据
方法验证)。retrieve函数从my_表中提取数据,我的脚本使用pandas将其清除,以输出到my_表中
问题是,我一直遇到以下错误:
TypeError:\u get\u column\u info()正好接受9个参数(给定8个)
在执行to_sql
功能期间
connstr = 'redshift+psycopg2://%s:%s@%s.redshift.amazonaws.com:%s/%s' %
(username, password, cluster, port, db_name)
def send_data(df, block_size=10000):
engine = create_engine(connstr)
with engine.connect() as conn, conn.begin():
df.to_sql(name='my_table_clean', schema='my_schema', con=conn, index=False,
if_exists='replace', chunksize=block_size)
del engine
我似乎不知道是什么导致了这个错误。有人熟悉吗
使用
- python 2.7.13
- 熊猫0.20.2
- sqlalchemy 1.2.0