Reputation: 1495
I am writing a Flask webapp and having a hard time with SQLAlchemy. I am very new to SQLAlchemy and Flask.
I have following three tables.
User:
[
user_id
first_name
last_name
]
Picture:
[
filename
picture_type // eg: painting, photograph
painter
]
Comment
[
user_id
filename
comment
]
I am trying to query all filenames that was not reviewed by current user. So the condition would be "all filenames from the picture table with matching picture type where each filename should not have matching, in Comment table, filename and matching user_id with the current user
Currently the current user user_id an picture_type information are available as incoming argument to the function I am trying to write.
How should I write the query using session filter query?
Upvotes: 0
Views: 1207
Reputation: 457
Take a look at Query.join. After you joined Comment
and Picture
tables on filename
you can filter them as usual.
Upvotes: 1