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

refreshing snowflake schema w/o waking cluster #4285

Merged
merged 3 commits into from
Dec 2, 2019

Conversation

monicagangwar
Copy link
Contributor

@monicagangwar monicagangwar commented Oct 24, 2019

What type of PR is this? (check all applicable)

  • Refactor

Description

Refreshing snowflake schema w/o waking cluster. Used show columns for this which executes the command w/o having to require a warehouse.
Created a new internal function in the query runner __run_query_without_warehouse instead of modifying the existing run_query function so as to not change the definition as specified in the base class

Related Tickets & Documents

#4217

Copy link
Member

@arikfr arikfr left a comment

Choose a reason for hiding this comment

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

Thank you for taking a stab at this! I'm sure Snowflake users will appreciate it. 👍

Please see comments to improve the code maintainability. 🙏

@@ -104,16 +104,47 @@ def run_query(self, query, user):

return json_data, error

def __run_query_without_warehouse(self, query, user):
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
def __run_query_without_warehouse(self, query, user):
def _run_query_without_warehouse(self, query):

A single underscore is enough :) (need to update the function call below too).

Also no need to take a user object here.

redash/query_runner/snowflake.py Outdated Show resolved Hide resolved
redash/query_runner/snowflake.py Outdated Show resolved Hide resolved
redash/query_runner/snowflake.py Show resolved Hide resolved
redash/query_runner/snowflake.py Outdated Show resolved Hide resolved
@monicagangwar
Copy link
Contributor Author

@arikfr addressed PR comments and rebased from master

monicagangwar added 3 commits October 28, 2019 20:17
Have also added a new internal method to not select a
warehouse while executing query
Using 'show columns' to fetch database schema instead of
executing a select query in information schema
show columns does not require a warehouse to run
fixing internal function syntax and avoiding
code repetition
@arikfr
Copy link
Member

arikfr commented Dec 2, 2019

Thank you!

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.

None yet

3 participants