Skip to content

Commit

Permalink
[DbtProject] Rename prepare_for_deployment by prepare_and_package
Browse files Browse the repository at this point in the history
… in CLI (#22653)

## Summary & Motivation

Following changes in #22513, renaming `prepare_for_deployment` by
`prepare_and_package` to match the new naming convention for DbtProject
and remove ambiguity.

## How I Tested These Changes

BK
  • Loading branch information
maximearmstrong authored Jun 27, 2024
1 parent f35abde commit 354b8b1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions python_modules/libraries/dagster-dbt/dagster_dbt/cli/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def project_scaffold_command(
)


def prepare_for_deployment(project: DbtProject) -> None:
def prepare_and_package(project: DbtProject) -> None:
"""A method that can be called as part of the deployment process."""
if project.preparer:
console.print(
Expand Down Expand Up @@ -358,24 +358,24 @@ def sync_project_to_packaged_dir(
console.print("Sync complete.")


@project_app.command(name="prepare-for-deployment")
def project_prepare_for_deployment_command(
@project_app.command(name="prepare-and-package")
def project_prepare_and_package_command(
file: Annotated[
str,
typer.Option(
help="The file containing DbtProject definitions to prepare.",
),
],
) -> None:
"""This command will invoke ``prepare_for_deployment`` on :py:class:`DbtProject` found in the target module or file."""
"""This command will invoke ``prepare_and_package`` on :py:class:`DbtProject` found in the target module or file."""
console.print(
f"Running with dagster-dbt version: [bold green]{dagster_dbt_version}[/bold green]."
)

contents = load_python_file(file, working_directory=None)
dbt_projects: Iterator[DbtProject] = find_objects_in_module_of_types(contents, types=DbtProject)
for project in dbt_projects:
prepare_for_deployment(project)
prepare_and_package(project)


project_app_typer_click_object = typer.main.get_command(project_app)
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
runner = CliRunner()


def test_prepare_for_deployment(monkeypatch: pytest.MonkeyPatch, dbt_project_dir: Path) -> None:
def test_prepare_and_package(monkeypatch: pytest.MonkeyPatch, dbt_project_dir: Path) -> None:
monkeypatch.chdir(dbt_project_dir)

project_name = "jaffle_dagster"
Expand Down Expand Up @@ -47,7 +47,7 @@ def test_prepare_for_deployment(monkeypatch: pytest.MonkeyPatch, dbt_project_dir
app,
[
"project",
"prepare-for-deployment",
"prepare-and-package",
"--file",
os.fspath(dagster_project_dir.joinpath(project_name, "project.py")),
],
Expand All @@ -58,7 +58,7 @@ def test_prepare_for_deployment(monkeypatch: pytest.MonkeyPatch, dbt_project_dir
assert packaged_project_dir.exists()


def test_prepare_for_deployment_with_dependencies(
def test_prepare_and_package_with_dependencies(
monkeypatch: pytest.MonkeyPatch, dbt_project_dir: Path
) -> None:
monkeypatch.chdir(dbt_project_dir)
Expand Down Expand Up @@ -105,7 +105,7 @@ def test_prepare_for_deployment_with_dependencies(
app,
[
"project",
"prepare-for-deployment",
"prepare-and-package",
"--file",
os.fspath(dagster_project_dir.joinpath(project_name, "project.py")),
],
Expand All @@ -116,7 +116,7 @@ def test_prepare_for_deployment_with_dependencies(
assert manifest_path.exists()


def test_prepare_for_deployment_with_packages(
def test_prepare_and_package_with_packages(
monkeypatch: pytest.MonkeyPatch, dbt_project_dir: Path
) -> None:
monkeypatch.chdir(dbt_project_dir)
Expand Down Expand Up @@ -163,7 +163,7 @@ def test_prepare_for_deployment_with_packages(
app,
[
"project",
"prepare-for-deployment",
"prepare-and-package",
"--file",
os.fspath(dagster_project_dir.joinpath(project_name, "project.py")),
],
Expand All @@ -174,7 +174,7 @@ def test_prepare_for_deployment_with_packages(
assert manifest_path.exists()


def test_prepare_for_deployment_with_state(
def test_prepare_and_package_with_state(
monkeypatch: pytest.MonkeyPatch, dbt_project_dir: Path
) -> None:
monkeypatch.setenv("DAGSTER_DBT_JAFFLE_SCHEMA", "prod")
Expand All @@ -201,7 +201,7 @@ def test_prepare_for_deployment_with_state(

result = runner.invoke(
app,
["project", "prepare-for-deployment", "--file", os.fspath(dbt_project_file_path)],
["project", "prepare-and-package", "--file", os.fspath(dbt_project_file_path)],
)
assert result.exit_code == 0

Expand Down

0 comments on commit 354b8b1

Please sign in to comment.