Skip to content

Import metadata using YAML

Actian AI Analyst lets you quickly set up or update table metadata by importing a YAML file. This is useful when migrating metadata from other tools.

How the YAML Import Works

  • You upload a YAML file describing your tables, columns, and relationships.
  • Actian AI Analyst uses this file to populate or overwrite metadata for the specified table.
  • You can also export existing metadata to YAML format for backup or migration purposes.

Full YAML Metadata Structure

models:
  - name: <table_name>                     # [Required] The exact name of the table in your database.

    description: <table_description>        # [Optional] Business description of what this table represents.
                                            # Used by AI Agents for context and understanding.

    columns:                               # [Required] List of columns in this table.
      - name: <column_name>                 # [Required] The exact name of the column in the database.
        description: <column_description>   # [Optional] Business-friendly description and any logic/rules.
        rules: <business_rules>             # [Optional] Any business validation or constraints for the column.
        semantic_type: <semantic_type>      # [Optional] Label for the kind of data (e.g., NAME, EMAIL, STATUS).
        data_type: <data_type>              # [Optional but recommended] Data type (e.g., string, bigint, date).
        visible: <true|false>               # [Optional, default: true] Set to false to hide from AI Agents.
        is_primary_key: <true|false>        # [Optional] Indicates if this column is a primary key.

    relationships:                         # [Optional] List of table relationships.
      - name: <relationship_name>           # [Required if relationships are defined] Unique name for this relationship.
        description: <relationship_description>   # [Optional] Description of the relationship.
        source_column: <column_name>        # [Required] The column in this table that links to another table.
        target_table: <target_table_name>   # [Required] The referenced table.
        target_column: <target_column_name> # [Required] The referenced column in the target table.
        type: <relationship_type>           # [Required] Type of relationship (e.g., one_to_many, many_to_one).

Available Semantic Types

You can use these predefined semantic_type values in your column metadata for improved AI context and query understanding:

Semantic TypeDescription
DATECalendar date (e.g., 2024-06-01)
TIMETime of day (e.g., 13:45:00)
TIMESTAMPDate and time (e.g., 2024-06-01T13:45:00Z)
DURATIONTime duration (e.g., 5 minutes, 2 hours)
CURRENCYMonetary value (e.g., $100, EUR 50)
PERCENTAGEPercent values (e.g., 85%)
QUANTITYRaw quantity or count
STATUSState or status (e.g., active, pending)
EMAILEmail address
URLWeb URL
FULL_TEXTParagraph or long-form text
NAMEPerson, company, or entity name
DESCRIPTIONFree-text description
CODECode, SKU, or other code-like string
IDENTIFIERAny unique identifier (e.g., ID)
SCOREScoring metric (numeric)
BOOLEAN_FLAGTrue/False, Yes/No indicators
PHONE_NUMBERTelephone number
COUNTRY_CODECountry code (e.g., US, DE, FR)
LANGUAGE_CODELanguage code (e.g., en, de, fr)
LATITUDELatitude coordinate
LONGITUDELongitude coordinate
WEIGHTWeight measurement (e.g., kg, lbs)
DISTANCEDistance measurement (e.g., km, mi)
TEMPERATURETemperature (e.g., 20°C)
CATEGORICALCategorical/enum value

Set the semantic_type field on a column to one of these for best results.


Table Relationships and Cardinality Types

To define relationships between tables, use the relationships block in your YAML metadata. Every relationship describes how rows in this table map to rows in another table.

Cardinality Types

Set the type field in each relationship to specify cardinality:

Relationship TypeMeaning
one_to_manyOne record in this table relates to many records in the target table
many_to_oneMany records in this table relate to one record in the target table
one_to_oneOne record in this table relates to one record in the target table
many_to_manyMany records in this table relate to many records in the target table

Examples:

  • one_to_many: An organization has many users
  • many_to_one: Many orders belong to one customer
  • one_to_one: One user profile for each user
  • many_to_many: Students enrolled in many courses, courses have many students

YAML Example:

relationships:
  - name: org_to_users
    description: Organization to user relationship
    source_column: org_id
    target_table: users
    target_column: org_id
    type: one_to_many

Full example YAML File

models:
  - name: lh_suppliers               # Table name (required)
    description: Supplier master table for all vendors.   # Table description (recommended)
    columns:
      - name: supplier_id            # Column name (required)
        description: Unique identifier for supplier  # Column description (recommended)
        rules: Auto-generated, must be unique
        semantic_type: IDENTIFIER
        data_type: bigint
        visible: true                # true = visible to AI Agents
        is_primary_key: true         # Marks this column as a primary key
      - name: name                   
        description: Name of the supplier  
        rules: Must be unique and non-empty
        semantic_type: NAME
        data_type: string
        visible: true
        is_primary_key: false
      - name: status
        description: Supplier status
        rules: Must be one of: active, inactive, pending
        semantic_type: STATUS
        data_type: string
        visible: true
    relationships:
      - name: supplier_products
        description: Each supplier can have multiple products
        source_column: supplier_id
        target_table: lh_products
        target_column: supplier_id
        type: one_to_many