API Reference

/projects/{projectId}/models

Returns the latest deployed models in MDL (Model Definition Language) format for the current project

The /models endpoint returns the data models deployed in your project, using Model Definition Language (MDL) format.

MDL is a structured, declarative syntax for defining data models, relationships, transformations, and business semanticsβ€”bridging the gap between raw database schemas and actionable analytics logic.

  • It clearly defines entities, columns, relationships, calculated fields, and views.
  • Semantic context from MDL helps the AI generate accurate SQL and consistent analytics logic
πŸ”—

Learn more

Where to Import MDL

You can import your MDL (Model Definition Language) definitions into your project through the Project create / update API.

Example response

{
  "hash": "8fe319d45cd88196226f2d2c2ecd2ef739d2cfc7",
  "models": [
    {
      "name": "olist_customers_dataset",
      "columns": [
        {
          "name": "customer_id",
          "type": "VARCHAR",
          "isCalculated": false,
          "notNull": false,
          "properties": {
            "description": "customer id.",
            "displayName": "customer_id"
          }
        },
        {
          "name": "customer_state",
          "type": "VARCHAR",
          "isCalculated": false,
          "notNull": false,
          "properties": {
            "description": "Name of the state where the customer is located",
            "displayName": "customer_state"
          }
        }
      ],
      "tableReference": {
        "catalog": "memory",
        "schema": "main",
        "table": "olist_customers_dataset"
      },
      "cached": false,
      "properties": {
        "displayName": "customers"
      },
      "primaryKey": "customer_id"
    }
  ],
  "relationships": [
    {
      "name": "Olist_orders_datasetCustomer_idOlist_customers_datasetCustomer_id",
      "models": [
        "olist_orders_dataset",
        "olist_customers_dataset"
      ],
      "joinType": "MANY_TO_ONE",
      "condition": "\"olist_orders_dataset\".customer_id = \"olist_customers_dataset\".customer_id",
      "properties": {}
    }
  ],
  "views": [
    {
      "name": "test_v",
      "statement": "SELECT \"c\".\"customer_city\" AS \"city\", COUNT(\"o\".\"order_id\") AS \"order_count\" FROM \"olist_customers_dataset\" AS \"c\" JOIN \"olist_orders_dataset\" AS \"o\" ON \"c\".\"customer_id\" = \"o\".\"customer_id\" GROUP BY \"c\".\"customer_city\" ORDER BY \"order_count\" DESC LIMIT 3",
      "properties": {
        "displayName": "test_v",
        "question": "Which are the top 3 cities with the highest number of orders",
        "viewId": "5"
      }
    }
  ]
}

Field reference