Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

has_table doesn't work - missing back-quotes around catalog name #232

Open
narquette opened this issue Sep 27, 2023 · 4 comments
Open

has_table doesn't work - missing back-quotes around catalog name #232

narquette opened this issue Sep 27, 2023 · 4 comments
Assignees
Labels
bug Something isn't working sqlalchemy

Comments

@narquette
Copy link

Issue:

When I attempt to see if a table exists (inspection.has_table(table_name='x', schema='y'), I get an error saying that the catalog name
must be surrounded by back-quote.

Recreation Steps:

  1. Build a sqlalchemy connection to databricks
  2. Put sqlalchemy engine into a variable
  3. Put inspection (sqlachemy.inspect) into a variable.

The engine will be an parameter for inspect (e.g. inspect = inspect(engine))

  1. Attempt to use has table

inspect.has_table(table_name='y', schema='x')

Expected: You will get no error message
Actual: You get an error message:

[INVALID_IDENTIFIER] The identifier intelli-intelli-curvgh is invalid. Please, consider quoting it with back-quotes as intelli-intelli-curvgh.(line 1, pos 22)

== SQL ==
DESCRIBE TABLE intelli-intelli-curvgh.dm2_mortality_in.diagnosis_pre

Environment Info:

OS Windows
Python = 3.10

Python Libraries:

databricks-sql-connector==2.9.3
sqlalchemy==1.4.49

@susodapop
Copy link
Contributor

Thanks for the report. We're making a ton of changes to the SQLAlchemy dialect this week. Expect to see this fixed shortly.

@susodapop susodapop self-assigned this Sep 27, 2023
@narquette
Copy link
Author

This issue also happens when you try to show the table names in a schema.

inspect.get_table_names('<schema_name>')

Error Message:

[INVALID_IDENTIFIER] The identifier intelli-intelli-curvgh is invalid. Please, consider quoting it with back-quotes as intelli-intelli-curvgh.(line 1, pos 24)
== SQL ==
SHOW TABLES FROM intelli-intelli-curvgh.mortalitystudy_2020_deidentified

@narquette
Copy link
Author

@susodapop
Any update? Has this been put into any branch?

@susodapop
Copy link
Contributor

The update is the same. I'm re-implementing all of sqlalchemy for compatibility with sqla2. This will be captured in those changes. I haven't touched this specifically yet since we're overhauling everything. If you watch the PR's on this repository in the next few days you'll see it pop through. It won't be released until 3.0.0 later this month.

@kravets-levko kravets-levko added bug Something isn't working sqlalchemy labels Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sqlalchemy
Projects
None yet
Development

No branches or pull requests

3 participants