To use sqlalchemy for database:
from sqlalchemy import create_engine
from sqlalchemy.engine.url import URL
url = URL(drivername='mysql',
username='user',
password='passwd',
host='host',
database='db')
engine = create_engine(url) # sqlalchemy engine
Now this engine can be used: e.g. with pandas to fetch dataframes directly from mysql
import pandas as pd
con = engine.connect()
dataframe = pd.read_sql(sql=query, con=con)