0

I'm trying to get a hashed password in a Postgresql DB using the select() and where() function in peewee, but I'm getting the class TypeError. The email is getting received from a json then decoded.

function:

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()

When I run print(hashed) this gets printed out:

<class 'lib.models.personmodel.Person'> SELECT "t1"."password" FROM "person" AS t1 WHERE ("t1"."email" = %s) ['correctemail@email.com']

When I run the query in Postico and it wont pass %s, but runs successfully when I delete the %s and put the email instead. Is there something incorrect with my parameters in the select and where functions?

Thanks in advance.

sls
  • 1

1 Answers1

0

It'd be helpful if you could include the traceback error. As it is, it's impossible to tell what might have gone wrong.

coleifer
  • 24,887
  • 6
  • 60
  • 75