What is a Datamart?

A Datamart is a curated, optimized subset of your data specifically designed for analytics and AI-powered queries. Think of it as a semantic layer that makes your data more accessible, faster to query, and easier to understand for both humans and AI.

Why Use Datamarts?

Faster Queries

Pre-aggregated and optimized data for lightning-fast analytics

AI-Ready Data

Structured for natural language queries and AI insights

Simplified Schema

Business-friendly data model hiding technical complexity

Consistent Metrics

Single source of truth for key business metrics

Key Features

Semantic Layer

Define business-friendly names and descriptions for your data:
  • Rename technical columns to business terms
  • Add descriptions and metadata
  • Define relationships between tables
  • Create calculated fields

Pre-Aggregation

Improve query performance with pre-calculated aggregations:
  • Daily, weekly, monthly rollups
  • Pre-computed metrics
  • Materialized views
  • Incremental updates

AI Chat Mode

Enable natural language queries on your datamart:
  • “Show me revenue by region last quarter”
  • “What are the top 10 customers?”
  • “Compare this month to last month”

AI Chat Mode Setup

Enable AI-powered analytics with datamarts

Creating a Datamart

1

Connect Data Source

Start with a connected database or data warehouse
2

Select Tables

Choose which tables to include in your datamart
3

Define Relationships

Set up joins between tables
4

Add Metadata

Provide business-friendly names and descriptions
5

Configure AI

Set up LLM connectors for chat mode (optional)

Create a Datamart

Step-by-step datamart creation guide

Datamart Components

Tables & Views

Select and configure tables from your data source:
  • Physical tables
  • Database views
  • Custom SQL queries
  • Joined datasets

Relationships

Define how tables relate to each other:
  • One-to-many relationships
  • Many-to-many relationships
  • Self-referential joins
  • Cross-database joins

Calculated Fields

Create business logic fields:
  • Formulas and expressions
  • Conditional calculations
  • Aggregations
  • Date transformations

Metadata

Add context to your data:
  • Column descriptions
  • Business names
  • Data types and formats
  • Tags and categories

Semantic Layer

The semantic layer translates technical data structures into business concepts.

Business Names

customer_acq_date → Customer Acquisition Date
mrr → Monthly Recurring Revenue
cac → Customer Acquisition Cost

Descriptions

Add helpful descriptions that appear in AI responses and tooltips:
  • What the metric measures
  • How it’s calculated
  • When to use it
  • Known limitations

Data Types

Define appropriate data types:
  • Dimensions (categories)
  • Measures (numeric values)
  • Dates and times
  • Text and strings

AI Chat Mode Integration

Datamarts power AI chat mode, enabling natural language analytics.

How It Works

  1. User asks a question - “What were total sales last month?”
  2. AI understands intent - Uses datamart metadata to interpret the question
  3. Generate SQL - Creates optimized query based on datamart structure
  4. Return results - Displays data with natural language explanation

LLM Configuration

Connect your preferred LLM:
  • OpenAI GPT
  • Claude AI
  • Azure OpenAI
  • Llama
  • Mixtral

LLM Connectors

Configure AI models for chat mode

Performance Optimization

Aggregation Tables

Pre-calculate common aggregations:
-- Daily revenue rollup
CREATE TABLE daily_revenue AS
SELECT 
  DATE(order_date) as date,
  SUM(amount) as total_revenue,
  COUNT(*) as order_count
FROM orders
GROUP BY DATE(order_date)

Materialized Views

Use database-native materialized views for fast queries.

Incremental Updates

Schedule regular updates to keep datamart fresh:
  • Real-time sync
  • Hourly updates
  • Daily batches
  • Custom schedules

Multi-Datasource Datamarts

Combine data from multiple sources into a unified datamart:
  • Join data across databases
  • Federated queries
  • Cross-platform analytics
  • Unified schema

Semantic Layer

Learn about semantic layer capabilities

Data Governance

Access Control

Control who can query the datamart:
  • Role-based access
  • Row-level security
  • Column-level permissions
  • Query limits

Audit Trail

Track datamart usage:
  • Query history
  • User access logs
  • Data lineage
  • Performance metrics

Data Quality

Ensure datamart accuracy:
  • Validation rules
  • Data freshness indicators
  • Completeness checks
  • Anomaly detection

Use Cases

AI-Powered Analytics

Enable business users to ask questions in natural language:
  • “Top customers by revenue”
  • “Sales trends last quarter”
  • “Compare regions”

Consistent Metrics

Ensure everyone uses the same definitions:
  • Standard KPI calculations
  • Consistent aggregations
  • Unified dimensions

Fast Dashboards

Power dashboards with pre-aggregated data:
  • Real-time metrics
  • Historical trends
  • Drill-down capabilities

Cross-Database Analytics

Analyze data from multiple sources:
  • Combine CRM and billing data
  • Join warehouse and operational data
  • Unified customer view

Best Practices

Begin with core tables and metrics. Expand the datamart gradually as needs grow.
Name fields and tables using terms your business users understand, not technical jargon.
Add descriptions to all fields. This helps both users and AI understand your data.
Pre-aggregate data for your most frequent query patterns.
Set up regular updates to ensure datamart data is current.
Try asking questions in chat mode to validate your semantic layer.

Datamart vs. Data Warehouse

AspectDatamartData Warehouse
ScopeFocused on specific use caseEnterprise-wide data
PurposeAnalytics & AI queriesSource of truth storage
SchemaDenormalized, optimizedNormalized, comprehensive
UsersBusiness analysts, AIData engineers, analysts
PerformanceOptimized for readsBalanced read/write

Monitoring & Maintenance

Performance Monitoring

Track datamart performance:
  • Query response times
  • Resource utilization
  • Cache hit rates
  • Failed queries

Data Freshness

Monitor data updates:
  • Last sync time
  • Update frequency
  • Lag indicators
  • Sync failures

Usage Analytics

Understand how datamarts are used:
  • Popular queries
  • Active users
  • Peak usage times
  • Feature adoption

API Access

Access datamarts programmatically:
curl --request POST \
  --url https://api.usedatabrain.com/api/v2/datamart/query \
  --header 'Authorization: Bearer YOUR_API_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "datamartId": "your-datamart-id",
    "query": "SELECT * FROM sales WHERE region = 'North'"
  }'

Datamart API

Complete datamart API reference

Next Steps