Retrieve MySQL/MariaDB data with Python
A while ago I had some issues retrieving data from MySQL using Python, as my Python was more up-to-date than the official bindings. A few days ago I found a nice GIST (https://gist.github.com/stefanthoss/364b2a99521d5bb76d51) that uses pymysql:
import pandas as pd import pymysql from sqlalchemy import create_engine engine = create_engine('mysql+pymysql://<user>:<password>@<host>[:<port>]/<dbname>') df = pd.read_sql_query('SELECT * FROM table', engine) df.head() |