gpt4 book ai didi

python - Pandas to_sql 没有在我的表中插入任何数据

转载 作者:太空狗 更新时间:2023-10-30 00:37:51 27 4
gpt4 key购买 nike

我想在我创建的表格中插入一些数据。我有一个如下所示的数据框:

dataframe

我创建了一个表:

create table online.ds_attribution_probabilities
(
attribution_type text,
channel text,
date date ,
value float
)

我正在运行这个 python 脚本:

engine = create_engine("postgresql://@e.eu-central-1.redshift.amazonaws.com:5439/mdhclient_encoding=utf8")
connection = engine.raw_connection()
result.to_sql('online.ds_attribution_probabilities', con=engine, index = False, if_exists = 'append')

我没有收到任何错误,但是当我检查表中没有数据时。有什么问题?我必须提交或执行额外的步骤吗?

最佳答案

尝试指定模式名称:

result.to_sql('ds_attribution_probabilities', con=engine, 
schema='online', index=False, if_exists='append')

关于python - Pandas to_sql 没有在我的表中插入任何数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48307008/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com