Skip to content

write_multiple_metadata_outputs

Public callable

Write multiple metadata payloads to their configured destinations.

Parameters:

Name Type Description Default
outputs Any

Value used by this callable.

required
table_mapping Any

Value used by this callable.

required
writer Any

Value used by this callable.

None
mode Any

Value used by this callable.

'append'

Returns:

Type Description
dict

Structured output produced by this callable.

Source code in src/fabricops_kit/metadata.py
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
def write_multiple_metadata_outputs(
    outputs: dict[str, list[dict]],
    table_mapping: dict[str, str],
    writer=None,
    mode: str = "append",
    **options,
) -> dict:
    """Write multiple metadata payloads to their configured destinations.

        Parameters
        ----------
        outputs : Any
            Value used by this callable.
        table_mapping : Any
            Value used by this callable.
        writer : Any
            Value used by this callable.
        mode : Any
            Value used by this callable.

        Returns
        -------
        dict
            Structured output produced by this callable.
    """
    results = {}
    for output_name, records in outputs.items():
        if not records:
            continue
        table_identifier = table_mapping.get(output_name)
        if not table_identifier:
            raise ValueError(f"Missing table mapping for metadata output '{output_name}'.")
        results[output_name] = write_metadata_records(
            records=records,
            table_identifier=table_identifier,
            writer=writer,
            mode=mode,
            **options,
        )
    return results