I have a search bar for my app. Say the user searched for 'John Smith United Kingdom Oxford University' I would like to return the user from the accounts table with name 'John Smith', location 'United Kingdom' and education 'Oxford University'.
Here is a general overview for the search 'John Smith United Kingdom Oxford University':
- Show accounts from the database with
name'John Smith',location'United Kingdom' andeducation'Oxford University'. - Show accounts with
name'John Smith' andeducation'Oxford University' - Show accounts with
name'John Smith' andlocation'United Kingdom' - Show accounts with
name'John Smith'
I cannot find any resources specifically for Flask-SQLAlchemy which specify how to do this. I'm aware I would have to use .like() though I don't know how to add it to a SQLAlchemy query in Flask. With SQLAlchemy I could do .where(column.like()) though I cannot in Flask-SQLAlchemy.
How would I go about doing this?
Smith College, the state ofGeorgia, or a person namedPaul Ireland? How is your application supposed to know which tables to query with which pieces of the search string? Do you want to require the user to always use the exact formatN N L L E Efor name, location and education? - Lukas Grafnameandeducationnot fixed, so a user can include anything. - Pav Sidhu