diff --git a/CHANGELOG.md b/CHANGELOG.md index db99bab7d3c..98d3761af87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ - Add warning when trying to put a node under the wrong key. ie. A seed under models in a `schema.yml` file. ([#3899](https://github.com/dbt-labs/dbt/issues/3899)) - Plugins for `redshift`, `snowflake`, and `bigquery` have moved to separate repos: [`dbt-redshift`](https://github.com/dbt-labs/dbt-redshift), [`dbt-snowflake`](https://github.com/dbt-labs/dbt-snowflake), [`dbt-bigquery`](https://github.com/dbt-labs/dbt-bigquery) - Change the default dbt packages installation directory to `dbt_packages` from `dbt_modules`. Also rename `module-path` to `packages-install-path` to allow default overrides of package install directory. Deprecation warning added for projects using the old `dbt_modules` name without specifying a `packages-install-path`. ([#3523](https://github.com/dbt-labs/dbt/issues/3523)) +- Update the default project paths to be `analysis-paths = ['analyses']` and `test-paths = ['tests]`. Also have starter project set `analysis-paths: ['analyses']` from now on. ([#2659](https://github.com/dbt-labs/dbt/issues/2659)) Contributors: diff --git a/core/dbt/config/project.py b/core/dbt/config/project.py index fbc471e2091..34c1b8e7d47 100644 --- a/core/dbt/config/project.py +++ b/core/dbt/config/project.py @@ -327,8 +327,8 @@ def create_project(self, rendered: RenderComponents) -> 'Project': source_paths: List[str] = value_or(cfg.source_paths, ['models']) macro_paths: List[str] = value_or(cfg.macro_paths, ['macros']) data_paths: List[str] = value_or(cfg.data_paths, ['data']) - test_paths: List[str] = value_or(cfg.test_paths, ['test']) - analysis_paths: List[str] = value_or(cfg.analysis_paths, []) + test_paths: List[str] = value_or(cfg.test_paths, ['tests']) + analysis_paths: List[str] = value_or(cfg.analysis_paths, ['analyses']) snapshot_paths: List[str] = value_or(cfg.snapshot_paths, ['snapshots']) all_source_paths: List[str] = _all_source_paths( diff --git a/core/dbt/include/starter_project/analysis/.gitkeep b/core/dbt/include/starter_project/analyses/.gitkeep similarity index 100% rename from core/dbt/include/starter_project/analysis/.gitkeep rename to core/dbt/include/starter_project/analyses/.gitkeep diff --git a/core/dbt/include/starter_project/dbt_project.yml b/core/dbt/include/starter_project/dbt_project.yml index 08866dc7748..1daa61b3460 100644 --- a/core/dbt/include/starter_project/dbt_project.yml +++ b/core/dbt/include/starter_project/dbt_project.yml @@ -13,7 +13,7 @@ profile: 'default' # The `source-paths` config, for example, states that models in this project can be # found in the "models/" directory. You probably won't need to change these! source-paths: ["models"] -analysis-paths: ["analysis"] +analysis-paths: ["analyses"] test-paths: ["tests"] data-paths: ["data"] macro-paths: ["macros"] diff --git a/performance/projects/01_2000_simple_models/dbt_project.yml b/performance/projects/01_2000_simple_models/dbt_project.yml index 2a10258c16a..bb83ed9845c 100644 --- a/performance/projects/01_2000_simple_models/dbt_project.yml +++ b/performance/projects/01_2000_simple_models/dbt_project.yml @@ -14,7 +14,7 @@ profile: 'default' # The `source-paths` config, for example, states that source models can be found # in the "models/" directory. You probably won't need to change these! source-paths: ["models"] -analysis-paths: ["analysis"] +analysis-paths: ["analyses"] test-paths: ["tests"] data-paths: ["data"] macro-paths: ["macros"] diff --git a/test/integration/006_simple_dependency_test/local_dependency/dbt_project.yml b/test/integration/006_simple_dependency_test/local_dependency/dbt_project.yml index a29ebecae7d..bbd1886db76 100644 --- a/test/integration/006_simple_dependency_test/local_dependency/dbt_project.yml +++ b/test/integration/006_simple_dependency_test/local_dependency/dbt_project.yml @@ -6,7 +6,7 @@ config-version: 2 profile: 'default' source-paths: ["models"] -analysis-paths: ["analysis"] +analysis-paths: ["analyses"] test-paths: ["tests"] data-paths: ["data"] macro-paths: ["macros"] diff --git a/test/integration/013_context_var_tests/first_dependency/dbt_project.yml b/test/integration/013_context_var_tests/first_dependency/dbt_project.yml index 31100eae190..d42b775b67d 100644 --- a/test/integration/013_context_var_tests/first_dependency/dbt_project.yml +++ b/test/integration/013_context_var_tests/first_dependency/dbt_project.yml @@ -6,7 +6,7 @@ config-version: 2 profile: 'default' source-paths: ["models"] -analysis-paths: ["analysis"] +analysis-paths: ["analyses"] test-paths: ["tests"] data-paths: ["data"] macro-paths: ["macros"] diff --git a/test/integration/019_analysis_tests/analysis/analysis.sql b/test/integration/019_analysis_tests/analyses/my_analysis.sql similarity index 100% rename from test/integration/019_analysis_tests/analysis/analysis.sql rename to test/integration/019_analysis_tests/analyses/my_analysis.sql diff --git a/test/integration/019_analysis_tests/analysis/raw_stuff.sql b/test/integration/019_analysis_tests/analyses/raw_stuff.sql similarity index 100% rename from test/integration/019_analysis_tests/analysis/raw_stuff.sql rename to test/integration/019_analysis_tests/analyses/raw_stuff.sql diff --git a/test/integration/019_analysis_tests/analysis/schema.yml b/test/integration/019_analysis_tests/analyses/schema.yml similarity index 73% rename from test/integration/019_analysis_tests/analysis/schema.yml rename to test/integration/019_analysis_tests/analyses/schema.yml index 10005c2ff5e..72525c5879b 100644 --- a/test/integration/019_analysis_tests/analysis/schema.yml +++ b/test/integration/019_analysis_tests/analyses/schema.yml @@ -1,5 +1,5 @@ version: 2 analyses: - - name: analysis + - name: my_analysis description: "This is my analysis" diff --git a/test/integration/019_analysis_tests/test_analyses.py b/test/integration/019_analysis_tests/test_analyses.py index edcb673990a..8af2267b0d9 100644 --- a/test/integration/019_analysis_tests/test_analyses.py +++ b/test/integration/019_analysis_tests/test_analyses.py @@ -13,7 +13,7 @@ def models(self): return "models" def analysis_path(self): - return "analysis" + return "analyses" @property def project_config(self): @@ -28,8 +28,8 @@ def assert_contents_equal(self, path, expected): @use_profile('postgres') def test_postgres_analyses(self): - compiled_analysis_path = os.path.normpath('target/compiled/test/analysis') - path_1 = os.path.join(compiled_analysis_path, 'analysis.sql') + compiled_analysis_path = os.path.normpath('target/compiled/test/analyses') + path_1 = os.path.join(compiled_analysis_path, 'my_analysis.sql') path_2 = os.path.join(compiled_analysis_path, 'raw_stuff.sql') self.run_dbt(['clean']) @@ -37,7 +37,7 @@ def test_postgres_analyses(self): results = self.run_dbt(["compile"]) self.assertEqual(len(results), 3) manifest = get_manifest() - analysis_id = 'analysis.test.analysis' + analysis_id = 'analysis.test.my_analysis' self.assertIn(analysis_id, manifest.nodes) node = manifest.nodes[analysis_id] self.assertEqual(node.description, 'This is my analysis') diff --git a/test/integration/068_partial_parsing_tests/analysis/.gitignore b/test/integration/068_partial_parsing_tests/analyses/.gitignore similarity index 100% rename from test/integration/068_partial_parsing_tests/analysis/.gitignore rename to test/integration/068_partial_parsing_tests/analyses/.gitignore diff --git a/test/integration/068_partial_parsing_tests/local_dependency/dbt_project.yml b/test/integration/068_partial_parsing_tests/local_dependency/dbt_project.yml index a29ebecae7d..bbd1886db76 100644 --- a/test/integration/068_partial_parsing_tests/local_dependency/dbt_project.yml +++ b/test/integration/068_partial_parsing_tests/local_dependency/dbt_project.yml @@ -6,7 +6,7 @@ config-version: 2 profile: 'default' source-paths: ["models"] -analysis-paths: ["analysis"] +analysis-paths: ["analyses"] test-paths: ["tests"] data-paths: ["data"] macro-paths: ["macros"] diff --git a/test/integration/068_partial_parsing_tests/test_partial_parsing.py b/test/integration/068_partial_parsing_tests/test_partial_parsing.py index 4c4e3da506c..40187654be5 100644 --- a/test/integration/068_partial_parsing_tests/test_partial_parsing.py +++ b/test/integration/068_partial_parsing_tests/test_partial_parsing.py @@ -224,7 +224,7 @@ def project_config(self): 'data-paths': ['seed'], 'test-paths': ['tests'], 'macro-paths': ['macros-b'], - 'analysis-paths': ['analysis'], + 'analysis-paths': ['analyses'], 'seeds': { 'quote_columns': False, }, @@ -248,8 +248,8 @@ def tearDown(self): os.remove(normalize('target/partial_parse.msgpack')) if os.path.exists(normalize('tests/my_test.sql')): os.remove(normalize('tests/my_test.sql')) - if os.path.exists(normalize('analysis/my_analysis.sql')): - os.remove(normalize('analysis/my_analysis.sql')) + if os.path.exists(normalize('analyses/my_analysis.sql')): + os.remove(normalize('analyses/my_analysis.sql')) if os.path.exists(normalize('macros-b/tests.sql')): os.remove(normalize('macros-b/tests.sql')) @@ -345,7 +345,7 @@ def test_postgres_pp_sources(self): self.assertIn(test_id, manifest.nodes) # Add an analysis - shutil.copyfile('extra-files/my_analysis.sql', 'analysis/my_analysis.sql') + shutil.copyfile('extra-files/my_analysis.sql', 'analyses/my_analysis.sql') results = self.run_dbt(["--partial-parse", "run"]) manifest = get_manifest() @@ -356,7 +356,7 @@ def test_postgres_pp_sources(self): self.assertEqual(len(manifest.nodes), 9) # Remove analysis - os.remove(normalize('analysis/my_analysis.sql')) + os.remove(normalize('analyses/my_analysis.sql')) results = self.run_dbt(["--partial-parse", "run"]) manifest = get_manifest() self.assertEqual(len(manifest.nodes), 8) diff --git a/test/unit/test_config.py b/test/unit/test_config.py index 07c809e5190..177ac08582f 100644 --- a/test/unit/test_config.py +++ b/test/unit/test_config.py @@ -589,9 +589,9 @@ def test_defaults(self): self.assertEqual(project.source_paths, ['models']) self.assertEqual(project.macro_paths, ['macros']) self.assertEqual(project.data_paths, ['data']) - self.assertEqual(project.test_paths, ['test']) - self.assertEqual(project.analysis_paths, []) - self.assertEqual(project.docs_paths, ['models', 'data', 'snapshots', 'macros']) + self.assertEqual(project.test_paths, ['tests']) + self.assertEqual(project.analysis_paths, ['analyses']) + self.assertEqual(project.docs_paths, ['models', 'data', 'snapshots', 'analyses', 'macros']) self.assertEqual(project.asset_paths, []) self.assertEqual(project.target_path, 'target') self.assertEqual(project.clean_targets, ['target']) @@ -624,7 +624,7 @@ def test_implicit_overrides(self): 'target-path': 'other-target', }) project = project_from_config_norender(self.default_project_data) - self.assertEqual(project.docs_paths, ['other-models', 'data', 'snapshots', 'macros']) + self.assertEqual(project.docs_paths, ['other-models', 'data', 'snapshots', 'analyses', 'macros']) self.assertEqual(project.clean_targets, ['other-target']) def test_hashed_name(self): @@ -636,8 +636,8 @@ def test_all_overrides(self): 'source-paths': ['other-models'], 'macro-paths': ['other-macros'], 'data-paths': ['other-data'], - 'test-paths': ['other-test'], - 'analysis-paths': ['analysis'], + 'test-paths': ['other-tests'], + 'analysis-paths': ['other-analyses'], 'docs-paths': ['docs'], 'asset-paths': ['other-assets'], 'target-path': 'other-target', @@ -706,8 +706,8 @@ def test_all_overrides(self): self.assertEqual(project.source_paths, ['other-models']) self.assertEqual(project.macro_paths, ['other-macros']) self.assertEqual(project.data_paths, ['other-data']) - self.assertEqual(project.test_paths, ['other-test']) - self.assertEqual(project.analysis_paths, ['analysis']) + self.assertEqual(project.test_paths, ['other-tests']) + self.assertEqual(project.analysis_paths, ['other-analyses']) self.assertEqual(project.docs_paths, ['docs']) self.assertEqual(project.asset_paths, ['other-assets']) self.assertEqual(project.target_path, 'other-target') @@ -1201,9 +1201,9 @@ def test_from_args(self): self.assertEqual(config.source_paths, ['models']) self.assertEqual(config.macro_paths, ['macros']) self.assertEqual(config.data_paths, ['data']) - self.assertEqual(config.test_paths, ['test']) - self.assertEqual(config.analysis_paths, []) - self.assertEqual(config.docs_paths, ['models', 'data', 'snapshots', 'macros']) + self.assertEqual(config.test_paths, ['tests']) + self.assertEqual(config.analysis_paths, ['analyses']) + self.assertEqual(config.docs_paths, ['models', 'data', 'snapshots', 'analyses', 'macros']) self.assertEqual(config.asset_paths, []) self.assertEqual(config.target_path, 'target') self.assertEqual(config.clean_targets, ['target'])