【发布时间】:2023-02-18 17:46:25
【问题描述】:
我正在尝试使用 SQL Alchemy 和 pg8000 驱动程序连接到 postgres 数据库。我想为此连接指定一个搜索路径。使用 Psycopg 驱动程序,我可以通过做类似的事情来做到这一点
engine = create_engine(
'postgresql+psycopg2://dbuser@dbhost:5432/dbname',
connect_args={'options': '-csearch_path={}'.format(dbschema)})
但是,这不适用于 pg8000 驱动程序。有没有好的方法来做到这一点?
【问题讨论】:
标签: python sqlalchemy pg8000