如何停止sqlalchemy查看“绑定参数”在现有的模式中(对于Tusker)
我正在尝试使用Tusker比较模式版本,并检查当前数据库是一致的。
我的架构文件包含用于数据库定义的RAW SQL,包括PLPGSQL函数,其中之一是行:
json = '{ "type": "Category", "data": {"empty":0} }';
此架构文件设计用于直接导入到PSQL中,并且按原样工作正常。
但是,我现在正在尝试使用Tusker和Sqlalchemy Barfs处理架构管理工具,当它试图运行时:
sql = sqlalchemy.text(sql)
cursor.execute(sql)
抱怨:
Error executing SQL file schema_functions.sql: (sqlalchemy.exc.InvalidRequestError) A value is required for bind parameter '0'
我无法修改架构文件(否则,这是添加逃生字符的琐事,但是然后它将在PSQL中破裂); 因此,有什么方法可以告诉Sqlalchemy“不将整数解释为绑定参数”?
有关更多信息,请参见: https://github.com/bikeshedder/tusker/tusker/tusker/18
I am trying to use Tusker to compare schema versions and check the current database is consistent.
My schema file contains raw SQL for database definitions, including plpgsql functions, in one of which is the line:
json = '{ "type": "Category", "data": {"empty":0} }';
This schema file is designed for direct import into psql, and works fine as is.
However, I'm now trying to deal with the schema-management tool using tusker and SQLAlchemy barfs, when it tries to run:
sql = sqlalchemy.text(sql)
cursor.execute(sql)
complaining:
Error executing SQL file schema_functions.sql: (sqlalchemy.exc.InvalidRequestError) A value is required for bind parameter '0'
I can't modify the schema file (otherwise this would be trivial to add an escape character, but then it will break in psql);
So, is there any way to tell sqlalchemy to "not interpret integers as bind parameters"?
For more see: https://github.com/bikeshedder/tusker/issues/18
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论