我想创建一个可以在其中放置任何名称的动态URL,它将在名为 autores 和 SELECT 其 id 的表中搜索该名称。 >,然后返回该 autor.id
我正在尝试运行此
@app.route('/<string:autor>')
def iniciarSesion(autor):
autor_id = db.execute("SELECT id FROM autores WHERE autor = :autor", {"autor":autor}).fetchone[0]
return autor_id
SQL Server 说:
TypeError:“方法”对象不可下标
如何获取 autor.id ?