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

use "show objects in schema" (#2174) #2322

Merged
merged 2 commits into from
Apr 16, 2020

Conversation

beckjake
Copy link
Contributor

resolves #2174

Description

Use "show terse objects in schema" to implement list_relations_without_caching, instead of the information schema.

I added a try/except to catch the error when the schema doesn't exist and return an empty list - this emulates the old behavior.

Checklist

  • I have signed the CLA
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR - it passes all existing tests
  • I have updated the CHANGELOG.md and added information about my change to the "dbt next" section.

@cla-bot cla-bot bot added the cla:yes label Apr 14, 2020
@beckjake beckjake requested a review from drewbanin April 14, 2020 18:51
@beckjake
Copy link
Contributor Author

Locally I saw a significant performance improvement on the test suite: The time to run all snowflake tests went from 663s to 545s! Real dbt projects will have a much lower proportion of list_schemas_without_caching calls to real work than the test suite, but I assume we'll see some noticeable performance improvements.

Copy link
Contributor

@drewbanin drewbanin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ship it

# if the schema doesn't exist, we just want to return.
# Alternatively, we could query the list of schemas before we start
# and skip listing the missing ones, which sounds expensive.
if 'Object does not exist' in str(exc):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a really good call!

@beckjake
Copy link
Contributor Author

That change was just a changelog merge conflcit, merging now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use show objects in schema on Snowflake
2 participants