Description
SQLAlchemy version: 1.4.22
databricks-sql-connector version: 2.9.3
The following code throws the error below:
from sqlalchemy import create_engine
[...]
conn = create_engine(
f"databricks://token:{token}@{host}?http_path={path}"
"&catalog={catalog}&schema={schema}"
)
test = pd.read_sql_table(table, con=conn)
File "[REDACTED]\sqlalchemy\engine\reflection.py", line 266, in get_table_names
return self.dialect.get_table_names(
File "[REDACTED]\databricks\sqlalchemy\dialect_init_.py", line 247, in get_table_names
with self.get_connection_cursor(connection) as cur:
File "[REDACTED]\databricks\sqlalchemy\dialect_init_.py", line 299, in get_connection_cursor
return connection._dbapi_connection.dbapi_connection.cursor()
File "[REDACTED]\sqlalchemy\pool\base.py", line 985, in getattr
return getattr(self.connection, key)
AttributeError: 'Connection' object has no attribute 'dbapi_connection'
I believe the line linked below should read connection._dbapi_connection.cursor()
(attr exists) instead of connection._dbapi_connection.dbapi_connection.cursor()
(attr doesnt exist)