how to print contents of table in sqlalchemy code example

Example: how to print contents of table in sqlalchemy

# create an engine using the following code and 
# replace it with path to your .db file.
from sqlalchemy import create_engine
engine = create_engine('sqlite:///employee.db', echo = False)

# Import pandas and connect the engine
# use the lowercase representation of your table name
# For ex:
class Users(db.Model):
	...
    ...
    ...

import pandas as pd

user_table = pd.read_sql_table(table_name="user", con=engine)
# This will load the table as dataframe and then you can display