使用Apache Arrow ADBC驱动连接PostgreSQL时程序静默退出问题
我的配置
- Windows系统
python=3.11.7pandas=2.2.0adbc-driver-manager=0.9.0adbc-driver-postgresql=0.9.0pyarrow=15.0.0
问题描述
我尝试使用Apache Arrow推出的ADBC Driver连接PostgreSQL数据库,代码逻辑简单,但在尝试建立连接时程序静默退出,未抛出任何异常。
import adbc_driver_postgresql.dbapi import pandas as pd uri = ( 'postgresql://' + f'{config["USERNAME"]}:' + f'{config["PASSWORD"]}@' + f'{config["HOST"]}:' + '5432/' + f'{config["DB_NAME"]}' ) df = pd.read_csv('data.csv') with adbc_driver_postgresql.dbapi.connect(uri) as conn: # 程序在此处静默退出 # 以下两行代码均未执行 print('connection made, going to upload now') df.to_sql("pandas_table", conn, index=False) print('made it pass connection and upload') # 未执行
已完成的调试操作
- 验证数据库可通过以下代码正常连接:
import sqlalchemy import pandas as pd uri = ( 'postgresql://' + f'{config["USERNAME"]}:' + f'{config["PASSWORD"]}@' + f'{config["HOST"]}:' + '5432/' + f'{config["DB_NAME"]}' ) engine = sqlalchemy.create_engine(uri) df = pd.read_csv('data.csv') with engine.connect() as conn: df.to_sql("pandas_table", conn, index=False)
- 已确认安装了所需依赖包:
pandas=2.2.0adbc-driver-manager=0.9.0adbc-driver-postgresql=0.9.0pyarrow=15.0.0
内容的提问来源于stack exchange,提问作者Alex F
相关产品推荐
相关产品推荐

