You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Apache Arrow ADBC驱动连接PostgreSQL时程序静默退出问题

我的配置

  • Windows系统
  • python=3.11.7
  • pandas=2.2.0
  • adbc-driver-manager=0.9.0
  • adbc-driver-postgresql=0.9.0
  • pyarrow=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.0
    • adbc-driver-manager=0.9.0
    • adbc-driver-postgresql=0.9.0
    • pyarrow=15.0.0

内容的提问来源于stack exchange,提问作者Alex F

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.30 09:08:34