Damon Gudaitis
07/28/2025, 6:40 PMevent_id, I get the below settings but the generated - - event_id does not look like valid YAML. It validates but I'm not sure that it is working.
I'm getting a primary key not unique error. I don't think it's because my key is not unique but rather because I'm not creating a new field properly from the source partition or I'm not referencing it properly.
- type: DeclarativeStream
name: event_registration_types
retriever:
type: SimpleRetriever
paginator:
type: DefaultPaginator
page_size_option:
type: RequestOption
field_name: limit
inject_into: request_parameter
page_token_option:
type: RequestOption
field_name: token
inject_into: request_parameter
pagination_strategy:
type: CursorPagination
page_size: 100
cursor_value: "{{ response.paging.nextToken }}"
stop_condition: "{{ not response.paging.nextToken }}"
requester:
type: HttpRequester
url: >-
{{ config['hostname'] }}/{{ config['api_version'] }}/events/{{
stream_slice.event_id }}/registration-types
http_method: GET
authenticator:
type: SessionTokenAuthenticator
login_requester:
type: HttpRequester
url: "{{ config['hostname'] }}/{{ config['api_version'] }}/oauth2/token"
http_method: POST
request_body:
type: RequestBodyUrlEncodedForm
value:
client_id: "{{ config['client_id'] }}"
grant_type: client_credentials
authenticator:
type: ApiKeyAuthenticator
header: Authorization
api_token: "{{ config['encoded_client_id_and_secret'] }}"
session_token_path:
- access_token
expiration_duration: PT3600S
request_authentication:
type: Bearer
request_options:
request_parameters:
modifiedSince: |-
{% if stream_state and stream_state | length > 0 %}
{{ stream_state }}
{% else %}
{{ format_datetime(config['start_date'], '%Y-%m-%dT%H:%M:%S.%fZ') }}
{% endif %}
record_selector:
type: RecordSelector
extractor:
type: DpathExtractor
field_path:
- data
record_filter:
type: RecordFilter
condition: "{{ record['id'] != '00000000-0000-0000-0000-000000000000' }}"
partition_router:
type: SubstreamPartitionRouter
parent_stream_configs:
- type: ParentStreamConfig
stream:
$ref: "#/streams/0"
parent_key: id
partition_field: event_id
lazy_read_pointer: []
extra_fields:
- - event_id
primary_key:
- id
- event_idkapa.ai
07/28/2025, 6:40 PMevent_id) as part of a composite primary key in your substream. ### 1. Using extra_fields in ParentStreamConfig The extra_fields property in ParentStreamConfig allows you to include additional fields from the parent record in the stream slice. The syntax for extra_fields is an array of arrays, where each inner array represents the path to the field in the parent record. For a top-level field like event_id, the correct syntax is: yaml extra_fields: - [event_id] This will make event_id available in the stream_slice.extra_fields.event_id variable in your substream. The YAML you posted: yaml extra_fields: - - event_id is equivalent to the above and is valid YAML. The double dash is just YAML’s way of representing a nested array. So, this part is correct and should work as intended, as confirmed by the documentation: > Array of field paths to include as additional fields in the stream slice. Each path is an array of strings representing keys to access fields in the respective parent record. Accessible via stream_slice.extra_fields. Missing fields are set to None.[ParentStreamConfig - Next](https://docs.airbyte.com/platform/next/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/ParentStreamConfig) ### 2. Using the Extra Field in the Primary Key To use event_id as part of your composite primary key, you need to ensure that each record in your substream actually contains the event_id field. By default, the extra field is only available in the stream slice, not in the record itself. #### Solution: Add the Partition Value to Each Record You need to add a transformation to inject the partition value (event_id) into each record. This is necessary because the primary key must reference a field present in the record, not just in the stream slice. How to do it: - Add an "Add field" transformation to your stream. - Set the path to event_id. - Set the value to {{ stream_partition.event_id }} (or {{ stream_slice.extra_fields.event_id }} depending on your configuration). Example transformation in YAML: yaml transformations: - type: AddField path: event_id value: "{{ stream_partition.event_id }}" Or, if you are referencing from `extra_fields`: yaml transformations: - type: AddField path: event_id value: "{{ stream_slice.extra_fields.event_id }}" This will ensure that each record has an event_id field, making your composite primary key valid. > Sometimes it's helpful to attach the partition a record belongs to to the record itself so it can be used during analysis in the destination. This can be done using a transformation to add a field and the {{ stream_partition.<identifier> }} interpolation placeholder. [Adding the partition value to the record](https://docs.airbyte.com/platform/connector-development/connector-builder-ui/partitioning#adding-the-partition-value-to-the-record) ### 3. Defining the Composite Primary Key Once the event_id is present in each record, your primary key definition is correct: yaml primary_key: - id - event_id This matches the documented approach for composite keys: > Can either be a single field, an array of fields representing a composite key, or an array of arrays representing a composite key where the fields are nested fields. [PrimaryKey - Next](https://docs.airbyte.com/platform/next/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/PrimaryKey) --- Summary: - Your extra_fields syntax is valid. - You must add a transformation to copy the partition value (event_id) into each record. - Reference this field in your composite primary key. If you skip the transformation, the event_id will not be present in the record, causing uniqueness errors even if the combination should be unique. If you need a concrete YAML snippet for the transformation, let me know!Damon Gudaitis
07/28/2025, 7:31 PMkapa.ai
07/28/2025, 7:31 PMkapa.ai
07/28/2025, 7:32 PM{{ }}. To filter out records that are empty arrays, you can use a condition like: yaml record_filter: condition: "{{ record != [] }}" This condition will exclude any records that are empty arrays from the output, as only records for which the condition evaluates to true will be emitted by the connector. This approach is supported and documented in the Airbyte record filter documentation, which explains how to use filter expressions to include or exclude records based on their content, using the record variable in the filter context [Record Filter - Next](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/record-processing#record-filter). If you need to filter out records based on other criteria (such as missing or empty fields), you can adjust the filter expression accordingly.