SQLAlchemy v2.0.0 works in a different way - they have changed some of the api.
Following investigation I found a solution. My code was simply:
s_settings_df = pd.read_sql_query(query, engine_cloud)
The error like the title, "AttributeError: 'OptionEngine' object has no attribute 'execute'"
I will answer my own post below.
I tried using various versions but did not like the idea of getting locked with historic components.
Adding the text import:
from sqlalchemy import create_engine, text
engine_cloud = create_engine("mysql+mysqldb://usr:pwd@localhost/dbs") # replace with your parameters
s_settings_df = pd.DataFrame(engine_cloud.connect().execute(text(query)))
I hope that helps someone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With