sqlalchemy execute sql

The key need to use text

from sqlalchemy import create_engine, text

sql = 'SELECT * FROM my_table WHERE account_id = :account_id and amount =: amount' session.execute( text(sql), {
"account_id": 100000, "amount": 500} )

 

Guess you like

Origin www.cnblogs.com/buxizhizhoum/p/11324020.html