# Step 4: Create the Parent Segment Configuration File

The Parent Segment configuration is a JSON file that tells Composable Audience Studio which BigQuery tables and columns to use. Following the Parent Segment data model, it defines:

- **Master** -- points to the single Customers table
- **Attributes** -- columns from the Customers table available for segmentation
- **Behaviors** -- separate event/activity tables linked to the Customers table


## Configuration Differences: BigQuery vs. Other Platforms

| Aspect | BigQuery |
|  --- | --- |
| Connection ID field | `connectionId` |
| `catalog` field | BigQuery project name |
| `schema` field | BigQuery dataset name |
| Authentication | Service account JSON key |
| Connection setup | Integration Hub > Google BigQuery |


## JSON Structure

```json
{
  "name": "<parent_segment_name>",
  "description": "<description>",
  "timezone": "UTC",
  "kind": "composable",
  "isComposable": true,
  "master": { ... },
  "attributes": [ ... ],
  "behaviors": [ ... ]
}
```

## Top-Level Fields

| Field | Type | Required | Description |
|  --- | --- | --- | --- |
| `name` | string | Yes | Display name for the Parent Segment |
| `description` | string | Yes | Description of the Parent Segment |
| `timezone` | string | Yes | Timezone for time-based operations (e.g., `UTC`) |
| `kind` | string | Yes | Must be `composable` |
| `isComposable` | boolean | Yes | Must be `true` |
| `master` | object | Yes | Customers table definition |
| `attributes` | array | Yes | Array of attribute column definitions from the Customers table |
| `behaviors` | array | Yes | Array of Behaviors table definitions |


## Master (Customers Table) Definition

The `master` object points to your single Customers table. This is the central profile table that all attributes come from and all behaviors link to.

```json
"master": {
  "name": "customers",
  "connectionId": "123456",
  "catalog": "my-gcp-project",
  "schema": "cdp_master",
  "table": "customers",
  "keyColumn": "cdp_customer_id"
}
```

| Field | Type | Description |
|  --- | --- | --- |
| `name` | string | Display name for the Customers table |
| `connectionId` | string | ID from your BigQuery authentication configuration (Step 3) |
| `catalog` | string | BigQuery **project** name |
| `schema` | string | BigQuery **dataset** name |
| `table` | string | BigQuery table name |
| `keyColumn` | string | Unique identifier column (e.g., `cdp_customer_id`) |


## Attribute Definition

Each attribute maps a column from the Customers table to a segmentation property in CAS. Since all attributes reside in the Customers table, the `table`, `tableKey`, and `masterKey` fields all reference the same Customers table and its key column.

```json
{
  "id": "1",
  "name": "email",
  "connectionId": "123456",
  "schema": "cdp_master",
  "table": "customers",
  "tableKey": "cdp_customer_id",
  "masterKey": "cdp_customer_id",
  "column": "email",
  "type": "string",
  "createdAt": "2025-11-21T06:05:04.037Z",
  "updatedAt": "2025-11-21T06:05:04.037Z"
}
```

| Field | Type | Description |
|  --- | --- | --- |
| `id` | string | Unique identifier for this attribute (sequential, starting from `1`) |
| `name` | string | Display name in the CAS segment builder |
| `connectionId` | string | BigQuery authentication ID |
| `schema` | string | BigQuery dataset name (same as master) |
| `table` | string | Must be the Customers table name |
| `tableKey` | string | Key column in the Customers table (e.g., `cdp_customer_id`) |
| `masterKey` | string | Same as `tableKey` since attributes come from the Customers table |
| `column` | string | Column name in the Customers table containing the attribute value |
| `type` | string | Data type: `string`, `number`, `boolean`, or `date` |
| `createdAt` | string | ISO 8601 timestamp (use current time) |
| `updatedAt` | string | ISO 8601 timestamp (use current time) |


Key Point
All attributes reference the same Customers table. The `table` field for every attribute must match the `master.table` value.

## Behavior Definition

Each behavior maps a separate Behaviors table to CAS. The Behaviors table is linked to the Customers table via `cdp_customer_id`.

```json
{
  "id": "1",
  "name": "behavior_pageviews",
  "connectionId": "123456",
  "schema": "cdp_master",
  "table": "behavior_pageviews",
  "tableKey": "cdp_customer_id",
  "masterKey": "cdp_customer_id",
  "timeColumn": "time",
  "createdAt": "2025-11-21T06:05:04.056Z",
  "updatedAt": "2025-11-21T06:05:04.056Z",
  "columnMapping": [
    {
      "name": "td_url",
      "type": "string",
      "cdwColumn": "td_url"
    },
    {
      "name": "td_title",
      "type": "string",
      "cdwColumn": "td_title"
    }
  ]
}
```

| Field | Type | Description |
|  --- | --- | --- |
| `id` | string | Unique identifier for this behavior |
| `name` | string | Display name in CAS |
| `connectionId` | string | BigQuery authentication ID |
| `schema` | string | BigQuery dataset name |
| `table` | string | BigQuery Behaviors table name (separate from the Customers table) |
| `tableKey` | string | Column in the Behaviors table linking to the Customers table (e.g., `cdp_customer_id`) |
| `masterKey` | string | Key column in the Customers table (e.g., `cdp_customer_id`) |
| `timeColumn` | string | Column containing the event timestamp |
| `createdAt` | string | ISO 8601 timestamp |
| `updatedAt` | string | ISO 8601 timestamp |
| `columnMapping` | array | Array of event column definitions |


Each entry in `columnMapping`:

| Field | Type | Description |
|  --- | --- | --- |
| `name` | string | Display name for the column in CAS |
| `type` | string | Data type: `string`, `number`, `boolean`, or `date` |
| `cdwColumn` | string | Actual column name in the BigQuery Behaviors table |


## Complete Example

This example defines a "Retail Composable Audience" with 12 customer attributes from the Customers table and 1 Behaviors table:

```json
{
  "name": "Retail Composable Audience",
  "description": "Description of the composable audience",
  "timezone": "UTC",
  "kind": "composable",
  "isComposable": true,
  "master": {
    "name": "customers",
    "connectionId": "123456",
    "catalog": "my-gcp-project",
    "schema": "cdp_master",
    "table": "customers",
    "keyColumn": "cdp_customer_id"
  },
  "attributes": [
    {
      "id": "1",
      "name": "email",
      "connectionId": "123456",
      "schema": "cdp_master",
      "table": "customers",
      "tableKey": "cdp_customer_id",
      "masterKey": "cdp_customer_id",
      "column": "email",
      "type": "string",
      "createdAt": "2025-11-21T06:05:04.037Z",
      "updatedAt": "2025-11-21T06:05:04.037Z"
    },
    {
      "id": "2",
      "name": "address",
      "connectionId": "123456",
      "schema": "cdp_master",
      "table": "customers",
      "tableKey": "cdp_customer_id",
      "masterKey": "cdp_customer_id",
      "column": "address",
      "type": "string",
      "createdAt": "2025-11-21T06:05:04.044Z",
      "updatedAt": "2025-11-21T06:05:04.044Z"
    },
    {
      "id": "3",
      "name": "aov",
      "connectionId": "123456",
      "schema": "cdp_master",
      "table": "customers",
      "tableKey": "cdp_customer_id",
      "masterKey": "cdp_customer_id",
      "column": "aov",
      "type": "number",
      "createdAt": "2025-11-21T06:05:04.053Z",
      "updatedAt": "2025-11-21T06:05:04.053Z"
    },
    {
      "id": "4",
      "name": "city",
      "connectionId": "123456",
      "schema": "cdp_master",
      "table": "customers",
      "tableKey": "cdp_customer_id",
      "masterKey": "cdp_customer_id",
      "column": "city",
      "type": "string",
      "createdAt": "2025-11-21T06:05:04.053Z",
      "updatedAt": "2025-11-21T06:05:04.053Z"
    },
    {
      "id": "5",
      "name": "country",
      "connectionId": "123456",
      "schema": "cdp_master",
      "table": "customers",
      "tableKey": "cdp_customer_id",
      "masterKey": "cdp_customer_id",
      "column": "country",
      "type": "string",
      "createdAt": "2025-11-21T06:05:04.053Z",
      "updatedAt": "2025-11-21T06:05:04.053Z"
    },
    {
      "id": "6",
      "name": "first_name",
      "connectionId": "123456",
      "schema": "cdp_master",
      "table": "customers",
      "tableKey": "cdp_customer_id",
      "masterKey": "cdp_customer_id",
      "column": "first_name",
      "type": "string",
      "createdAt": "2025-11-21T06:05:04.053Z",
      "updatedAt": "2025-11-21T06:05:04.053Z"
    },
    {
      "id": "7",
      "name": "last_name",
      "connectionId": "123456",
      "schema": "cdp_master",
      "table": "customers",
      "tableKey": "cdp_customer_id",
      "masterKey": "cdp_customer_id",
      "column": "last_name",
      "type": "string",
      "createdAt": "2025-11-21T06:05:04.053Z",
      "updatedAt": "2025-11-21T06:05:04.053Z"
    },
    {
      "id": "8",
      "name": "gender",
      "connectionId": "123456",
      "schema": "cdp_master",
      "table": "customers",
      "tableKey": "cdp_customer_id",
      "masterKey": "cdp_customer_id",
      "column": "gender",
      "type": "string",
      "createdAt": "2025-11-21T06:05:04.053Z",
      "updatedAt": "2025-11-21T06:05:04.053Z"
    },
    {
      "id": "9",
      "name": "ltv",
      "connectionId": "123456",
      "schema": "cdp_master",
      "table": "customers",
      "tableKey": "cdp_customer_id",
      "masterKey": "cdp_customer_id",
      "column": "ltv",
      "type": "number",
      "createdAt": "2025-11-21T06:05:04.053Z",
      "updatedAt": "2025-11-21T06:05:04.053Z"
    },
    {
      "id": "10",
      "name": "membership_tier",
      "connectionId": "123456",
      "schema": "cdp_master",
      "table": "customers",
      "tableKey": "cdp_customer_id",
      "masterKey": "cdp_customer_id",
      "column": "membership_tier",
      "type": "string",
      "createdAt": "2025-11-21T06:05:04.053Z",
      "updatedAt": "2025-11-21T06:05:04.053Z"
    },
    {
      "id": "11",
      "name": "next_best_channel",
      "connectionId": "123456",
      "schema": "cdp_master",
      "table": "customers",
      "tableKey": "cdp_customer_id",
      "masterKey": "cdp_customer_id",
      "column": "next_best_channel",
      "type": "string",
      "createdAt": "2025-11-21T06:05:04.053Z",
      "updatedAt": "2025-11-21T06:05:04.053Z"
    },
    {
      "id": "12",
      "name": "next_best_offer",
      "connectionId": "123456",
      "schema": "cdp_master",
      "table": "customers",
      "tableKey": "cdp_customer_id",
      "masterKey": "cdp_customer_id",
      "column": "next_best_offer",
      "type": "string",
      "createdAt": "2025-11-21T06:05:04.053Z",
      "updatedAt": "2025-11-21T06:05:04.053Z"
    }
  ],
  "behaviors": [
    {
      "id": "1",
      "name": "behavior_pageviews",
      "connectionId": "123456",
      "schema": "cdp_master",
      "table": "behavior_pageviews",
      "tableKey": "cdp_customer_id",
      "masterKey": "cdp_customer_id",
      "timeColumn": "time",
      "createdAt": "2025-11-21T06:05:04.056Z",
      "updatedAt": "2025-11-21T06:05:04.056Z",
      "columnMapping": [
        {
          "name": "td_url",
          "type": "string",
          "cdwColumn": "td_url"
        },
        {
          "name": "td_title",
          "type": "string",
          "cdwColumn": "td_title"
        }
      ]
    }
  ]
}
```