diff --git a/piperider_cli/dbt/list_task.py b/piperider_cli/dbt/list_task.py index 0f39aa622..f7e75dd1c 100644 --- a/piperider_cli/dbt/list_task.py +++ b/piperider_cli/dbt/list_task.py @@ -157,7 +157,7 @@ def truncate_relation(self, relation: BaseRelation) -> None: pass def rename_relation( - self, from_relation: BaseRelation, to_relation: BaseRelation + self, from_relation: BaseRelation, to_relation: BaseRelation ) -> None: pass @@ -168,7 +168,7 @@ def expand_column_types(self, goal: BaseRelation, current: BaseRelation) -> None pass def list_relations_without_caching( - self, schema_relation: BaseRelation + self, schema_relation: BaseRelation ) -> List[BaseRelation]: pass @@ -348,15 +348,18 @@ def __init__(self): "project_env_vars": {}, "cli_vars": {}, "dependencies": None, - "dbt_cloud": None, } - found_restrict_access = any(field.name == 'restrict_access' for field in fields(RuntimeConfig)) - found_packages_specified_path = any(field.name == 'packages_specified_path' for field in fields(RuntimeConfig)) - if found_restrict_access: + def has_field(field_name): + return field_name in {f.name for f in fields(RuntimeConfig)} + + if has_field('dbt_cloud'): + data['dbt_cloud'] = None + + if has_field('restrict_access'): data['restrict_access'] = False - if found_packages_specified_path: + if has_field('packages_specified_path'): data['packages_specified_path'] = "packages.yml" super().__init__(args=None, **data) @@ -474,9 +477,9 @@ def list_resources_data_from_manifest(manifest: Manifest, select: tuple = None, def compare_models_between_manifests( - base_manifest: Manifest, - altered_manifest: Manifest, - include_downstream: bool = False, + base_manifest: Manifest, + altered_manifest: Manifest, + include_downstream: bool = False, ): task = _DbtListTask() task.manifest = altered_manifest @@ -517,8 +520,8 @@ def compare_models_between_manifests( def list_modified_with_downstream( - base_manifest: Manifest, - altered_manifest: Manifest, + base_manifest: Manifest, + altered_manifest: Manifest, ): task = _DbtListTask() task.manifest = altered_manifest @@ -556,8 +559,8 @@ def list_modified_with_downstream( def list_changes_in_unique_id( - base_manifest: Manifest, - target_manifest: Manifest, show_modified_only=False) -> List[Dict[str, str]]: + base_manifest: Manifest, + target_manifest: Manifest, show_modified_only=False) -> List[Dict[str, str]]: task = _DbtListTask() task.manifest = target_manifest