foundry_dev_tools.helpers.fast_snowflake_ingestion.utils module#
Helpers to resolve Foundry job information inside a lightweight transform runtime.
- foundry_dev_tools.helpers.fast_snowflake_ingestion.utils.filter_kwargs_for_function(func, kwargs_dict)[source]#
Filter kwargs to only include parameters that the function accepts.
- class foundry_dev_tools.helpers.fast_snowflake_ingestion.utils.TransactionPath[source]#
Bases:
objectPath to a dataset transaction, usable without importing Foundry internal classes.
- class foundry_dev_tools.helpers.fast_snowflake_ingestion.utils.ViewPath[source]#
Bases:
objectPath to a dataset view, usable without importing Foundry internal classes.
- class foundry_dev_tools.helpers.fast_snowflake_ingestion.utils.FoundryPathWithBranchId[source]#
Bases:
objectA
FoundryPathtogether with a branch id.- __init__(foundry_path, branch_id)[source]#
- Parameters:
foundry_path (TransactionPath | ViewPath)
branch_id (str | None)
- property foundry_path: TransactionPath | ViewPath#
The foundry path.
- foundry_dev_tools.helpers.fast_snowflake_ingestion.utils.load_job_config()[source]#
Load job configuration from the Foundry transforms runtime.
Only available inside a Foundry lightweight transform.
- Raises:
ModuleNotFoundError – if the Foundry transforms runtime is not available
- Return type:
- foundry_dev_tools.helpers.fast_snowflake_ingestion.utils.resolve_output_alias_flattened(alias)[source]#
Resolve output alias and return the core components directly.
- foundry_dev_tools.helpers.fast_snowflake_ingestion.utils.get_output_foundry_path_components(output)[source]#
Extract core components from an Output object.
- Parameters:
output (Output) – The Output object to extract components from.
- Returns:
- A tuple containing:
dataset_rid: The dataset RID
transaction_rid: The transaction RID
branch_id: The branch ID (can be None)
foundry_path_str: String representation of the foundry path
- Return type:
- foundry_dev_tools.helpers.fast_snowflake_ingestion.utils.prepare_job_info(out, **kwargs)[source]#
Build a job information dictionary from the current job config and an Output.
- Parameters:
out (Output) – The primary Output object for which to collect job information.
**kwargs – Additional key-value pairs to merge into the result. Keys that already exist from the job configuration are not overwritten; a warning is logged and the original values are kept.
- Returns:
- A dictionary containing:
output_dataset_rid: RID of the output dataset
output_transaction_rid: RID of the output transaction
branch: name of the branch the code originates from
job_rid: RID of the Foundry job
sourceProvenance_details_code: Raw sourceProvenance.details.code block
inputs: Mapping of input names to dataset RIDs
outputs: Mapping of output names to dataset RIDs
any additional non-conflicting kwargs
- Return type:
Example
>>> result = { ... "output_dataset_rid": "ri.foundry.main.dataset.00000-00005", ... "output_transaction_rid": "ri.foundry.main.transaction.00000-00123", ... "branch": "master", ... "job_rid": "ri.foundry.main.job.00000-00010", ... "sourceProvenance_details_code": { ... "repositoryRid": "ri.stemma.main.repository.00000-00000", ... "versionId": "84e49aff909709b121250a682193328020f37435", ... "file": "transforms-python/src/myproject/hello_world.py", ... "lineNumber": 2137, ... }, ... "inputs": { ... "input_1": "ri.foundry.main.dataset.00000-00001", ... "virtual_table_1": "ri.tables.main.table.00000-00002", ... "input_2": "ri.foundry.main.dataset.00000-00004", ... }, ... "outputs": { ... "out": "ri.foundry.main.dataset.00000-00005", ... }, ... **kwargs ... }