Skip to content

Commit

Permalink
Fix fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Kokorin committed Dec 18, 2024
1 parent 6f878c9 commit 82471f5
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions scripts/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,21 @@


@click.command
@click.option('--project-dir', envvar='DBT_PROJECT_DIR', default='.dbt_project',
type=click.Path(path_type=pathlib.Path, resolve_path=True))
@click.option('--profiles-dir', envvar='DBT_PROFILES_DIR', default='.dbt_project',
type=click.Path(path_type=pathlib.Path, resolve_path=True))
@click.option('--keep', is_flag=True, default=False, show_default=True, help="Don't prune project dir")
@click.option(
"--project-dir",
envvar="DBT_PROJECT_DIR",
default=".dbt_project",
type=click.Path(path_type=pathlib.Path, resolve_path=True),
)
@click.option(
"--profiles-dir",
envvar="DBT_PROFILES_DIR",
default=".dbt_project",
type=click.Path(path_type=pathlib.Path, resolve_path=True),
)
@click.option("--keep", is_flag=True, default=False, show_default=True, help="Don't prune project dir")
@click.argument("models", default=10, type=int)
def cli(project_dir: Path, profiles_dir: Path, keep: bool, models: int):
def cli(*_, project_dir: Path, profiles_dir: Path, keep: bool, models: int):
"""
Generates simple DBT project which can be used for manual testing of dbt-pumpkin output
"""
Expand All @@ -31,18 +39,21 @@ def cli(project_dir: Path, profiles_dir: Path, keep: bool, models: int):

project_dir.mkdir(parents=True, exist_ok=True)

(project_dir / "dbt_project.yml").write_text(textwrap.dedent("""\
(project_dir / "dbt_project.yml").write_text(
textwrap.dedent("""\
name: my_pumpkin
version: 1.0.0
profile: test_pumpkin
models:
my_pumpkin:
+dbt-pumpkin-path: "_schema/{name}.yml"
"""))
""")
)

print(f"Will generate DBT profiles at {profiles_dir}")

(profiles_dir / "profiles.yml").write_text(textwrap.dedent(f"""\
(profiles_dir / "profiles.yml").write_text(
textwrap.dedent(f"""\
test_pumpkin:
target: test
outputs:
Expand All @@ -51,16 +62,19 @@ def cli(project_dir: Path, profiles_dir: Path, keep: bool, models: int):
type: duckdb
path: {project_dir}/test.duckdb
threads: 8
"""))
""")
)

models_dir = project_dir / "models"
models_dir.mkdir(parents=True, exist_ok=True)

for i in range(1, models + 1):
model_path = models_dir / f"model_{i}.sql"
model_path.write_text(textwrap.dedent("""\
model_path.write_text(
textwrap.dedent("""\
select 1 as id
"""))
""")
)

print("Generated")

Expand Down

0 comments on commit 82471f5

Please sign in to comment.