-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
use show schemas for snowflake list_schemas (#2166) #2171
use show schemas for snowflake list_schemas (#2166) #2171
Conversation
Also fix up the changelog to better reflect releases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment about error handling, but otherwise this LGTM! This change, plus parallelizing the info schema queries we do make, knocks 5s of the runtime for our internal analytics project!
This was super great, I'm glad we did this. Let's also investigate making the same type of change around listing objects in a schema in a future release (#2174).
Ship it once that error handling change is addressed!
@@ -81,3 +82,13 @@ def post_model_hook( | |||
) -> None: | |||
if context is not None: | |||
self._use_warehouse(context) | |||
|
|||
def list_schemas(self, database: str) -> List[str]: | |||
results = self.execute_macro( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the show schemas
query fails (ie. because the database does not exist, or because the user does not have permission), the stdout looks like:
snowflake.connector.errors.ProgrammingError: 002043 (02000): SQL compilation error:
Object does not exist, or operation cannot be performed.
Can we catch this error and re-raise something more helpful, like:
Database error while listing schemas in database '<db name>'
Object does not exist, or operation cannot be performed. <---- the database error
…age about what is going on when list_schemas fails
6d7e453
to
47cef1d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ship it!
resolves #2166
Description
Use
show terse schemas
on snowflake, instead of selecting schemas frominformation_schema.schemata
.Checklist
This PR includes tests, or tests are not required/relevant for this PRExisting tests do not break for this PRCHANGELOG.md
and added information about my change to the "dbt next" section.