Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 编译器错误:此方言不支持返回';s语句编译器_Mysql_Sqlalchemy - Fatal编程技术网

Mysql 编译器错误:此方言不支持返回';s语句编译器

Mysql 编译器错误:此方言不支持返回';s语句编译器,mysql,sqlalchemy,Mysql,Sqlalchemy,我在使用sqlachemy和insert语句时遇到问题。insert语句不返回插入的主键。过了一段时间,我找到了解决方案,就是使用函数return。大概是这样的: query_insert = cat_estructura.insert().values( [query_new_value] ).returning(cat_estructura.c.ID_ESTRUCTURA) 当我使用类似方言的Postgres时,一切正常,但当我将方言更改为MySQL时,它崩溃了 CompileEr

我在使用sqlachemy和insert语句时遇到问题。insert语句不返回插入的主键。过了一段时间,我找到了解决方案,就是使用函数return。大概是这样的:

query_insert = cat_estructura.insert().values(
    [query_new_value]
).returning(cat_estructura.c.ID_ESTRUCTURA)
当我使用类似方言的Postgres时,一切正常,但当我将方言更改为MySQL时,它崩溃了

CompileError: RETURNING is not supported by this dialect's statement compiler.
我正在使用下面的库列表

  • configparser==3.3.0.post2
  • mysql==0.0.1
  • mysql连接器重新打包==0.3.1
  • MySQL python==1.2.5
  • pymysql-utils==0.51
  • PyMySQL3==0.5
  • 六=1.10.0
  • SQLAlchemy==1.0.12
  • SQLAlchemy连续体==1.2.4
  • SQLAlchemy Utils==0.32.1
  • 车轮==0.24.0
  • 我已经读到这个问题已经解决了,但我不知道我做错了什么

    有人知道如何解决这个问题吗


    提前感谢

    MySQL不支持
    RETURNING
    子句。事实上,我也这么做了,直到我找到了它,但是你有什么办法来解决这个问题吗?对于MySQL,你必须发出另一个查询
    SELECT last\u insert\u id()