> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omni.co/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.omni.co/feedback

```json
{
  "path": "/modeling/views/parameters/custom-compound-primary-key-sql",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# custom_compound_primary_key_sql

> Defines an array of field names that make up a view's compound primary key.

<Tip>
  A better alternative to this parameter is to create a concatenated field that contains those fields, and then define the dimension-level parameter of `primary_key: true` for that field. This increases readability and potentially simplifies debugging primary key-related errors.

  ```yaml theme={null}
  primary_key_field:
    sql: concat(${field_1},'-',${field_2})
    primary_key: true
    hidden: true
  ```
</Tip>

## Syntax

```yaml theme={null}
custom_compound_primary_key_sql: [ field1, field2, ... ]
```

## Properties

<ParamField path="custom_compound_primary_key_sql" type="array">
  An array of field names that match the dimension names in your view definition. **Note**: When the view is saved, Omni will automatically format field references according to your database type:

  * **Snowflake** - Field names are automatically converted to uppercase and wrapped in double quotes. For example,`[ id, created_at_month ]` will become `[ '"ID"', '"CREATED_AT_MONTH"' ]`
  * **Google BigQuery** - Field names remain as entered without additional quotes. For example, `[ id, created_at_month ]` will remain as-is.
</ParamField>

## Examples

```yaml title="Compound primary key of id & created month" theme={null}
custom_compound_primary_key_sql: [ id, created_at_month ]
```
