diff --git a/CHANGELOG.md b/CHANGELOG.md index 0297c0d0aa9c3..d0a0bff01560a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ * dbt: column descriptions are properly filled from metadata.json [@mobuchowski](https://github.com/mobuchowski) * dbt: allow parsing artifacts with version higher than officially supported [@mobuchowski](https://github.com/mobuchowski) * dbt: dbt build command is supported [@mobuchowski](https://github.com/mobuchowski) - +* dbt: fix crash when build command is used with seeds in dbt 1.0.0rc3 [@mobuchowski](https://github.com/mobuchowski) ## [0.3.1](https://github.com/OpenLineage/OpenLineage/releases/tag/0.3.1) - 2021-10-21 diff --git a/integration/common/openlineage/common/provider/dbt.py b/integration/common/openlineage/common/provider/dbt.py index c4e50b60383c4..602138879a907 100644 --- a/integration/common/openlineage/common/provider/dbt.py +++ b/integration/common/openlineage/common/provider/dbt.py @@ -167,8 +167,8 @@ def parse(self) -> DbtEvents: """ Parse dbt manifest and run_result and produce OpenLineage events. """ - manifest = self.load_metadata(self.manifest_path, [2, 3], self.logger) - run_result = self.load_metadata(self.run_result_path, [2, 3], self.logger) + manifest = self.load_metadata(self.manifest_path, [2, 3, 4], self.logger) + run_result = self.load_metadata(self.run_result_path, [2, 3, 4], self.logger) self.run_metadata = run_result['metadata'] self.command = run_result['args']['which'] @@ -418,9 +418,9 @@ def parse_assertions( ) -> Dict[str, List[Assertion]]: assertions = collections.defaultdict(list) for run in context.run_results['results']: - test_node = nodes[run['unique_id']] if not run['unique_id'].startswith('test.'): continue + test_node = nodes[run['unique_id']] model_node = None for node in context.manifest['parent_map'][run['unique_id']]: diff --git a/integration/common/tests/dbt/test_dbt.py b/integration/common/tests/dbt/test_dbt.py index 9415499ab6a1f..97514429dc8c7 100644 --- a/integration/common/tests/dbt/test_dbt.py +++ b/integration/common/tests/dbt/test_dbt.py @@ -6,7 +6,7 @@ import attr import pytest -from openlineage.common.provider.dbt import DbtArtifactProcessor, ParentRunMetadata +from openlineage.common.provider.dbt import DbtArtifactProcessor, ParentRunMetadata, DbtRunContext from openlineage.client import set_producer from openlineage.common.test import match @@ -211,3 +211,15 @@ def test_logging_handler_does_not_warn(): DbtArtifactProcessor.load_metadata(path, [2], logger) logger.warning.assert_not_called() + + +def test_seed_snapshot_nodes_do_not_throw(): + processor = DbtArtifactProcessor( + producer='https://github.com/OpenLineage/OpenLineage/tree/0.0.1/integration/dbt', + project_dir='tests/dbt/test', + ) + + # Should just skip processing + processor.parse_assertions( + DbtRunContext({}, {"results": [{"unique_id": "seed.jaffle_shop.raw_orders"}]}), {} + )