sqlalchemy To query the desired value

Asked 2 years ago, Updated 2 years ago, 130 views

I'd like to get the data in the column called "confirmed" that the username variable has in the table called User to sqlalchmey

date_data = db.session.query(User).filter(User.confirmed == username).first()

I wrote it like this, but there was no error and the price was not printed at all.

Just connect. SELECT confirmed FROM user WHER username = username; How do I approach this to see the same effect?

sqlite3 sqlalchemy python

2022-09-22 14:01

1 Answers

Try the bottom together.

Common sense is filter, but the conditions like don't make sense.

date_data = db.session.query(User).filter (User.username == "User Name").first().confirmed


2022-09-22 14:01

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.