diff --git a/providers/dbt/core/operators.py b/providers/dbt/core/operators.py index c3968cf05..096f0f818 100644 --- a/providers/dbt/core/operators.py +++ b/providers/dbt/core/operators.py @@ -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" + 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