catalog_data_source.
load_and_put_declarative_data_sources
load_and_put_declarative_data_sources(layout_root_path: Optional[Path], credentials_path: Optional[Path], config_file: Optional[Union[str, Path]], test_data_sources: bool)
Loads and sets layouts stored using `store_declarative_data_sources`.
This method combines `load_declarative_data_sources` and `put_declarative_data_sources` methods to load and set layouts stored using `store_declarative_data_sources`.
Parameters
| name | type | description |
|---|---|---|
| layout_root_path | Optional[Path] | Path to the root of the layout directory. Defaults to Path.cwd(). |
| credentials_path | Optional[Path] | Path to the credentials. |
| config_file | Optional[Union[str, Path]] | Path to the config file. |
| test_data_sources | bool | If True, the connection of data sources is tested. Defaults to False. |
Returns
NoneExample
The load and put can be done two ways.
Either by one call:
# Load and put declarative data sources
sdk.catalog_data_source.load_and_put_declarative_data_sources(
layout_root_path=Path("abc"),
credentials_path=Path("credentials")
)Or by two separate calls:
# Load the data source
data_sources = sdk.catalog_data_source.get_declarative_data_sources()
# Put the data source
sdk.catalog_data_source.put_declarative_data_sources(
declarative_data_sources=data_sources
layout_root_path=Path("abc"),
credentials_path=Path("credentials")
)Example of the credential file:
data_sources:
demo-test-ds: "demopass"
demo-bigquery-ds: "~/home/secrets.json"
demo-snowflake-password-ds: "snowflakepass"
demo-snowflake-key-pair-ds:
private_key: |
-----BEGIN PRIVATE KEY-----
... (private key content)
-----END PRIVATE KEY-----
private_key_passphrase: "passphrase" # OptionalThe result is identical.