Mprove
.mdx

mprove-connection-schemas

Call read-docs tool with pageId: dwh-schema

Schema Files

Schema files provide metadata (descriptions, examples, relationships, cache_unique_values) for database tables and columns. They are combined with raw database schemas to build "combined schemas" that are useful for creating Malloy semantic models.

When to Use

Call get-connections-list and get-schemas tools when:

  • User requested to create or edit Mprove model based on Malloy

Call get-connections-list, get-schemas tools and create/update .schema files when:

  • User asks to setup Mprove project
  • Schema file does not exist for Mprove project SQL connection
  • User requested to create or update schema metadata for a SQL connection

File Location and Naming

  • Directory: schemas/ inside the mprove_dir directory (e.g., data/schemas/)
  • Naming: <connection_name>.<schema_name>.schema
  • Example: c1_postgres.fleet.schema

Workflow for create/update .schema files

Step 1: Fetch Combined Schemas

Read /home/user/.config/opencode/mprove-session.json (if file exist) to get projectId, repoId, branchId, and envId.

Call get-connections-list and get-schemas MCP tools.

Step 2: Check Existing Schema Files

Look for existing .schema files in data/schemas/ if need to create/update metadata.

Step 3: Write Schema Files

For tables of interest, call the get-sample MCP tool.

Use foreignKeys and sample data to infer relationships and to understand if we should cache unique values for the column.

For non-sensitive data write realistic examples.

Create or update .schema files in data/schemas/.

Guidelines:

  • Include all tables and columns
  • Write clear, business-oriented descriptions
  • For non-sensitive data set example value
  • Speficy cache_unique_values: true to recommend column unique values to be cached. Cache will help to translate user data questions to filters of query. Good candidates are string columns that are non-id. Set cache_unique_values: true for columns like categories, status, company name, etc.

On this page