Skip to content
New issue

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

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

Already on GitHub? # to your account

detecting when a db driver is missing #124

Closed
edublancas opened this issue Feb 8, 2023 · 3 comments · Fixed by #127
Closed

detecting when a db driver is missing #124

edublancas opened this issue Feb 8, 2023 · 3 comments · Fixed by #127
Assignees
Labels
stash Label used to categorize issues that will be worked on next

Comments

@edublancas
Copy link

edublancas commented Feb 8, 2023

In #120, we improved the error message displayed when failing to open a connection to a database. However, we're ignoring the error message content and printing a generic message. This leads to a confusing message when the connection string is valid, and the failure is due to another reason.

There are X reasons a connection might fail, but we should at least cover the most common ones. For example, missing a driver (see this). In such case, we should display a more appropriate message like "fix it by installing X package and try again"

I ran a few tests with some sample URIs and the error is always the same ModuleNotFoundError: No module named 'name'.

The second case we must cover is when the plugin is missing. For example, if we run:

create_engine("duckdb://")

with duckdb-engine installed but duckdb uninstalled, we get: ModuleNotFoundError: No module named 'duckdb' (same as the use case described above).

However, if we uninstall duckdb-engine (regardless of duckdb installed or not), we get:

NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:duckdb

NoSuchModuleError could be either a typo or an actual plugin missing (in this case, the duckdb-engine plugin is missing). So we should keep a list of plugins to distinguish between the two.

@edublancas edublancas changed the title detecting then driver is missing detecting when a db driver is missing Feb 8, 2023
@edublancas edublancas mentioned this issue Feb 8, 2023
3 tasks
@edublancas edublancas added the stash Label used to categorize issues that will be worked on next label Feb 8, 2023
@tonykploomber tonykploomber self-assigned this Feb 8, 2023
@tonykploomber
Copy link

ACK and working on this

@tonykploomber tonykploomber linked a pull request Feb 9, 2023 that will close this issue
3 tasks
@tonykploomber
Copy link

@edublancas
Would you be able to elaborate on this?

So we should keep a list of plugins to distinguish between the two.

@edublancas
Copy link
Author

edublancas commented Feb 10, 2023

Would you be able to elaborate on this?

Sure. When we see this error:

NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:duckdb

We should indicate the user that they're missing a package. In this case, they're missing duckdb-engine. So we should be able to map the error to the missing package (hence keep a list). In this case, the error says sqlalchemy.dialects:duckdb and the missing package is duckdb-engine. We're good as long as we cover the most common ones.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
stash Label used to categorize issues that will be worked on next
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants