read frame with sqlalchemy, mysql and pandas
mysql, pandas, sqlalchemy
Solution
You need to have a raw database connection, and not an instance of `Connection`. In order to get it call either `engine.raw_connection()` or `engine.connect().connection`:
from pandas.io import sql
#cnx = engine.connect().connection # option-1
cnx = engine.raw_connection() # option-2
xx = sql.read_frame("SELECT * FROM user", cnx)
cnx.close()
Problem
I am trying to connect to a mysql database, works fine with Option 1: ``` from sqlalchemy import create_engine engine = create_engine('mysql://root:root@localhost/lend', echo=True) cnx = engine.connect() x = cnx.execute("SELECT * FROM user") ``` but breaks down here: ``` from pandas.io import sql xx = sql.read_frame("SELECT * FROM user", cnx) cnx.close() ``` with AttributeError: 'Connection' object has no attribute 'rollback'