Helenr
docs:SQL表达式语言教程 - 使用文本例:from sqlalchemy.sql import textconnection = engine.connect()# recommendedcmd = 'select * from Employees where EmployeeGroup == :group'employeeGroup = 'Staff'employees = connection.execute(text(cmd), group = employeeGroup)# or - wee more difficult to interpret the commandemployeeGroup = 'Staff'employees = connection.execute( text('select * from Employees where EmployeeGroup == :group'), group = employeeGroup)# or - notice the requirement to quote "Staff"employees = connection.execute( text('select * from Employees where EmployeeGroup == "Staff"'))for employee in employees: logger.debug(employee)# output(0, u'Tim', u'Gurra', u'Staff', u'991-509-9284')(1, u'Jim', u'Carey', u'Staff', u'832-252-1910')(2, u'Lee', u'Asher', u'Staff', u'897-747-1564')(3, u'Ben', u'Hayes', u'Staff', u'584-255-2631')