<@U04S8PLJWMT> How do I use extra fields to copy f...
# ask-ai
j
@kapa.ai How do I use extra fields to copy fields from a parent record in a partition router?
k
To use extra fields to copy fields from a parent record in a partition router in Airbyte, you need to configure the extra_fields property in the ParentStreamConfig of your partition router. This allows you to include additional fields from the parent record in each stream slice, making them accessible in the child stream. Here's how you can do it: 1. Configure extra_fields: In your ParentStreamConfig, set the extra_fields property to an array of field paths. Each path is itself an array of strings representing the keys to access the desired field in the parent record. Example configuration:
Copy code
yaml    parent_stream_configs:      - stream: "#/parent_stream"        parent_key: "id"        partition_field: "parent_id"        extra_fields:          - ["name"]          - ["category", "type"]
2. Access extra fields in the child stream: The extra fields you specify will be available in the stream slice as stream_slice.extra_fields. For example, you can reference them in your request path, parameters, or transformations like this:
Copy code
{{ stream_slice.extra_fields.name }}    {{ stream_slice.extra_fields.category.type }}
This approach allows you to enrich your child stream's records with additional context from the parent stream, which can be useful for downstream processing or analysis. If a specified field is missing in the parent record, its value will be set to None in the stream slice. For more details, see the documentation on [ParentStreamConfig extra_fields](https://docs.airbyte.com/platform/next/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/ParentStreamConfig) and [advanced partitioning configuration](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/partitioning#advanced-configuration).