From 6538f0066d4c1457d8cbeed6743af02f262cac3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=BDborn=C3=BD=20Adam?= Date: Wed, 2 Nov 2022 15:45:12 +0100 Subject: [PATCH] Added dbt build step --- src/Configuration/NodeDefinition/DbtNode.php | 1 + src/Service/DbtService.php | 1 + .../expected-stdout | 17 ++++++++++++++++- .../source/data/config.json | 2 +- .../ConfigDefinition/ConfigDefinitionTest.php | 4 ++-- 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/Configuration/NodeDefinition/DbtNode.php b/src/Configuration/NodeDefinition/DbtNode.php index fcb877cd..bb39acb9 100644 --- a/src/Configuration/NodeDefinition/DbtNode.php +++ b/src/Configuration/NodeDefinition/DbtNode.php @@ -13,6 +13,7 @@ class DbtNode extends ArrayNodeDefinition public const NODE_NAME = 'dbt'; private const ACCEPTED_DBT_COMMANDS = [ + DbtService::COMMAND_BUILD, DbtService::COMMAND_RUN, DbtService::COMMAND_DOCS_GENERATE, DbtService::COMMAND_TEST, diff --git a/src/Service/DbtService.php b/src/Service/DbtService.php index 767e680a..8a367ccc 100644 --- a/src/Service/DbtService.php +++ b/src/Service/DbtService.php @@ -11,6 +11,7 @@ class DbtService { + public const COMMAND_BUILD = 'dbt build'; public const COMMAND_COMPILE = 'dbt compile'; public const COMMAND_DOCS_GENERATE = 'dbt docs generate'; public const COMMAND_DEBUG = 'dbt debug'; diff --git a/tests/functional/run-action-with-multiple-execute-steps/expected-stdout b/tests/functional/run-action-with-multiple-execute-steps/expected-stdout index d0e9752f..208a5c29 100644 --- a/tests/functional/run-action-with-multiple-execute-steps/expected-stdout +++ b/tests/functional/run-action-with-multiple-execute-steps/expected-stdout @@ -2,9 +2,24 @@ Successfully cloned repository https://github.com/keboola/dbt-test-project-publi Executing command "dbt deps" Running with dbt=%s Warning: No packages were found in packages.yml -Executing command "dbt run" +Executing command "dbt build" Running with dbt=%s Partial parse save file not found. Starting full parse. +Found 2 models, 2 tests, 0 snapshots, 0 analyses, 267 macros, 0 operations, 0 seed files, 2 sources, 0 exposures, 0 metrics +Concurrency: 1 threads (target='kbc_prod') +1 of 4 START test source_not_null_in.c-test-bucket_test__id_ ................... [RUN] +1 of 4 PASS source_not_null_in.c-test-bucket_test__id_ ......................... [PASS in %ss] +2 of 4 START test source_unique_in.c-test-bucket_test__id_ ..................... [RUN] +2 of 4 PASS source_unique_in.c-test-bucket_test__id_ ........................... [PASS in %ss] +3 of 4 START view model WORKSPACE_875822722.stg_model .......................... [RUN] +3 of 4 OK created view model WORKSPACE_875822722.stg_model ..................... [SUCCESS 1 in %ss] +4 of 4 START view model WORKSPACE_875822722.fct_model .......................... [RUN] +4 of 4 OK created view model WORKSPACE_875822722.fct_model ..................... [SUCCESS 1 in %ss] +Finished running 2 tests, 2 view models in %s hours %s minutes and %s seconds (%ss). +Completed successfully +Done. PASS=4 WARN=0 ERROR=0 SKIP=0 TOTAL=4 +Executing command "dbt run" +Running with dbt=%s Found 2 models, 2 tests, 0 snapshots, 0 analyses, %s macros, 0 operations, 0 seed files, 2 sources, 0 exposures, 0 metrics Concurrency: 1 threads (target='kbc_prod') 1 of 2 START view model %s.stg_model %s [RUN] diff --git a/tests/functional/run-action-with-multiple-execute-steps/source/data/config.json b/tests/functional/run-action-with-multiple-execute-steps/source/data/config.json index e16a0619..941ca859 100644 --- a/tests/functional/run-action-with-multiple-execute-steps/source/data/config.json +++ b/tests/functional/run-action-with-multiple-execute-steps/source/data/config.json @@ -14,7 +14,7 @@ "repo": "https://github.com/keboola/dbt-test-project-public.git" }, "dbt": { - "executeSteps": ["dbt run", "dbt docs generate", "dbt test", "dbt source freshness"], + "executeSteps": ["dbt build", "dbt run", "dbt docs generate", "dbt test", "dbt source freshness"], "threads": 1, "freshness": { "warn_after": {"active": true, "count": 1, "period": "day"} diff --git a/tests/phpunit/ConfigDefinition/ConfigDefinitionTest.php b/tests/phpunit/ConfigDefinition/ConfigDefinitionTest.php index 5f31d730..43d5fb53 100644 --- a/tests/phpunit/ConfigDefinition/ConfigDefinitionTest.php +++ b/tests/phpunit/ConfigDefinition/ConfigDefinitionTest.php @@ -457,8 +457,8 @@ public function invalidConfigsData(): Generator ], ], 'expectedError' => 'The value "dbt do nothing" is not allowed for path ' . - '"root.parameters.dbt.executeSteps.0". Permissible values: "dbt run", "dbt docs generate", ' . - '"dbt test", "dbt source freshness"', + '"root.parameters.dbt.executeSteps.0". Permissible values: "dbt build", "dbt run", ' . + '"dbt docs generate", "dbt test", "dbt source freshness"', ]; yield 'config with remote DWH non-supported type' => [