Skip to content

Data Enrichment

Data enrichment automatically fetches related data and includes it in your embeddings - without changing your source database. This is especially powerful when syncing to vector databases where semantic search quality depends on having rich, contextual data.

When you sync data to a vector database, your records often contain foreign keys instead of meaningful data:

Name: "Morning Yoga Flow"
Description: "A gentle morning session focusing on breath and movement"
Category ID: 5
Organization ID: 12

If you generate an embedding from this data, your vector search can find “yoga” or “morning” - but it can’t find this class when someone searches for “fitness classes at Sunrise Wellness Studio” because the organization name isn’t in the record.

Sync or Swim’s data enrichment automatically resolves foreign keys to their related data at sync time:

After enrichment, your embedding includes:

Name: "Morning Yoga Flow"
Description: "A gentle morning session focusing on breath and movement"
Category: "Yoga - Traditional and modern yoga practices"
Organization: "Sunrise Wellness Studio - A holistic wellness center"

Now searches for “wellness studio”, “holistic”, or “traditional yoga” will surface this class.

In the mapping editor, specify which related data to include for each relationship:

SettingDescriptionExample
Source FieldThe foreign key in your recordcategory_id
Related TableWhere to look up the datacategories
Related KeyThe key field in the related tableid
Fields to IncludeWhat data to fetchname, description
Field PrefixHow to name the enriched fieldscategory_

Enrich a class with its category:

SettingValue
Source Fieldcategory_id
Related Tablecategories
Related Keyid
Fields to Includename, description
Field Prefixcategory_

Enrich a class with both category and organization data by adding multiple enrichment configurations:

Category Enrichment:

SettingValue
Source Fieldcategory_id
Related Tablecategories
Fields to Includename
Field Prefixcategory_

Organization Enrichment:

SettingValue
Source Fieldorganization_id
Related Tableorganizations
Fields to Includename, about
Field Prefixorg_

When a record changes in your source database:

  1. Sync or Swim detects the change
  2. Fetches related records using your configuration
  3. Merges the data into the record
  4. Generates an embedding from the enriched data
  5. Syncs to your vector database

When a related record is updated (e.g., an organization changes their description), all affected embeddings are automatically updated on the next sync. This ensures your vector search results stay current with your data.

Data enrichment works with any source that supports relationship lookups:

SourceLookup Method
PostgreSQLSQL joins
MySQLSQL joins
SalesforceSOQL relationship queries

The enriched payload is visible in the sync history, so you can verify exactly what data is being sent to your vector database. This makes it easy to debug search quality issues and ensure enrichment is working correctly.

  • Single-level relationships: Enrichment currently supports one level of relationships (direct foreign keys). Nested relationships (e.g., category → parent category) are on the roadmap.
  • Vector targets only: Enrichment is designed for embedding generation and applies to vector database targets.