SNOW-1871391: SnowflakeDialect get_table_names is now returning dict_keys breaks compatibility #566
Labels
bug
Something isn't working
status-triage_done
Initial triage done, will be further handled by the driver team
Please answer these questions before submitting your issue. Thanks!
What version of Python are you using?
Python 3.12.3
What operating system and processor architecture are you using?
Linux-6.8.0-35-generic-x86_64-with-glibc2.39
What are the component versions in the environment (
pip freeze
)?langchain-community==0.3.13
snowflake-sqlalchemy==1.7.2
SQLAlchemy==2.0.31
What did you do?
When creating a db connection in langchain, it calls snowflake-sqlalchemy and sqlalchemy inspector, it fails due to a recent change in get_table_names
File "....../py/lib/python3.12/site-packages/langchain_community/utilities/sql_database.py", line 139, in from_uri
return cls(create_engine(database_uri, **_engine_args), **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "....../py/lib/python3.12/site-packages/langchain_community/utilities/sql_database.py", line 75, in init
self._inspector.get_table_names(schema=schema)
TypeError: unsupported operand type(s) for +: 'dict_keys' and 'list'
The get_table_names in SnowflakeDialect has recently changed to return keys of a dictionary -> dict_keys
https://github.com/snowflakedb/snowflake-sqlalchemy/blob/main/src/snowflake/sqlalchemy/snowdialect.py#L758
However, sqlalchemy get_table_names returns a List[str]
https://docs.sqlalchemy.org/en/20/core/reflection.html#sqlalchemy.engine.reflection.Inspector.get_table_names
return list(ret) in L759 should fix the problem
The text was updated successfully, but these errors were encountered: