sqlalchemy : executing raw sql with parameter bindings
You need to get the connection
object, call execute()
on it and pass query parameters as keyword arguments:
from alembic import opfrom sqlalchemy.sql import textconn = op.get_bind()conn.execute( text( """ insert into field_tags (id, field_id, code, description) values (1, 'zasz', :code , :description) """ ), **t)