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

Feature/add debug query method #2811

Closed

Conversation

zmac12
Copy link
Contributor

@zmac12 zmac12 commented Oct 3, 2020

resolves #2751

Description

In the base debug task, there was a hard-coded test query that wouldn't work in some databases (e.g. Oracle). This new debug_query method on the base adapter allows plugin authors to specify their own debug query.

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
  • 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 Oct 3, 2020
@zmac12
Copy link
Contributor Author

zmac12 commented Oct 3, 2020

First time committer to any open source project here! I believe my change to debug.py needs a parameter in the new method, but I'm unsure what it should be. If any of you had a suggestion as to what it needs to be I'll revise the PR and open it again. Thanks!

@zmac12 zmac12 closed this Oct 3, 2020
@zmac12 zmac12 deleted the feature/addDebugQueryMethod branch October 3, 2020 22:50
@jtcohen6
Copy link
Contributor

jtcohen6 commented Oct 5, 2020

@zmac12 I think you're on the right track! debug_query should go in core/dbt/adapters/base/impl.py rather than connections.py, and in the general case I it can be as simple as:

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

Then plugin authors can override it by reimplementing the adapter method for themselves, e.g. in core/dbt/adapters/oracle/impl.py:

def debug_query(self):
    self.execute('select 1 from dual')

@zmac12 zmac12 mentioned this pull request Oct 8, 2020
4 tasks
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.

Update debug task to make the debug query an adapter method
2 participants