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

Snowflake: use different method of showing columns if no schema specified in db name #4696

Merged
merged 3 commits into from
Mar 1, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions redash/query_runner/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,18 @@ def _run_query_without_warehouse(self, query):
cursor.close()
connection.close()

return data, error
return data, error

def _database_name_includes_schema(self):
return '.' in self.configuration.get('database')

def get_schema(self, get_stats=False):
results, error = self._run_query_without_warehouse("SHOW COLUMNS")
if self._database_name_includes_schema():
query = "SHOW COLUMNS"
else:
query = "SHOW COLUMNS IN DATABASE"

results, error = self._run_query_without_warehouse(query)

if error is not None:
raise Exception("Failed getting schema.")
Expand Down