Hi! I am adding a new stream to a source connector...
# replication-troubleshooting
l
Hi! I am adding a new stream to a source connector. I am trying to add a field to the source connector that comes from its parent stream. However, this field is not adding correctly. Does anyone have any idea why this is occurring?
k
It could be one of these known gotchas: - Using parent values in transformations: You can reference parent-partition values in a child stream via stream_partition. For example, add a field with value {{ stream_partition.order_id }} after defining the partition identifier in the Parent Stream/partition router. This is the supported pattern. [[Advanced config](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/partitioning#advanced-configuration); [ParentStreamConfig](https://docs.airbyte.com/platform/next/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/ParentStreamConfig); [Transformations](https://docs.airbyte.com/platform/next/connector-development/config-based/understanding-the-yaml-file/record-selector#transformations)] - Known bug in transformations: There’s an open issue where {{ stream_partition["parent_id"] }} resolves incorrectly inside a transformation (e.g., same value across records or offsets), even though it works in the URL path. As a temporary workaround, some users reference {{ stream_partition }} (the whole object) or avoid relying on that exact expression in transformations. [[Bug: stream_partition](https://github.com/airbytehq/airbyte/issues/59117)] - Multi-field parent context: If you need multiple fields from the parent, consider using extra_fields in ParentStreamConfig to carry them into stream_slice and then reference them in transformations (e.g., {{ stream_slice.extra_fields.some_field }}). [[ParentStreamConfig](https://docs.airbyte.com/platform/next/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/ParentStreamConfig); [Advanced config](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/partitioning#advanced-configuration)] If you’re already using {{ stream_partition[...] }} in a transformation and it’s still wrong, you’re likely hitting the reported bug. In that case: - Use {{ stream_partition }} and parse what you need, or - Inject the value via request options/URL path (where it resolves correctly), or - Surface the needed parent fields via extra_fields and reference {{ stream_slice.extra_fields... }} in your transformation. [[Bug: stream_partition](https://github.com/airbytehq/airbyte/issues/59117); [Advanced config](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/partitioning#advanced-configuration); [ParentStreamConfig](https://docs.airbyte.com/platform/next/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/ParentStreamConfig); [Transformations](https://docs.airbyte.com/platform/next/connector-development/config-based/understanding-the-yaml-file/record-selector#transformations)]
l
So what would this snippet of code do? @kapa.ai partition_router: - type: SubstreamPartitionRouter parent_stream_configs: - type: ParentStreamConfig parent_key: composite_key partition_field: composite_key stream: $ref: "#/definitions/streams/attachments_meta" extra_fields: - ["composite_key"]
k
A message from kapa.ai
I’m missing the specific snippet you’re referring to. Could you paste it here? I can then explain exactly what it does and how it interacts with parent-partition values (e.g., via stream_partition or stream_slice.extra_fields). If your snippet uses something like {{ stream_partition.parent_id }} inside a transformation, note there’s a known bug where it can resolve incorrectly; a workaround is to use {{ stream_partition }} or surface fields via extra_fields and reference {{ stream_slice.extra_fields... }}. [[Bug: stream_partition](https://github.com/airbytehq/airbyte/issues/59117); [ParentStreamConfig](https://docs.airbyte.com/platform/next/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/ParentStreamConfig); [Advanced config](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/partitioning#advanced-configuration)]
A message from kapa.ai
This config makes the current stream a substream of attachments_meta and partitions it by each parent record’s composite_key. Concretely: - Uses SubstreamPartitionRouter, so the child stream iterates over parent records. [[SubstreamPartitionRouter](https://docs.airbyte.com/platform/1.7/connector-development/config-based/understanding-the-yaml-file/partition-router#substreampartitionrouter); [SubstreamPartitionRouter ref](https://docs.airbyte.com/platform/1.7/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/SubstreamPartitionRouter)] - Parent stream is definitions/streams/attachments_meta. [[ParentStreamConfig ref](https://docs.airbyte.com/platform/1.7/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/ParentStreamConfig)] - For each parent record, takes parent_key = composite_key and exposes it in the child as partition_field = composite_key, so you can reference it via {{ stream_slice.composite_key }} (or inject via request_option if configured). [[Partition router (1.7)](https://docs.airbyte.com/platform/1.7/connector-development/config-based/understanding-the-yaml-file/partition-router#substreampartitionrouter); [ParentStreamConfig ref](https://docs.airbyte.com/platform/1.7/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/ParentStreamConfig)] - extra_fields includes ["composite_key"], so the parent’s composite_key is also copied into the stream slice’s extra_fields for the child, accessible as {{ stream_slice.extra_fields.composite_key }}. [[ParentStreamConfig ref](https://docs.airbyte.com/platform/1.7/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/ParentStreamConfig)] Net effect: the child stream will run once per attachments_meta record, carrying that record’s composite_key in the slice (both as the partition field and in extra_fields), so you can use it in the child’s URL path, request params, or transformations. [[SubstreamPartitionRouter](https://docs.airbyte.com/platform/1.7/connector-development/config-based/understanding-the-yaml-file/partition-router#substreampartitionrouter); [ParentStreamConfig ref](https://docs.airbyte.com/platform/1.7/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/ParentStreamConfig)]
l
what would this code do? @kapa.ai partition_router: - type: SubstreamPartitionRouter parent_stream_configs: - type: ParentStreamConfig parent_key: composite_key partition_field: composite_key stream: $ref: "#/definitions/streams/attachments_meta" extra_fields: - ["composite_key"] transformations: - type: AddFields fields: - path: ["message_id"] value: "{{ stream_partition.extra_fields['composite_key'].split('::')[0] }}" - type: AddFields fields: - path: ["attachmentId"] value: "{{ stream_partition.extra_fields['composite_key'].split('::')[1] }}"
k
A message from kapa.ai
This makes the current stream a substream of attachments_meta, iterating once per parent record and carrying its composite_key into each slice. Specifically: - SubstreamPartitionRouter: partitions the child by the parent stream attachments_meta using parent_key=composite_key and exposes it as the child’s partition_field composite_key. [[SubstreamPartitionRouter](https://docs.airbyte.com/platform/connector-development/config-based/understanding-the-yaml-file/partition-router#substreampartitionrouter); [SubstreamPartitionRouter ref](https://docs.airbyte.com/platform/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/SubstreamPartitionRouter)] - extra_fields: copies the parent’s composite_key into stream_slice.extra_fields.composite_key for the child. [[ParentStreamConfig](https://docs.airbyte.com/platform/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/ParentStreamConfig)] Transformations then add two fields to each child record by splitting that composite_key (expected format like "<message_id>::<attachmentId>"): - message_id = the part before the first "::". [[Advanced config](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/partitioning#advanced-configuration); [ParentStreamConfig](https://docs.airbyte.com/platform/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/ParentStreamConfig)] - attachmentId = the part after the first "::". [[Advanced config](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/partitioning#advanced-configuration)] Note: The docs show accessing extra_fields via stream_slice (e.g., {{ stream_slice.extra_fields.name }}). Using stream_partition.extra_fields in transformations isn’t explicitly documented; if it doesn’t resolve, switch to {{ stream_slice.extra_fields.composite_key }} in the transformation values. [[Advanced config](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/partitioning#advanced-configuration); [ParentStreamConfig](https://docs.airbyte.com/platform/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/ParentStreamConfig)]