I have a form in my flask application that collects emails, usernames, and phone numbers. I have stored them all in the SQLite database using flask sqlalchemy. Let's say my database looks like the following:
Email Username Phone Number
[email protected] James 123456789
[email protected] Jane 987654321
I have an HTML file and I would like to display data there. What I have is :
> @app.route("/Display")
def Display():
# Here I want to get all data from the database
# like this data=get from database
return render_template('Display.html', data=data)
I would like to know can anyone tell me how to retrieve data or get the data from database using flask sqlalchemy ORM. I know query.filter_by can be used to filter according to a username or email or phone number. However, how can I get the whole table (like in a form to pass to render_template? like in HTML page I want to loop through data and use data.username or data.email)