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

Create the DBTTestOperator #3

Merged
merged 2 commits into from
Dec 13, 2022
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
38 changes: 38 additions & 0 deletions providers/dbt/core/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,41 @@ def execute(self, context: Context):
cmd = self.build_command() + self.add_cmd_flags() + target_flag
result = self.run_command(cmd=cmd, env=env)
return result.output


class DBTRunOperator(DBTBaseOperator):
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)

def add_cmd_flags(self):
flags = []
return flags

def execute(self, context: Context):
self.base_cmd = "run"
self.create_default_profiles()
profile, profile_vars = self.map_profile()
env = self.get_env(context) | profile_vars
target_flag = ["--profile", profile]
cmd = self.build_command() + self.add_cmd_flags() + target_flag
result = self.run_command(cmd=cmd, env=env)
return result.output


class DBTTestOperator(DBTBaseOperator):
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)

def add_cmd_flags(self):
flags = []
return flags

def execute(self, context: Context):
self.base_cmd = "test"
chrishronek marked this conversation as resolved.
Show resolved Hide resolved
self.create_default_profiles()
profile, profile_vars = self.map_profile()
env = self.get_env(context) | profile_vars
target_flag = ["--profile", profile]
cmd = self.build_command() + self.add_cmd_flags() + target_flag
result = self.run_command(cmd=cmd, env=env)
return result.output