API Reference

Table Relationships API

Manage FK-style table relationships used by the enrichment pipeline.

The Table Relationships API manages foreign-key-style connections between database tables. Relationships are used by the enrichment pipeline to resolve fields from related tables during CDC event processing.

List Relationships

GET /api/table-relationships

Returns all relationships scoped to the current application.

Response:

{
  "relationships": [
    {
      "id": "trel_abc123",
      "applicationId": "app_abc123",
      "sourceTable": "salesforce.exam_session__c",
      "sourceColumn": "application_install_id__r_sid__c",
      "targetTable": "salesforce.application_install__c",
      "targetColumn": "sid__c",
      "createdAt": 1710000000000
    }
  ]
}

Create Relationship

POST /api/table-relationships

Request Body:

{
  "sourceTable": "salesforce.exam_session__c",
  "sourceColumn": "application_install_id__r_sid__c",
  "targetTable": "salesforce.application_install__c",
  "targetColumn": "sid__c"
}
FieldRequiredDescription
sourceTableYesSource table name (schema-qualified)
sourceColumnYesColumn on the source table that references the target
targetTableYesTarget table name (schema-qualified)
targetColumnYesColumn on the target table that is referenced

Relationships are bidirectional for enrichment purposes — the BFS traversal follows them in both directions. Define them once from either direction.

Response: 201 Created with the relationship object.

Delete Relationship

DELETE /api/table-relationships/:id

Response: 200 OK with { "message": "Relationship deleted" }.

Usage with Enrichment

Relationships define the graph the enrichment pipeline traverses when resolving fields from related tables. For example, given:

exam_session → application_install → account_deployment

A mapping on exam_session can enrich with fields from account_deployment (2 hops away). The pipeline uses BFS to find the shortest path and builds LEFT JOIN queries automatically.

See Database API - Enrichment for mapping configuration details.