【问题标题】:sqlalchemy - connect to teradatasqlalchemy - 连接到 teradata
【发布时间】:2019-05-24 22:23:41
【问题描述】:

抱歉,我对 Python 很陌生。我正在尝试通过 python sqlalchemy 连接到 Teradata 数据库,但是我无法成功建立连接。

我收到的错误消息是“NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:teradata”。

这是我目前所拥有的:

import sqlalchemy

from sqlalchemy import create_engine
user = 'myusername'
pasw= 'mypassword'
host = 'hostname.com'
db = 'PRD_DB_SCHEMA'
engine_str = ("teradata://"+user+":"+pasw+"@"+host+":22/"+db+"?authentication=LDAP")
td_engine = create_engine(engine_str)
conn = td_engine.connect()

【问题讨论】:

    标签: sqlalchemy teradata


    【解决方案1】:

    对于 teradatasql,设置 logmech 而不是 authentication

    teradatasql://{user}:{password}@{host}/?logmech=LDAP?driver=teradata
    

    参考:https://pypi.org/project/teradatasqlalchemy/

    编辑:实际上,driver 不是必需的:

    teradatasql://{user}:{password}@{host}/?logmech=LDAP
    

    【讨论】:

      【解决方案2】:

      对不起,我刚刚解决了这个问题:

      engine_str = ("teradata://"+user+":"+pasw+"@"+host+"/?authentication=LDAP?driver=Teradata")
      

      【讨论】:

        猜你喜欢
        • 2019-10-27
        • 2019-04-18
        • 2020-04-08
        • 2011-08-27
        • 2018-01-09
        • 2017-07-24
        • 2017-01-29
        • 2011-09-25
        • 2011-02-18
        相关资源
        最近更新 更多