You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Connection without specifying catalog name in connection string causes an error #305
Later when calling for example tables = meta_inspector.get_table_names('test_schema')
I get the following error
backend-1 | sqlalchemy.exc.DatabaseError: (databricks.sql.exc.ServerOperationError) Fail to execute the command as the target schema `None.test_schema` is not in the current catalog. Please set the current catalog with 'USE CATALOG None' first.
backend-1 | [SQL: SHOW VIEWS FROM `None`.`test_schema`]
After further inspection I found the current method being called:
It could be fixed with adding on Line 278 the following: _target_catalog = kwags.get("catalog") or self.catalog
and referencing the catalog name in the method get_table_names tables = meta_inspector.get_table_names(schema='test_schema',catalog='test_catalog')
NOTE : I'm avoiding creating a different engine for every catalog due to slow response from Databricks
I'm hesitant in opening a PR for this as it's not well tested and I'm not sure if there is an alternative to what i'm trying to achieve , so any feedback would be great !
could work, and seems consistent with the interface that SQLAlchemy defines for get_table_names. Since we run the dialect compliance test suite, so long as the ComponentReflectionTest suite still passes with this change then it should be good for our use case. I'm going to consult internally to ensure this is the path we want to take.
Question for you: are their other inspector / reflection methods that we'd like to support this catalog flag?
Hello @susodapop ,
Thank you for your reply
So far the only method that i've come across that needs catalog flag without major changes is get_view_names
I didn't seem to get a bug or error when I didn't specify a catalog or schema, however it would be nice to be able to select an arbitrary catalog/schema from one engine instead of managing multiple. Is there a way to do this currently?
Activity
susodapop commentedon Dec 21, 2023
This is an interesting request and makes sense to me.
This suggestion:
could work, and seems consistent with the interface that SQLAlchemy defines for
get_table_names. Since we run the dialect compliance test suite, so long as theComponentReflectionTestsuite still passes with this change then it should be good for our use case. I'm going to consult internally to ensure this is the path we want to take.Question for you: are their other inspector / reflection methods that we'd like to support this
catalogflag?RiyadBen commentedon Jan 3, 2024
Hello @susodapop ,
Thank you for your reply
So far the only method that i've come across that needs
catalogflag without major changes isget_view_namesHanSeoulOh commentedon Nov 15, 2024
I didn't seem to get a bug or error when I didn't specify a catalog or schema, however it would be nice to be able to select an arbitrary catalog/schema from one engine instead of managing multiple. Is there a way to do this currently?
cathleeny commentedon Dec 3, 2026
The SQLAlchemy dialect now lives in databricks/databricks-sqlalchemy, and this is tracked there in databricks/databricks-sqlalchemy#26. Per-table and per-query catalog selection is tracked in databricks/databricks-sqlalchemy#49.
Closing as a duplicate.