【问题标题】:Syntax error on SQLAlchemy with MemSQL使用 MemSQL 的 SQLAlchemy 上的语法错误
【发布时间】:2015-09-11 12:04:29
【问题描述】:

当我通过 SQLAlchemy(版本 1.0.8)连接到 MemSQL 时,我 我遇到错误

sqlalchemy.exc.ProgrammingError: (_mysql_exceptions.ProgrammingError) (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`Charset` = 'utf8' and `Collation` = 'utf8_bin'' at line 1") [SQL: "show collation where `Charset` = 'utf8' and `Collation` = 'utf8_bin'"]

echo=True 表明一开始 SQLAlchemy 执行以下命令

show collation where `Charset` = 'utf8' and `Collation` = 'utf8_bin'

当我手动运行上面的命令时,我得到了同样的错误,但是当我删除 Charset 和 Collat​​ion 周围的字符(`)时,查询运行正常。这是 MemSQL 的问题吗?

顺便说一句,我使用默认(MySQL)方式连接到 MemSQL。

engine = create_engine('mysql://root@127.0.0.1:3306', echo=True)

【问题讨论】:

    标签: python sqlalchemy singlestore


    【解决方案1】:

    这看起来像是一个合法的错误。看来这是由最近在 SQLAlchemy 中使用 MySQL-Python 库的代码中引入的更改/解决方法引起的。我们会努力解决这个问题。

    同时,OurSQL 库运行良好:

      >>> import sqlalchemy
      >>> sqlalchemy.__version__
      '1.0.8'
      >>> sqlalchemy.create_engine("mysql+oursql://127.0.0.1").connect()
      <sqlalchemy.engine.base.Connection object at 0x7f382ff19910>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-03
      • 1970-01-01
      • 1970-01-01
      • 2016-08-28
      • 2020-02-01
      • 2018-07-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多