0

我正在尝试通过 SQL Alchemy 连接到 Exasol DB

我使用以下方法安装了 SQL Alchemy:

pip install sqlalchemy-exasol

代码如下:

from sqlalchemy import create_engine

e = create_engine("exa+pyodbc://<user>:<password>@<host>:<port>/<schema>?CONNECTIONLCALL=en_US.UTF-8&driver=com.exasol.jdbc.EXADriver")
e.execute("Select count(*) from TableA").fetchall()

我也试过这个:

  e = create_engine("exa+pyodbc://<user>:<password>@<host>:<port>/<schema>")

无论哪种方式,我都会收到以下错误:

Traceback (most recent call last):
  File "C:\Users\xxx\AppData\Local\Continuum\Anaconda3\lib\site-packages\sqlalchemy\pool.py", line 1122, in _do_get
    return self._pool.get(wait, self._timeout)
  File "C:\Users\xx\AppData\Local\Continuum\Anaconda3\lib\site-packages\sqlalchemy\util\queue.py", line 145, in get
    raise Empty
sqlalchemy.util.queue.Empty

During handling of the above exception, another exception occurred:

sqlalchemy.exc.InterfaceError: (pyodbc.InterfaceError) ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')

有任何想法吗?我的连接详细信息格式一定有问题,但我不确定是什么...

4

1 回答 1

0

错误消息听起来像是 odbc 驱动程序 DNS 配置不正确。安装 ODBC 驱动程序。

于 2019-07-23T13:08:19.770 回答