📜  python mysql查询到数据框 - SQL代码示例

📅  最后修改于: 2022-03-11 15:04:56.505000             🧑  作者: Mango

代码示例1
from sqlalchemy import create_engine
import pymysql

db_connection_str = 'mysql+pymysql://mysql_user:mysql_password@mysql_host/mysql_db'
db_connection = create_engine(db_connection_str)

df = pd.read_sql('SELECT * FROM table_name', con=db_connection)

# This works with "mysql.connector" as well