Python 如何在SQLAlchemy中使用位置参数

Python 如何在SQLAlchemy中使用位置参数,python,sqlalchemy,Python,Sqlalchemy,如何在SQLAlchemy中使用位置/未命名参数? 这不管用。。 我知道命名参数可以工作,但有时我更喜欢未命名参数 engine = sqlalchemy.engine.create_engine('mysql://py:123@localhost/py', echo=True) con = engine.connect() res = con.execute(text("select uid, name from users where uid = ?"), 1); 回溯

如何在SQLAlchemy中使用位置/未命名参数? 这不管用。。 我知道命名参数可以工作,但有时我更喜欢未命名参数

engine = sqlalchemy.engine.create_engine('mysql://py:123@localhost/py', echo=True)
con = engine.connect()
res = con.execute(text("select uid, name from users where uid = ?"), 1);
回溯(最近一次呼叫最后一次):
文件“/home/olaf/py//test.py”,第10行,在
res=con.execute(文本(“SELECTUID,torrent\u pass from xbt\u users,其中uid=?”),1);
文件“/usr/lib/python3/dist packages/sqlalchemy/engine/base.py”,第1011行,在execute中
返回方法(自身、多线程、参数)
文件“/usr/lib/python3/dist packages/sqlalchemy/sql/elements.py”,第298行,在连接上执行
返回连接。_execute_clauseelement(self、multiparams、params)
文件“/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py”,第1090行,在执行元素中
keys=列表(参数[0].keys())
AttributeError:“列表”对象没有属性“键”```
尝试这样使用:

res = con.execute(
    "SELECT uid, name from users where uid = %s", 1)   
res = con.execute(
    "SELECT uid, name from users where uid = %s", 1)