curl --request PUT \
--url https://api.usedatabrain.com/api/v2/data-app/datamarts \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"datamartName": "sales-analytics",
"tableList": [
{
"schemaName": "public",
"name": "orders",
"clientColumn": "tenant_id",
"isHide": false,
"columns": [
{
"name": "order_id",
"alias": "id",
"label": "Order ID",
"isHide": false
},
{
"name": "customer_id",
"label": "Customer",
"isHide": false
},
{
"name": "order_date",
"alias": "date",
"label": "Order Date",
"isHide": false
},
{
"name": "total_amount",
"label": "Total Amount",
"isHide": true
}
]
},
{
"schemaName": "public",
"name": "customers",
"label": "Customer Records",
"clientColumn": "tenant_id",
"isHide": false,
"columns": [
{
"name": "customer_id",
"alias": "id",
"isHide": false
},
{
"name": "customer_name",
"alias": "name",
"isHide": false
}
]
}
]
}'
{
"id": "sales-analytics"
}
curl --request PUT \
--url https://api.usedatabrain.com/api/v2/data-app/datamarts \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"datamartName": "sales-analytics",
"tableList": [
{
"schemaName": "public",
"name": "orders",
"clientColumn": "tenant_id",
"isHide": false,
"columns": [
{
"name": "order_id",
"alias": "id",
"label": "Order ID",
"isHide": false
},
{
"name": "customer_id",
"label": "Customer",
"isHide": false
},
{
"name": "order_date",
"alias": "date",
"label": "Order Date",
"isHide": false
},
{
"name": "total_amount",
"label": "Total Amount",
"isHide": true
}
]
},
{
"schemaName": "public",
"name": "customers",
"label": "Customer Records",
"clientColumn": "tenant_id",
"isHide": false,
"columns": [
{
"name": "customer_id",
"alias": "id",
"isHide": false
},
{
"name": "customer_name",
"alias": "name",
"isHide": false
}
]
}
]
}'
{
"id": "sales-analytics"
}
Update an existing datamart’s table configurations and tenancy settings without recreating from scratch.
curl --request PUT \
--url https://api.usedatabrain.com/api/v2/data-app/datamarts \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"datamartName": "sales-analytics",
"tableList": [
{
"schemaName": "public",
"name": "orders",
"clientColumn": "tenant_id",
"isHide": false,
"columns": [
{
"name": "order_id",
"alias": "id",
"label": "Order ID",
"isHide": false
},
{
"name": "customer_id",
"label": "Customer",
"isHide": false
},
{
"name": "order_date",
"alias": "date",
"label": "Order Date",
"isHide": false
},
{
"name": "total_amount",
"label": "Total Amount",
"isHide": true
}
]
},
{
"schemaName": "public",
"name": "customers",
"label": "Customer Records",
"clientColumn": "tenant_id",
"isHide": false,
"columns": [
{
"name": "customer_id",
"alias": "id",
"isHide": false
},
{
"name": "customer_name",
"alias": "name",
"isHide": false
}
]
}
]
}'
{
"id": "sales-analytics"
}
curl --request PUT \
--url https://api.usedatabrain.com/api/v2/data-app/datamarts \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"datamartName": "sales-analytics",
"tableList": [
{
"schemaName": "public",
"name": "orders",
"clientColumn": "tenant_id",
"isHide": false,
"columns": [
{
"name": "order_id",
"alias": "id",
"label": "Order ID",
"isHide": false
},
{
"name": "customer_id",
"label": "Customer",
"isHide": false
},
{
"name": "order_date",
"alias": "date",
"label": "Order Date",
"isHide": false
},
{
"name": "total_amount",
"label": "Total Amount",
"isHide": true
}
]
},
{
"schemaName": "public",
"name": "customers",
"label": "Customer Records",
"clientColumn": "tenant_id",
"isHide": false,
"columns": [
{
"name": "customer_id",
"alias": "id",
"isHide": false
},
{
"name": "customer_name",
"alias": "name",
"isHide": false
}
]
}
]
}'
{
"id": "sales-analytics"
}
Authorization: Bearer dbn_live_abc123...
application/json for all requests.Content-Type: application/json
Show Finding datamart names
Show Client column usage
tenancyLevel is TABLEShow Label usage
Show OpenSearch wildcard usage
logs-*, events-2024-*)name when constructing the FROM clausefalse.true, the sql field is required to define the column’s SQL expression.Show Custom column usage
name field should reference an existing column from the datasource schemaalias field to give the calculated column a custom display nameisCustomColumn is true. The expression can reference other columns from the same table.Show SQL expression examples
quantity * unit_priceEXTRACT(YEAR FROM order_date)CONCAT(first_name, ' ', last_name)CASE WHEN status = 'active' THEN 1 ELSE 0 ENDtrue, the column is marked as AGGREGATE drop type for metric calculations.Show Aggregate column usage
true, the column’s datetime values are converted using the timezone passed as params.timezone in the guest token at query execution time.params.timezone is set in the guest token. See Timezone Handling in Guest Token for the full setup guide.Show Timezone conversion details
params.timezone in the guest token — not a user or workspace settingShow Tenancy configuration details
TABLE or DATABASE.TABLE: Client mapping is stored in a specific table (most common)DATABASE: Each client has a separate database instanceNUMBER or STRING.Required when tenancySettings.tenancyLevel is set to TABLE in the request.tenancySettings.tenancyLevel is set to TABLE in the request.tenancySettings.tenancyLevel is set to TABLE in the request.tenancySettings.tenancyLevel is set to TABLE in the request.tenancySettings.tenancyLevel is set to TABLE in the request.Show Relationship configuration
ManyToMany, ManyToOne, OneToMany, OneToOne.Optional: Can be omitted or set to null if not specified.INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN.Optional: Can be omitted or set to null if not specified.| Status Code | Description |
|---|---|
200 | OK - Datamart updated successfully |
400 | Bad Request - Invalid request parameters |
401 | Unauthorized - Invalid or missing API key |
500 | Internal Server Error - Server error occurred |
| Error Code | HTTP Status | Description |
|---|---|---|
INVALID_REQUEST_BODY | 400 | Missing or invalid parameters |
INVALID_DATAMART | 400 | Datamart not found |
INVALID_DATA_APP_API_KEY | 401 | Invalid API key |
INTERNAL_SERVER_ERROR | 500 | Server error |
Get current configuration
curl --request GET \
--url 'https://api.usedatabrain.com/api/v2/data-app/datamarts?isPagination=false' \
--header 'Authorization: Bearer dbn_live_abc123...'
Prepare your update
Update the datamart
curl --request PUT \
--url https://api.usedatabrain.com/api/v2/data-app/datamarts \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"datamartName": "sales-analytics",
"tableList": [
{
"schemaName": "public",
"name": "orders",
"label": "Customer Orders",
"clientColumn": "tenant_id",
"columns": [
{"name": "order_id", "alias": "id"},
{"name": "customer_id"}
]
}
]
}'
Verify the update