Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to read mysql table in python

import pandas as pd
import sqlalchemy

# make sure you have installed both mysql & pymysql

													# root:root is my username and password/default
engine = sqlalchemy.create_engine("mysql+pymysql://root:root@localhost/database name", pool_pre_ping=True)
# then specify the name of the table in the database
df = pd.read_sql_table('table name', engine)
print(df)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #read #mysql #table #python
ADD COMMENT
Topic
Name
9+4 =