Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add --empty flag to dbt build #10027

Merged
merged 3 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/unreleased/Features-20240424-180639.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Features
body: add --empty flag to dbt build command
time: 2024-04-24T18:06:39.438457-04:00
custom:
Author: michelleark
Issue: "10026"
1 change: 1 addition & 0 deletions core/dbt/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ def cli(ctx, **kwargs):
@cli.command("build")
@click.pass_context
@global_flags
@p.empty
@p.exclude
@p.export_saved_queries
@p.full_refresh
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"""


class BaseTestEmpty:
class TestEmptyFlag:
@pytest.fixture(scope="class")
def seeds(self):
return {
Expand Down Expand Up @@ -70,6 +70,13 @@ def test_run_with_empty(self, project):
run_dbt(["run", "--empty"])
self.assert_row_count(project, "model", 0)

# build without empty - 3 expected rows in output - 1 from each input
run_dbt(["build"])
self.assert_row_count(project, "model", 3)

# build with empty - 0 expected rows in output
run_dbt(["build", "--empty"])
self.assert_row_count(project, "model", 0)

class TestEmpty(BaseTestEmpty):
pass
# ensure dbt compile supports --empty flag
run_dbt(["compile", "--empty"])