Skip to content

Commit

Permalink
Merge pull request #2817 from zmac12/feature/addDebugQueryMethod
Browse files Browse the repository at this point in the history
Feature/add debug query method
  • Loading branch information
jtcohen6 authored Oct 8, 2020
2 parents aeae18e + 03d3943 commit fd5e10c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
### Under the hood
- Added strategy-specific validation to improve the relevancy of compilation errors for the `timestamp` and `check` snapshot strategies. (([#2787](https:/fishtown-analytics/dbt/issues/2787), [#2791](https:/fishtown-analytics/dbt/pull/2791))
- Changed rpc test timeouts to avoid locally run test failures ([#2803](https:/fishtown-analytics/dbt/issues/2803),[#2804](https:/fishtown-analytics/dbt/pull/2804))
- Added a debug_query on the base adapter that will allow plugin authors to create custom debug queries ([#2751](https:/fishtown-analytics/dbt/issues/2751),[#2871](https:/fishtown-analytics/dbt/pull/2817))

Contributors:
- [@joelluijmes](https:/joelluijmes) ([#2749](https:/fishtown-analytics/dbt/pull/2749), [#2821](https:/fishtown-analytics/dbt/pull/2821))
- [@kingfink](https:/kingfink) ([#2791](https:/fishtown-analytics/dbt/pull/2791))
- [@zmac12](https:/zmac12) ([#2871](https:/fishtown-analytics/dbt/pull/2817))

## dbt 0.18.1 (Release TBD)

Expand Down
3 changes: 3 additions & 0 deletions core/dbt/adapters/base/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ def clear_transaction(self) -> None:
def commit_if_has_connection(self) -> None:
self.connections.commit_if_has_connection()

def debug_query(self) -> None:
self.execute('select 1 as id')

def nice_connection_name(self) -> str:
conn = self.connections.get_if_exists()
if conn is None or conn.name is None:
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/task/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def attempt_connection(profile):
adapter = get_adapter(profile)
try:
with adapter.connection_named('debug'):
adapter.execute('select 1 as id')
adapter.debug_query()
except Exception as exc:
return COULD_NOT_CONNECT_MESSAGE.format(
err=str(exc),
Expand Down

0 comments on commit fd5e10c

Please sign in to comment.