-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a86e2b4
commit 666cc3b
Showing
4 changed files
with
44 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from typing import Optional | ||
|
||
from dbt_config.external_config import ExternalCatalogConfig | ||
|
||
from dbt.clients.yaml_helper import load_yaml_text | ||
from dbt.constants import EXTERNAL_CATALOG_FILE_NAME | ||
from dbt_common.clients.system import load_file_contents, path_exists | ||
|
||
|
||
def _load_yaml(path): | ||
contents = load_file_contents(path) | ||
return load_yaml_text(contents) | ||
|
||
|
||
def _load_yml_dict(file_path): | ||
if path_exists(file_path): | ||
ret = _load_yaml(file_path) or {} | ||
return ret | ||
return None | ||
|
||
|
||
def load_external_catalog_config(project_root) -> Optional[ExternalCatalogConfig]: | ||
unparsed_config = _load_yml_dict(f"{project_root}/{EXTERNAL_CATALOG_FILE_NAME}") | ||
if unparsed_config is not None: | ||
return ExternalCatalogConfig.model_validate(unparsed_config) | ||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters