python - sqlalchemy : executing raw sql with parameter bindings -
I am trying to run this simple raw SQL statement with the parameter with the SQLalchemy (within the Alembic script): "+" Value: "Enter" in field_tags (id, field_id, code, description) "+" value from Alembic import op T = {"code": "123", "description": "one two three"} op.execute (1, 'jesz',: code, description), t)
and I get the following error:
sqlalchemy Exc.StatementError : bind parameter 'description' (root cause: invalidRequestError : For bound parameter 'Description' a value is required) Field_tags (id, field_id, code, description) values (1, 'math',% (Code) s,% (description) s) " []
Resolution: T = {"code": "123", "Description": "One two three"} sqlalchemy.sql import text op.get_bind (). Execute (text ("field_tags (id, field_id, code, description))" + "value (1, 'zasz',: Code,: description ') "), ** T)
get you the object Call on it, and query Dish the parameters as the keyword argument:
sqlalchemy.sql import text from the Alembic import option to conn = op.get_bind () conn.execute (text ("" "field_tags (id, field_id , Code), description) value (1, 'zasz',: code,: description ') "" "), ** t) See also:.
Comments
Post a Comment