-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add dbt 1.9 support #46
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,7 +61,7 @@ def _get_node(self, node: ManifestNode) -> AltimateManifestNode: | |
| language, | ||
| contract, | ||
| ) = ([], [], None, None, None, None, None, "", "", None) | ||
| if node.resource_type.value != SEED: | ||
| if node.resource_type != SEED: | ||
| sources = node.sources | ||
| metrics = node.metrics | ||
| depends_on_nodes = node.depends_on.nodes if node.depends_on else None | ||
|
|
@@ -77,7 +77,7 @@ def _get_node(self, node: ManifestNode) -> AltimateManifestNode: | |
| database=node.database, | ||
| schema_name=node.schema_, | ||
| name=node.name, | ||
| resource_type=AltimateResourceType(node.resource_type.value), | ||
| resource_type=AltimateResourceType(node.resource_type), | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this right?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How is it mapping between the enums. Please check
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. node.resource_type is a string now. It is right. I had to do a similar change when we had upgraded to a new version of dbt-artifacts-parser in the past as well, but only for the newest manifest version. Seems like they introduced the same thing for the older manifest versions this time. |
||
| package_name=node.package_name, | ||
| path=node.path, | ||
| description=node.description, | ||
|
|
@@ -116,12 +116,13 @@ def _get_node(self, node: ManifestNode) -> AltimateManifestNode: | |
| contract=contract, | ||
| meta=node.meta, | ||
| patch_path=node.patch_path, | ||
| access=node.access.value, | ||
| ) | ||
|
|
||
| def _get_source(self, source: SourceNode) -> AltimateManifestSourceNode: | ||
| return AltimateManifestSourceNode( | ||
| database=source.database, | ||
| resource_type=AltimateResourceType(source.resource_type.value), | ||
| resource_type=AltimateResourceType(source.resource_type), | ||
| schema_name=source.schema_, | ||
| name=source.name, | ||
| package_name=source.package_name, | ||
|
|
@@ -162,7 +163,7 @@ def _get_source(self, source: SourceNode) -> AltimateManifestSourceNode: | |
| def _get_macro(self, macro: MacroNode) -> AltimateManifestMacroNode: | ||
| return AltimateManifestMacroNode( | ||
| name=macro.name, | ||
| resource_type=AltimateResourceType(macro.resource_type.value), | ||
| resource_type=AltimateResourceType(macro.resource_type), | ||
| package_name=macro.package_name, | ||
| path=macro.path, | ||
| original_file_path=macro.original_file_path, | ||
|
|
@@ -177,7 +178,7 @@ def _get_macro(self, macro: MacroNode) -> AltimateManifestMacroNode: | |
| ), | ||
| description=macro.description, | ||
| meta=macro.meta, | ||
| docs=macro.docs, | ||
| docs=macro.docs.dict() if macro.docs else None, | ||
| patch_path=macro.patch_path, | ||
| arguments=[AltimateMacroArgument(**arg.dict()) for arg in macro.arguments] if macro.arguments else None, | ||
| created_at=macro.created_at, | ||
|
|
@@ -187,7 +188,7 @@ def _get_macro(self, macro: MacroNode) -> AltimateManifestMacroNode: | |
| def _get_exposure(self, exposure: ExposureNode) -> AltimateManifestExposureNode: | ||
| return AltimateManifestExposureNode( | ||
| name=exposure.name, | ||
| resource_type=AltimateResourceType(exposure.resource_type.value), | ||
| resource_type=AltimateResourceType(exposure.resource_type), | ||
| package_name=exposure.package_name, | ||
| path=exposure.path, | ||
| original_file_path=exposure.original_file_path, | ||
|
|
@@ -203,12 +204,14 @@ def _get_exposure(self, exposure: ExposureNode) -> AltimateManifestExposureNode: | |
| config=AltimateSourceConfig(**exposure.config.dict()) if exposure.config else None, | ||
| unrendered_config=exposure.unrendered_config, | ||
| url=exposure.url, | ||
| depends_on=AltimateDependsOn( | ||
| nodes=exposure.depends_on.nodes, | ||
| macros=exposure.depends_on.macros, | ||
| ) | ||
| if exposure.depends_on | ||
| else None, | ||
| depends_on=( | ||
| AltimateDependsOn( | ||
| nodes=exposure.depends_on.nodes, | ||
| macros=exposure.depends_on.macros, | ||
| ) | ||
| if exposure.depends_on | ||
| else None | ||
| ), | ||
| refs=[AltimateRefArgs(**ref.dict()) for ref in exposure.refs] if exposure.refs else None, | ||
| sources=exposure.sources, | ||
| metrics=exposure.metrics, | ||
|
|
@@ -228,35 +231,39 @@ def _get_tests(self, test: TestNode) -> AltimateManifestTestNode: | |
| test_metadata=test_metadata, | ||
| test_type=test_type, | ||
| name=test.name, | ||
| resource_type=AltimateResourceType(test.resource_type.value), | ||
| resource_type=AltimateResourceType(test.resource_type), | ||
| package_name=test.package_name, | ||
| path=test.path, | ||
| original_file_path=test.original_file_path, | ||
| unique_id=test.unique_id, | ||
| fqn=test.fqn, | ||
| alias=test.alias, | ||
| checksum=AltimateFileHash( | ||
| name=test.checksum.name, | ||
| checksum=test.checksum.checksum, | ||
| ) | ||
| if test.checksum | ||
| else None, | ||
| checksum=( | ||
| AltimateFileHash( | ||
| name=test.checksum.name, | ||
| checksum=test.checksum.checksum, | ||
| ) | ||
| if test.checksum | ||
| else None | ||
| ), | ||
| config=AltimateTestConfig(**test.config.dict()) if test.config else None, | ||
| description=test.description, | ||
| tags=test.tags, | ||
| columns={ | ||
| name: AltimateManifestColumnInfo( | ||
| name=column.name, | ||
| description=column.description, | ||
| meta=column.meta, | ||
| data_type=column.data_type, | ||
| quote=column.quote, | ||
| tags=column.tags, | ||
| ) | ||
| for name, column in test.columns.items() | ||
| } | ||
| if test.columns | ||
| else None, | ||
| columns=( | ||
| { | ||
| name: AltimateManifestColumnInfo( | ||
| name=column.name, | ||
| description=column.description, | ||
| meta=column.meta, | ||
| data_type=column.data_type, | ||
| quote=column.quote, | ||
| tags=column.tags, | ||
| ) | ||
| for name, column in test.columns.items() | ||
| } | ||
| if test.columns | ||
| else None | ||
| ), | ||
| meta=test.meta, | ||
| relation_name=test.relation_name, | ||
| group=test.group, | ||
|
|
@@ -265,12 +272,14 @@ def _get_tests(self, test: TestNode) -> AltimateManifestTestNode: | |
| refs=[AltimateRefArgs(**ref.dict()) for ref in test.refs] if test.refs else None, | ||
| sources=test.sources, | ||
| metrics=test.metrics, | ||
| depends_on=AltimateDependsOn( | ||
| nodes=test.depends_on.nodes, | ||
| macros=test.depends_on.macros, | ||
| ) | ||
| if test.depends_on | ||
| else None, | ||
| depends_on=( | ||
| AltimateDependsOn( | ||
| nodes=test.depends_on.nodes, | ||
| macros=test.depends_on.macros, | ||
| ) | ||
| if test.depends_on | ||
| else None | ||
| ), | ||
| compiled_path=test.compiled_path, | ||
| compiled=test.compiled, | ||
| compiled_code=test.compiled_code, | ||
|
|
@@ -281,35 +290,39 @@ def _get_seed(self, seed: SeedNodeMap) -> AltimateSeedNode: | |
| database=seed.database, | ||
| schema_name=seed.schema_, | ||
| name=seed.name, | ||
| resource_type=AltimateResourceType(seed.resource_type.value), | ||
| resource_type=AltimateResourceType(seed.resource_type), | ||
| package_name=seed.package_name, | ||
| path=seed.path, | ||
| original_file_path=seed.original_file_path, | ||
| unique_id=seed.unique_id, | ||
| fqn=seed.fqn, | ||
| alias=seed.alias, | ||
| checksum=AltimateFileHash( | ||
| name=seed.checksum.name, | ||
| checksum=seed.checksum.checksum, | ||
| ) | ||
| if seed.checksum | ||
| else None, | ||
| checksum=( | ||
| AltimateFileHash( | ||
| name=seed.checksum.name, | ||
| checksum=seed.checksum.checksum, | ||
| ) | ||
| if seed.checksum | ||
| else None | ||
| ), | ||
| config=AltimateSeedConfig(**seed.config.dict()) if seed.config else None, | ||
| description=seed.description, | ||
| tags=seed.tags, | ||
| columns={ | ||
| name: AltimateManifestColumnInfo( | ||
| name=column.name, | ||
| description=column.description, | ||
| meta=column.meta, | ||
| data_type=column.data_type, | ||
| quote=column.quote, | ||
| tags=column.tags, | ||
| ) | ||
| for name, column in seed.columns.items() | ||
| } | ||
| if seed.columns | ||
| else None, | ||
| columns=( | ||
| { | ||
| name: AltimateManifestColumnInfo( | ||
| name=column.name, | ||
| description=column.description, | ||
| meta=column.meta, | ||
| data_type=column.data_type, | ||
| quote=column.quote, | ||
| tags=column.tags, | ||
| ) | ||
| for name, column in seed.columns.items() | ||
| } | ||
| if seed.columns | ||
| else None | ||
| ), | ||
| meta=seed.meta, | ||
| group=seed.group, | ||
| docs=seed.docs.dict() if seed.docs else None, | ||
|
|
@@ -327,7 +340,7 @@ def get_nodes( | |
| nodes = {} | ||
| for node in self.manifest.nodes.values(): | ||
| if ( | ||
| node.resource_type.value | ||
| node.resource_type | ||
| in [ | ||
| AltimateResourceType.seed.value, | ||
| AltimateResourceType.test.value, | ||
|
|
@@ -350,7 +363,7 @@ def get_sources(self) -> Dict[str, AltimateManifestSourceNode]: | |
| def get_macros(self) -> Dict[str, AltimateManifestMacroNode]: | ||
| macros = {} | ||
| for macro in self.manifest.macros.values(): | ||
| if macro.resource_type.value == AltimateResourceType.macro.value and macro.package_name == self.get_package(): | ||
| if macro.resource_type == AltimateResourceType.macro.value and macro.package_name == self.get_package(): | ||
| macros[macro.unique_id] = self._get_macro(macro) | ||
| return macros | ||
|
|
||
|
|
@@ -371,15 +384,15 @@ def get_tests(self, type=None) -> Dict[str, AltimateManifestTestNode]: | |
|
|
||
| for node in self.manifest.nodes.values(): | ||
| # Check if the node is a test and of the correct type | ||
| if node.resource_type.value == AltimateResourceType.test.value: | ||
| if node.resource_type == AltimateResourceType.test.value: | ||
| if any(isinstance(node, t) for t in types): | ||
| tests[node.unique_id] = self._get_tests(node) | ||
| return tests | ||
|
|
||
| def get_seeds(self) -> Dict[str, AltimateSeedNode]: | ||
| seeds = {} | ||
| for seed in self.manifest.nodes.values(): | ||
| if seed.resource_type.value == AltimateResourceType.seed.value: | ||
| if seed.resource_type == AltimateResourceType.seed.value: | ||
| seeds[seed.unique_id] = self._get_seed(seed) | ||
| return seeds | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is in v1.7? Is this because of artifact parser update?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's because of that