Skip to content

Commit

Permalink
Merge pull request gocardless#16 from gocardless/revert-15-templated-…
Browse files Browse the repository at this point in the history
…vars

Revert "Issue gocardless#7: Handle templated vars"
  • Loading branch information
rliddler authored Aug 14, 2020
2 parents 64bcf00 + 29c47ba commit 5e66722
Showing 1 changed file with 12 additions and 28 deletions.
40 changes: 12 additions & 28 deletions airflow_dbt/operators/dbt_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class DbtBaseOperator(BaseOperator):
"""
Base dbt operator
All other dbt operators are derived from this operator.
:param profiles_dir: If set, passed as the `--profiles-dir` argument to the `dbt` command
:type profiles_dir: str
:param target: If set, passed as the `--target` argument to the `dbt` command
Expand All @@ -29,8 +30,6 @@ class DbtBaseOperator(BaseOperator):

ui_color = '#d6522a'

template_fields = ['vars']

@apply_defaults
def __init__(self,
profiles_dir=None,
Expand All @@ -45,31 +44,16 @@ def __init__(self,
*args,
**kwargs):
super(DbtBaseOperator, self).__init__(*args, **kwargs)

self.profiles_dir = profiles_dir
self.target = target
self.dir = dir
self.vars = vars
self.models = models
self.full_refresh = full_refresh
self.exclude = exclude
self.dbt_bin = dbt_bin
self.verbose = verbose
self.create_hook()

def create_hook(self):
self.hook = DbtCliHook(
profiles_dir=self.profiles_dir,
target=self.target,
dir=self.dir,
vars=self.vars,
full_refresh=self.full_refresh,
models=self.models,
exclude=self.exclude,
dbt_bin=self.dbt_bin,
verbose=self.verbose)

return self.hook
profiles_dir=profiles_dir,
target=target,
dir=dir,
vars=vars,
full_refresh=full_refresh,
models=models,
exclude=exclude,
dbt_bin=dbt_bin,
verbose=verbose)


class DbtRunOperator(DbtBaseOperator):
Expand All @@ -78,7 +62,7 @@ def __init__(self, profiles_dir=None, target=None, *args, **kwargs):
super(DbtRunOperator, self).__init__(profiles_dir=profiles_dir, target=target, *args, **kwargs)

def execute(self, context):
self.create_hook().run_cli('run')
self.hook.run_cli('run')


class DbtTestOperator(DbtBaseOperator):
Expand All @@ -87,4 +71,4 @@ def __init__(self, profiles_dir=None, target=None, *args, **kwargs):
super(DbtTestOperator, self).__init__(profiles_dir=profiles_dir, target=target, *args, **kwargs)

def execute(self, context):
self.create_hook().run_cli('test')
self.hook.run_cli('test')

0 comments on commit 5e66722

Please sign in to comment.