how to use json path to set primary key in the bui...
# ask-ai
m
how to use json path to set primary key in the builder?
k
In the Airbyte Connector Builder, the "Primary key" field is used to specify how to uniquely identify a record for downstream de-duplication. However, based on the available documentation, the primary key is set by specifying the field name(s) directly—such as
id
or a combination like `code, type`—rather than using a JSON path expression. For example, if your records look like this:
Copy code
json [   { "code": "BR", "type": "country" },   { "code": "DE", "type": "country" } ]
You would set the primary key as:
Copy code
code, type
This tells Airbyte to use the combination of the
code
and
type
fields as the unique identifier for each record. The documentation does not mention support for JSON path expressions or dot notation for nested fields in the primary key field. It expects flat field names that exist at the top level of each record object. If your data is nested, you may need to use a transformation to flatten the structure before setting the primary key field(s) in the builder UI [Record processing - Meta data](https://docs.airbyte.com/platform/connector-development/connector-builder-ui/record-processing#meta-data). If you need to extract a value from a nested structure to use as a primary key, the current documentation does not provide a built-in way to specify a JSON path directly in the primary key field. You would need to ensure the field you want to use as a primary key is present at the top level of your record, possibly by using a transformation step before setting the primary key.