diff --git a/core/dbt/compilation.py b/core/dbt/compilation.py index 3383f90299f..01b3b3fc46f 100644 --- a/core/dbt/compilation.py +++ b/core/dbt/compilation.py @@ -263,5 +263,6 @@ def compile_node(adapter, config, node, manifest, extra_context, write=True): 'compiled', node.injected_sql ) + # import ipdb; ipdb.set_trace() return node diff --git a/core/dbt/config/project.py b/core/dbt/config/project.py index 7bf61bcc1c8..25b0c418300 100644 --- a/core/dbt/config/project.py +++ b/core/dbt/config/project.py @@ -295,6 +295,7 @@ class Project: test_paths: List[str] analysis_paths: List[str] docs_paths: List[str] + asset_paths: List[str] target_path: str snapshot_paths: List[str] clean_targets: List[str] @@ -401,6 +402,7 @@ def from_project_config( ) docs_paths: List[str] = value_or(cfg.docs_paths, all_source_paths) + asset_paths: List[str] = value_or(cfg.asset_paths, ['static']) target_path: str = value_or(cfg.target_path, 'target') clean_targets: List[str] = value_or(cfg.clean_targets, [target_path]) log_path: str = value_or(cfg.log_path, 'logs') @@ -475,6 +477,7 @@ def from_project_config( test_paths=test_paths, analysis_paths=analysis_paths, docs_paths=docs_paths, + asset_paths=asset_paths, target_path=target_path, snapshot_paths=snapshot_paths, clean_targets=clean_targets, @@ -527,6 +530,7 @@ def to_project_config(self, with_packages=False): 'test-paths': self.test_paths, 'analysis-paths': self.analysis_paths, 'docs-paths': self.docs_paths, + 'asset-paths': self.asset_paths, 'target-path': self.target_path, 'snapshot-paths': self.snapshot_paths, 'clean-targets': self.clean_targets, diff --git a/core/dbt/config/runtime.py b/core/dbt/config/runtime.py index f90db86c998..09f02ad7b94 100644 --- a/core/dbt/config/runtime.py +++ b/core/dbt/config/runtime.py @@ -93,6 +93,7 @@ def from_parts( test_paths=project.test_paths, analysis_paths=project.analysis_paths, docs_paths=project.docs_paths, + asset_paths=project.asset_paths, target_path=project.target_path, snapshot_paths=project.snapshot_paths, clean_targets=project.clean_targets, @@ -488,6 +489,7 @@ def from_parts( test_paths=project.test_paths, analysis_paths=project.analysis_paths, docs_paths=project.docs_paths, + asset_paths=project.asset_paths, target_path=project.target_path, snapshot_paths=project.snapshot_paths, clean_targets=project.clean_targets, diff --git a/core/dbt/contracts/project.py b/core/dbt/contracts/project.py index b5a2a14f61e..e59828add8e 100644 --- a/core/dbt/contracts/project.py +++ b/core/dbt/contracts/project.py @@ -164,6 +164,7 @@ class ProjectV1(HyphenatedJsonSchemaMixin, Replaceable): test_paths: Optional[List[str]] = None analysis_paths: Optional[List[str]] = None docs_paths: Optional[List[str]] = None + asset_paths: Optional[List[str]] = None target_path: Optional[str] = None snapshot_paths: Optional[List[str]] = None clean_targets: Optional[List[str]] = None @@ -204,6 +205,7 @@ class ProjectV2(HyphenatedJsonSchemaMixin, Replaceable): test_paths: Optional[List[str]] = None analysis_paths: Optional[List[str]] = None docs_paths: Optional[List[str]] = None + asset_paths: Optional[List[str]] = None target_path: Optional[str] = None snapshot_paths: Optional[List[str]] = None clean_targets: Optional[List[str]] = None diff --git a/core/dbt/task/compile.py b/core/dbt/task/compile.py index 320d60d0651..7e4c44b9991 100644 --- a/core/dbt/task/compile.py +++ b/core/dbt/task/compile.py @@ -19,6 +19,7 @@ def after_execute(self, result): def execute(self, compiled_node, manifest): return RunModelResult(compiled_node) + # maybe def compile(self, manifest): return compile_node(self.adapter, self.config, self.node, manifest, {}) diff --git a/core/dbt/task/generate.py b/core/dbt/task/generate.py index f973323e264..b444ec6cb15 100644 --- a/core/dbt/task/generate.py +++ b/core/dbt/task/generate.py @@ -230,6 +230,16 @@ def run(self) -> CatalogResults: DOCS_INDEX_FILE_PATH, os.path.join(self.config.target_path, 'index.html')) + for asset_path in self.config.asset_paths: + to_asset_path=os.path.join(self.config.target_path, asset_path) + + if os.path.exists(to_asset_path): + shutil.rmtree(to_asset_path) + + shutil.copytree( + asset_path, + to_asset_path) + if self.manifest is None: raise InternalException( 'self.manifest was None in run!' diff --git a/test/unit/test_config.py b/test/unit/test_config.py index 11f8889e133..4eed9b63e71 100644 --- a/test/unit/test_config.py +++ b/test/unit/test_config.py @@ -580,6 +580,7 @@ def test_defaults(self): self.assertEqual(project.test_paths, ['test']) self.assertEqual(project.analysis_paths, []) self.assertEqual(project.docs_paths, ['models', 'data', 'snapshots', 'macros']) + self.assertEqual(project.asset_paths), ['static']) self.assertEqual(project.target_path, 'target') self.assertEqual(project.clean_targets, ['target']) self.assertEqual(project.log_path, 'logs') @@ -636,6 +637,7 @@ def test_all_overrides(self): 'test-paths': ['other-test'], 'analysis-paths': ['analysis'], 'docs-paths': ['docs'], + 'asset-paths': ['assets'], 'target-path': 'other-target', 'clean-targets': ['another-target'], 'log-path': 'other-logs', @@ -700,6 +702,7 @@ def test_all_overrides(self): self.assertEqual(project.test_paths, ['other-test']) self.assertEqual(project.analysis_paths, ['analysis']) self.assertEqual(project.docs_paths, ['docs']) + self.assertEqual(project.asset_paths, ['assets']) self.assertEqual(project.target_path, 'other-target') self.assertEqual(project.clean_targets, ['another-target']) self.assertEqual(project.log_path, 'other-logs') @@ -1186,6 +1189,7 @@ def test_from_args(self): self.assertEqual(config.test_paths, ['test']) self.assertEqual(config.analysis_paths, []) self.assertEqual(config.docs_paths, ['models', 'data', 'snapshots', 'macros']) + self.assertEqual(config.asset_paths, ['static']) self.assertEqual(config.target_path, 'target') self.assertEqual(config.clean_targets, ['target']) self.assertEqual(config.log_path, 'logs')