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

Provide a programmatic method for validating targets #1754

Closed
drewbanin opened this issue Sep 16, 2019 · 2 comments
Closed

Provide a programmatic method for validating targets #1754

drewbanin opened this issue Sep 16, 2019 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@drewbanin
Copy link
Contributor

Describe the feature

dbt should provide a programmatic method for validating target definitions. This method should accept a plain Python dictionary containing a target definition, as well as the name of an adapter to validate that target with.

If the target is valid (not malformed + dbt can connect to the database and run a select 1 statement), then the method should return a successful result. If there is an issue validating the target or making the request to the database, then the method should raise an exception.

Example API:

import dbt
from dbt.task.debug_task import DebugTask

try:
  DebugTask.validate_connection('redshift', {'host': 'abc123', ...})
except ValidationException as e:
  ...

@beckjake can you help inform the API here? Unsure if it makes sense to build this into the DebugTask, or if this should happen somewhere else.

The big idea is to give production environments (dbt Cloud, Airflow, Jenkins) a good way to validate connections & return a machine readable connection status without requiring a dbt project to be present. Presently, the dbt debug command only works if the command is run from a project directory with a profiles.yml file located somewhere on disk.

cc @cmcarthur

@drewbanin drewbanin added the enhancement New feature or request label Sep 16, 2019
@drewbanin drewbanin added this to the 0.14.3 milestone Sep 16, 2019
@beckjake
Copy link
Contributor

Unsure if it makes sense to build this into the DebugTask, or if this should happen somewhere else.

I think it should probably just be a utility function somewhere. We can attach it to the DebugTask namespace if that feels nice to us but I don't think it matters.

@beckjake
Copy link
Contributor

Fixed in #1775

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

No branches or pull requests

2 participants