bikeshedder / tusker

PostgreSQL migration management tool
The Unlicense
208 stars 17 forks source link

TypeError: dict is not a sequence if sql contains %s #21

Closed daa closed 2 years ago

daa commented 2 years ago

When SQL text contains '%' sign, DB API driver treats it as query parameter placeholder and it leads to TypeError: dict is not a sequence when executing that SQL without parameters. This behaviour is a consequence of changes made in #18 where SQLAlchemy parameter binding was bypassed but underlying DB-API driver wasn't. My proposed solution is to escape all '%' signs (replace them with double percent: '%%') in SQL text before executing it with driver so that such sequences are not recognized as parameters.

bikeshedder commented 2 years ago

Thanks a lot for the patch! :+1:

I just released Tusker 0.4.8 including your fix: https://pypi.org/project/tusker/0.4.8/

daa commented 2 years ago

Thank you very much!