Skip to content

Commit

Permalink
Rename prepared to prepare
Browse files Browse the repository at this point in the history
  • Loading branch information
maximearmstrong committed Jun 13, 2024
1 parent 93a76e1 commit c2d85d3
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
Binary file modified docs/content/api/modules.json.gz
Binary file not shown.
Binary file modified docs/content/api/searchindex.json.gz
Binary file not shown.
Binary file modified docs/content/api/sections.json.gz
Binary file not shown.
Binary file modified docs/next/public/objects.inv
Binary file not shown.
10 changes: 5 additions & 5 deletions python_modules/libraries/dagster-dbt/dagster_dbt/dbt_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class DbtProject(IHaveNew):
from dagster_dbt import DbtProject
my_project = DbtProject(project_dir=Path("path/to/dbt_project")).prepared()
my_project = DbtProject(project_dir=Path("path/to/dbt_project")).prepare()
Creating a DbtProject that changes target based on environment variables and uses manged state artifacts:
Expand All @@ -175,7 +175,7 @@ def get_env():
project_dir=Path('path/to/dbt_project'),
state_path="target/managed_state",
target=get_env(),
).prepared()
).prepare()
"""

Expand Down Expand Up @@ -240,7 +240,7 @@ def __new__(
)

@public
def prepared(self) -> "DbtProject":
def prepare(self) -> "DbtProject":
"""Execute the preparation process for a dbt project and return the DbtProject object when complete.
By default, the preparation process for DbtProject is the following:
Expand All @@ -264,7 +264,7 @@ def prepared(self) -> "DbtProject":
from dagster import Definitions
from dagster_dbt import DbtProject
my_project = DbtProject(project_dir=Path("path/to/dbt_project")).prepared()
my_project = DbtProject(project_dir=Path("path/to/dbt_project")).prepare()
defs = Definitions(
resources={
Expand All @@ -284,7 +284,7 @@ def prepared(self) -> "DbtProject":
my_project = DbtProject(project_dir=Path("path/to/dbt_project"))
@dbt_assets(manifest=my_project.prepared().manifest_path)
@dbt_assets(manifest=my_project.prepare().manifest_path)
def my_dbt_asset():
...
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ from .constants import dbt_manifest_path
{% endif %}

{% if use_experimental_dbt_project -%}
@dbt_assets(manifest={{ dbt_project_name }}.prepared().manifest_path)
@dbt_assets(manifest={{ dbt_project_name }}.prepare().manifest_path)
{% else -%}
@dbt_assets(manifest=dbt_manifest_path)
{% endif -%}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ def test_local_dev(project_dir) -> None:
with pytest.raises(DagsterDbtManifestNotFoundError):
# The preparation process will fail locally
# if no env var are provided and the manifest does not exist
DbtProject(project_dir).prepared()
DbtProject(project_dir).prepare()
with environ({"DAGSTER_IS_DEV_CLI": "1"}):
my_project = DbtProject(project_dir).prepared()
my_project = DbtProject(project_dir).prepare()
assert my_project.manifest_path.exists()


Expand All @@ -42,14 +42,14 @@ def test_opt_in_env_var(project_dir) -> None:
with pytest.raises(DagsterDbtManifestNotFoundError):
# The preparation process will fail locally
# if no env var are provided and the manifest does not exist
DbtProject(project_dir).prepared()
DbtProject(project_dir).prepare()
with environ({"DAGSTER_DBT_PARSE_PROJECT_ON_LOAD": "1"}):
my_project = DbtProject(project_dir).prepared()
my_project = DbtProject(project_dir).prepare()
assert my_project.manifest_path.exists()


def _init(project_dir):
my_project = DbtProject(project_dir).prepared()
my_project = DbtProject(project_dir).prepare()
assert my_project.manifest_path.exists()
assert validate_manifest(my_project.manifest_path)
return
Expand All @@ -61,7 +61,7 @@ def test_concurrent_processes(project_dir):
with pytest.raises(DagsterDbtManifestNotFoundError):
# The preparation process will fail locally
# if no env var are provided and the manifest does not exist
DbtProject(project_dir).prepared()
DbtProject(project_dir).prepare()
with environ({"DAGSTER_IS_DEV_CLI": "1"}):
procs = [multiprocessing.Process(target=_init, args=(project_dir,)) for _ in range(4)]
for proc in procs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ def test_dbt_cli_defer_args(monkeypatch: pytest.MonkeyPatch, testrun_uid: str) -

dbt.cli(["--quiet", "parse"], target_path=project.target_path).wait()

@dbt_assets(manifest=project.prepared().manifest_path)
@dbt_assets(manifest=project.prepare().manifest_path)
def my_dbt_assets(context: AssetExecutionContext, dbt: DbtCliResource):
yield from dbt.cli(["build", *dbt.get_defer_args()], context=context).stream()

Expand Down

0 comments on commit c2d85d3

Please sign in to comment.