Python Peewee类类型尝试选择/where时出错
我试图使用peewee中的select()和where()函数在Postgresql数据库中获取哈希密码,但得到的是类TypeError。从json接收电子邮件,然后进行解码 功能:Python Peewee类类型尝试选择/where时出错,python,postgresql,peewee,flask-peewee,Python,Postgresql,Peewee,Flask Peewee,我试图使用peewee中的select()和where()函数在Postgresql数据库中获取哈希密码,但得到的是类TypeError。从json接收电子邮件,然后进行解码 功能: person_decode = person_string.decode("UTF-8") person_json = json.loads(person_decode) personemail = person_json["email"] hashed = personmodel.Person.select(pe
person_decode = person_string.decode("UTF-8")
person_json = json.loads(person_decode)
personemail = person_json["email"]
hashed = personmodel.Person.select(personmodel.Person.password).where(personmodel.Person.email == personemail)
personmodel.Person:
class Person(basemodel.BaseExtModel):
email = TextField(primary_key=True)
password = TextField()
当我运行print(散列)时,这会被打印出来:
<class 'lib.models.personmodel.Person'> SELECT "t1"."password" FROM "person" AS t1 WHERE ("t1"."email" = %s) ['correctemail@email.com']
从“person”中选择“t1”“password”作为t1,其中(“t1”“email”=%s)[”correctemail@email.com']
当我在Postco中运行查询时,它不会通过%s,但当我删除%s并放置电子邮件时,它会成功运行。select和where函数中的参数是否有错误
提前感谢。如果您能将回溯错误包括在内,那将很有帮助。事实上,不可能判断出哪里出了问题