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

Allow for running sample mode with build command #11307

Merged
merged 1 commit into from
Feb 14, 2025
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-20250213-182932.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Features
body: Enable sample mode for 'build' command
time: 2025-02-13T18:29:32.238857-06:00
custom:
Author: QMalcolm
Issue: "11298"
1 change: 1 addition & 0 deletions core/dbt/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ def cli(ctx, **kwargs):
@p.project_dir
@p.resource_type
@p.exclude_resource_type
@p.sample
@p.select
@p.selector
@p.show
Expand Down
15 changes: 9 additions & 6 deletions tests/functional/sample_mode/test_sample_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,14 @@ def event_catcher(self) -> EventCatcher:
return EventCatcher(event_to_catch=JinjaLogInfo) # type: ignore

@pytest.mark.parametrize(
"sample_mode_available,run_sample_mode,expected_row_count",
"dbt_command,sample_mode_available,run_sample_mode,expected_row_count",
[
(True, True, 2),
(True, False, 3),
(False, True, 3),
(False, False, 3),
("run", True, True, 2),
("run", True, False, 3),
("run", False, True, 3),
("run", False, False, 3),
("build", True, True, 2),
("build", False, True, 3),
],
)
@freezegun.freeze_time("2025-01-03T02:03:0Z")
Expand All @@ -136,11 +138,12 @@ def test_sample_mode(
project,
mocker: MockerFixture,
event_catcher: EventCatcher,
dbt_command: str,
sample_mode_available: bool,
run_sample_mode: bool,
expected_row_count: int,
):
run_args = ["run"]
run_args = [dbt_command]
expected_sample = None
if run_sample_mode:
run_args.append("--sample=1 day")
Expand Down
Loading