Skip to content

Commit

Permalink
DCV-2893 dbt-coves setup: add new --template-url (#497)
Browse files Browse the repository at this point in the history
* DCV-2893 dbt-coves setup: add new --setup-template-url flag

* Rename to --template-url
  • Loading branch information
BAntonellini authored Sep 10, 2024
1 parent fc9a97f commit 5868e28
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions dbt_coves/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ class LoadModel(BaseModel):
class SetupModel(BaseModel):
no_prompt: Optional[bool] = False
quiet: Optional[bool] = False
template_url: Optional[str] = "https://github.com/datacoves/setup_template.git"


class RunDbtModel(BaseModel):
Expand Down Expand Up @@ -241,6 +242,7 @@ class DbtCovesConfig:
"load.airbyte.secrets_key",
"setup.no_prompt",
"setup.quiet",
"setup.template_url",
"dbt.command",
"dbt.project_dir",
"dbt.virtualenv",
Expand Down
6 changes: 5 additions & 1 deletion dbt_coves/tasks/setup/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ def register_parser(cls, sub_parsers, base_subparser):
help="Skip rendering results",
default=False,
)
ext_subparser.add_argument(
"--template-url",
help="URL to the setup template repository",
)
ext_subparser.set_defaults(cls=cls, which="setup")
cls.arg_parser = ext_subparser
return ext_subparser
Expand Down Expand Up @@ -136,7 +140,7 @@ def setup_datacoves(self):
for service in services:
self.copier_context[service] = True
copier.run_auto(
src_path="[email protected]:datacoves/setup_template.git",
src_path=self.get_config_value("template_url"),
dst_path=self.repo_path,
data=self.copier_context,
quiet=self.get_config_value("quiet"),
Expand Down
6 changes: 3 additions & 3 deletions dbt_coves/utils/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,7 @@ def __init__(self, cli_parser: ArgumentParser) -> None:
"template": "https://github.com/datacoves/cookiecutter-dbt.git",
"current-dir": False,
}
self.setup = {
"no_prompt": False,
}
self.setup = {"no_prompt": False, "template_url": None}
self.dbt = {"command": None, "project_dir": None, "virtualenv": None, "cleanup": False}
self.data_sync = {"redshift": {"tables": []}, "snowflake": {"tables": []}}
self.blue_green = {
Expand Down Expand Up @@ -395,6 +393,8 @@ def parse_args(self, cli_args: List[str] = list()) -> None:
self.setup["no_prompt"] = self.args.no_prompt
if self.args.quiet:
self.setup["quiet"] = self.args.quiet
if self.args.template_url:
self.setup["template_url"] = self.args.template_url

# run dbt
if self.args.cls.__name__ == "RunDbtTask":
Expand Down

0 comments on commit 5868e28

Please sign in to comment.