gpt4 book ai didi

python - SQLAlchemy 是否支持 H2DB?

转载 作者:太空宇宙 更新时间:2023-11-04 10:57:49 25 4
gpt4 key购买 nike

SQLAlchemy 是否支持 H2 数据库?我正在使用金字塔并想连接到 H2 数据库。如果使用 postgres 方言,我会收到如下错误:

File "/Users/homecamera/gotocamera/hcadmin/env/lib/python2.7/site-packages/SQLAlchemy-0.7.3-py2.7-macosx-10.4-x86_64.egg/sqlalchemy/dialects/postgresql/base.py", line 871, in initialize
super(PGDialect, self).initialize(connection)
File "/Users/homecamera/gotocamera/hcadmin/env/lib/python2.7/site-packages/SQLAlchemy-0.7.3-py2.7-macosx-10.4-x86_64.egg/sqlalchemy/engine/default.py", line 181, in initialize
self.get_isolation_level(connection.connection)
File "/Users/homecamera/gotocamera/hcadmin/env/lib/python2.7/site-packages/SQLAlchemy-0.7.3-py2.7-macosx-10.4-x86_64.egg/sqlalchemy/dialects/postgresql/base.py", line 910, in get_isolation_level
cursor.execute('show transaction isolation level')
ProgrammingError: Syntax error in SQL statement "SELECT "; expected "TOP, LIMIT, DISTINCT, ALL, *, NOT, EXISTS"; SQL statement:
show transaction isolation level [42001-140]
DETAIL: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "SELECT "; expected "TOP, LIMIT, DISTINCT, ALL, *, NOT, EXISTS"; SQL statement:
show transaction isolation level [42001-140]

最佳答案

据我所知,没有对 HSQLDB 方言或本地 H2 方言的官方支持。将 Postgres 方言与 H2(不使用 HSQLDB)一起使用肯定会导致您遇到错误。

尝试 sqlalchemy-jython 可能会有更好的运气并使用 H2 方言。

关于python - SQLAlchemy 是否支持 H2DB?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8413754/

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