Skip to content

Transform

transform

transform_package(package, **kwargs)

Transform and export all resources in a datapackage.

datapackage

get_output_settings(resource)

Extract output settings from the resource custom metadata.

write_files(package, resource, table, path, format, extension, encoding, delimiter, **kwargs)

Export a PETL table to the configured output format.

update_metadata(resource, path, format, compression, extension, delimiter, cli, **kwargs)

Update resource metadata after transformation to match the generated output file.

build_datapackage(package)

Build and save the updated datapackage descriptor as JSON.

anonymize

apply_anonymization(field, table, secret_key)

Apply anonymization transforms for fields that declare an anonymize property.

build_constraints(field)

Build schema constraints describing the shape of an anonymized field's output.

command

flatten_custom(block)

Merge a custom block into one dict. Accepts a mapping or a list of one-key maps; anything else is empty.

build_child_env(resource)

Copy os.environ and JSON-encode each flattened custom key as an env var. Returns nothing when custom is missing or empty, so the child inherits the parent environment unchanged.

build_stdin_data(table, stdin, encoding, delimiter, **kwargs)

Serialize a PETL table to CSV bytes, to pipe into CLI commands via stdin. Returns nothing when stdin mode is off or there is no table to serialize.

check_cli_commands(resource, table, stdin, encoding, delimiter, **kwargs)

Execute the command line commands defined for the resource, piping the transformed table into each one's stdin when configured.

run_cli_command(command, resource, data, **kwargs)

Execute a single command, logging the error without stopping the others.