-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
53 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import dbt.events.functions as events_functions | ||
from dbt import flags | ||
from dbt.contracts.graph.nodes import ParsedNode, ModelNode | ||
|
||
from odd_dbt.domain.cli_args import CliArgs, FlagsArgs | ||
from odd_dbt.domain.context import DbtContext | ||
|
||
|
||
def collect_flags(cli_args: CliArgs): | ||
flag_args = FlagsArgs( | ||
project_dir=cli_args.project_dir, | ||
profiles_dir=cli_args.profiles_dir, | ||
target=cli_args.target, | ||
profile=cli_args.profile, | ||
) | ||
flags.set_from_args(flag_args, None) | ||
events_functions.set_invocation_id() | ||
|
||
return flags.get_flags() | ||
|
||
|
||
def get_context(cli_args: CliArgs) -> DbtContext: | ||
collect_flags(cli_args) | ||
return DbtContext(cli_args=cli_args) | ||
|
||
|
||
def is_a_model_node(node: ParsedNode) -> bool: | ||
return isinstance(node, ModelNode) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from odd_models import DataEntity | ||
from oddrn_generator import DbtGenerator | ||
|
||
|
||
def create_dbt_generator_from_oddrn(oddrn: str) -> DbtGenerator: | ||
return DbtGenerator(host_settings=extract_host_from_oddrn(oddrn)) | ||
|
||
|
||
def create_dbt_generator(host: str) -> DbtGenerator: | ||
return DbtGenerator(host_settings=host) | ||
|
||
|
||
def extract_host_from_oddrn(oddrn: str) -> str: | ||
return oddrn.split("//dbt/host/")[-1] | ||
|
||
|
||
def is_data_transformer(data_entity: DataEntity) -> bool: | ||
return data_entity.data_transformer is not None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters