TypeError: list indices must be integers or slices, not IsolationLevel
mishbahr opened this issue · 2 comments
mishbahr commented
Follwing example in the README
from sqlalchemy.engine import create_engine
def load_df():
engine = create_engine("trino://trino:8080/tpch/sf1")
with engine.connect() as connection:
df = pd.read_sql("SELECT * FROM public.foobar", connection)
print(df)
I get the following error:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <sqlalchemy_trino.dialect.TrinoDialect object at 0x4025246be0>, dbapi_conn = <trino.dbapi.Connection object at 0x402526ad00>
def get_isolation_level(self, dbapi_conn: trino_dbapi.Connection) -> str:
level_names = ['AUTOCOMMIT',
'READ_UNCOMMITTED',
'READ_COMMITTED',
'REPEATABLE_READ',
'SERIALIZABLE']
> return level_names[dbapi_conn.isolation_level]
E TypeError: list indices must be integers or slices, not IsolationLevel
/usr/local/lib/python3.8/site-packages/sqlalchemy_trino/dialect.py:322: TypeError
It's probably me being silly somewhere. But I'm new to Trino and any help will be appreciated.
Many Thanks
mishbahr commented
Updating "sqlalchemy-trino" dependency to v0.4.1 fixes it.
Thank you for a prompt response.