python - 使用 Python 将数据帧保存到 Redshift 时出错
问题描述
我正在尝试将表从 Redshift 数据库复制到 Python 中的数据框,然后将其再次保存在 Redshift 中。
所以,第一步是有效的,但第二步我有一些问题。当我尝试保存具有 100 行的数据框时出现一些错误。
import pandas as pd
from sqlalchemy import create_engine
engine = create_engine("mssql+pyodbc://database")
df = pd.read_sql_query('select * from testing.table1 limit 100', engine)
df.to_sql(name='table2',schema='testing',con=engine,index=False,if_exists='append')
我收到了这个错误:
DBAPIError: (pyodbc.Error) ('HY000', '[HY000] [Amazon][ODBC] (10920) 已经下推的输入参数无法获取数据。
这很奇怪,因为当我尝试保存一个有 10 行的数据框时,根本没有错误。
解决方案
推荐阅读
- python - 用 selenium 和 python 抓取
- javascript - 如何清理画布并重新绘制
- c# - c# wpf应用程序中的两个xml请求
- java - org.springframework.validation.BeanPropertyBindingResult:5 个错误
- .net - Xamarin web api等平台时间问题
- java - 如何在 Android Studio 上精确定位到我的 MapView 的不同位置?
- java - 分页库的意外行为
- swift - 在 ViewController 和 SwiftUI 之间共享变量
- javascript - Redux Saga Multiple Put 不能在没有延迟的情况下工作
- python - 密码生成器 - 嵌套的 while 循环