简体   繁体   English

sqlalchemy 中缺少 zxJDBC 连接器(使用 DB2)

[英]Missing zxJDBC connector in sqlalchemy (With DB2)

Facing issue with a sqlalchemy + db2 (remote server) application. sqlalchemy + db2 (远程服务器)应用程序面临的问题。

Dependency installed:依赖安装:

  • SQLAlchemy==1.4.21 SQLAlchemy==1.4.21
  • ibm-db==3.0.4 ibm-db==3.0.4
  • ibm-db-sa==0.3.6 ibm-db-sa==0.3.6
  • python version = 3.8蟒蛇版本= 3.8

Here is the connection snippet:这是连接片段:

self.__engine = create_engine(f'ibm_db_sa://{DB2_USER}:{DB2_PASSWD}@{DB2_INSTANCE}/{DB2_DB}')

Seeing below issue:看到下面的问题:

File "/db-query-service/query_executor/db_reader/db2_reader_with_query.py", line 19, in __init__
    self.__engine = create_engine(f'ibm_db_sa://{DB2_USER}:{DB2_PASSWD}@{DB2_INSTANCE}/{DB2_DB}')
  File "<string>", line 2, in create_engine
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/util/deprecations.py", line 298, in warned
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/create.py", line 522, in create_engine
    entrypoint = u._get_entrypoint()
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/url.py", line 653, in _get_entrypoint
    cls = registry.load(name)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 337, in load
    return impl.load()
  File "/usr/local/lib/python3.8/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/local/lib/python3.8/site-packages/ibm_db_sa/__init__.py", line 22, in <module>
    from . import ibm_db, pyodbc, base, zxjdbc
  File "/usr/local/lib/python3.8/site-packages/ibm_db_sa/zxjdbc.py", line 32, in <module>
    from sqlalchemy.connectors.zxJDBC import ZxJDBCConnector
ModuleNotFoundError: No module named 'sqlalchemy.connectors.zxJDBC'

Questions:问题:

  • Is there any dependency missing or mismatch in versions?版本中是否缺少任何依赖项或不匹配?
  • Is there any issue with sqlalchemy installation? sqlalchemy安装有问题吗? - I removed and reinstalled it to rule that out. - 我删除并重新安装它以排除这种情况。
  • Able to work with Mysql remote db.能够使用 Mysql 远程数据库。
  • zxjdbc is specific to jython i found, will db2 + Sqlalchemy work with jython implementations.? zxjdbc特定于我发现的jythondb2 + Sqlalchemy适用于 jython 实现。?
  • If db2 + Sqlalchemy work with cpython, what's the fix for the issue?如果db2 + Sqlalchemy与 cpython Sqlalchemy工作,问题的解决方法是什么?

Reference Doc:参考文档:

Temporarily, you need to uninstall the sqlalchemy 1.4.x and as a workaround, then install the current sqlalchemy 1.3.x release .暂时,您需要卸载 sqlalchemy 1.4.x 并作为解决方法,然后安装当前的 sqlalchemy 1.3.x 版本。 At today's date this is sqlalchemy 1.3.24 which should resolve the issue.在今天,这是 sqlalchemy 1.3.24 应该可以解决这个问题。

I expect this problem will eventually get resolved.我希望这个问题最终会得到解决。

Link to issue is here问题链接在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 sqlalchemy 与 db2 和 kerberos - sqlalchemy with db2 and kerberos 带有SQLAlchemy的db2,如何指定默认架构 - Db2 with SQLAlchemy, how to specify default schema 与 IBM Cloud 上的 Db2 的 SQLAlchemy 连接错误 - SQLAlchemy connection error with Db2 on IBM Cloud 使用 SQLAlchemy 连接到 IBM DB2 数据库 - Connect to IBM DB2 database using SQLAlchemy 如何在 python 中使用 SQLAlchemy 修复与 db2 的连接? - How do I fix connection to db2 using SQLAlchemy in python? 使用 SQLAlchemy 将 dataframe 推送到 db2 数据库时出错 - Error in pushing dataframe to db2 Database using SQLAlchemy 使用 mysql.connector,但得到 ImportError: Missing optional dependency 'SQLAlchemy' - Use mysql.connector , but get ImportError: Missing optional dependency 'SQLAlchemy' SQLAlchemy 映射现有表(IBM Db2 问题) - SQLAlchemy mapping an existing table (IBM Db2 Issue) 使用 python 和 sqlalchemy 连接到 DB2 时出错 - 需要 SQLAlchemy 格式的连接信息 - Error connecting to DB2 with python and sqlalchemy - Connection info needed in SQLAlchemy format 如何解决 SQLAlchemy 连接问题:连接到 IBM Cloud 上托管的 IBM db2 服务器时,“需要 SQLAlchemy 格式的连接信息” - How to fix SQLAlchemy connection problem: 'Connection info needed in SQLAlchemy format' when connecting to IBM db2 server hosted on IBM Cloud
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM