I tried to create a pandas DataFrame directly from my sqlserver database using an sqlalchemy engine:
engine = create_engine(URL_string, echo=False, future=True)
query_string = "..."
dt = pd.read_sql(query_string, engine)
But this raises this error:
File <redacted>/venv/lib/python3.8/site-packages/sqlalchemy/future/engine.py:320, in Engine._not_implemented(self, *arg, **kw)
319 def _not_implemented(self, *arg, **kw):
--> 320 raise NotImplementedError(
321 "This method is not implemented for SQLAlchemy 2.0."
322 )
NotImplementedError: This method is not implemented for SQLAlchemy 2.0.
I do this because using pyodbc's connection alone gives a warning:
UserWarning: pandas only support SQLAlchemy connectable(engine/connection) ordatabase string URI or sqlite3 DBAPI2 connectionother DBAPI2 objects are not tested, please consider using SQLAlchemy
warnings.warn(
I'm using sqlalchemy version 1.4 ... so how do I fix this?