Features

SqlCAD is designed to bring software engineering rigor to data warehousing. From type safety to automated lineage, every feature helps you build more reliable data products.

Core Architecture

Graph-Based Modeling

Define entities and relationships, not just tables. SqlCAD understands how your data connects, allowing it to automatically generating complex JOIN paths so you don't have to write them manually.

OrdersCustProdMartn:1

Automated Layers

Enforces a clean separation of concerns. Each layer has specific rules and optimizations handled by the compiler.

Source (Raw)
⬇ Types & Cleaning
Entity (Silver)
⬇ Joins & Aggregation
Mart (Gold)

Data Quality & Reliability

Type Safety & Validation

SqlCAD validates your entire graph at compile time. It checks for missing columns, invalid type operations, and broken references before any SQL is run.

DEFINE MART BadMath AS (
  SELECT 
    Amount + 'string' 
  FROM Orders
);
// Error: Cannot apply operator '+' 
// to types DECIMAL and STRING

Built-in Observability

Every load operation automatically tracks statistics. Define assertions (`not_null`, `distinct`, `expression`) directly on your models.

DEFINE REPORT DailySales {
  tests:
    - not_null: [Date, Revenue]
    - expression: "Revenue >= 0"
} AS ( SELECT ... )

Temporal Intelligence & ML

SCD Type 2 Automation

SqlCAD automates `valid_from` and `valid_to` management, generating complex merge logic for you.

DEFINE ENTITY Orders {
  temporal: {
    event_time_col: OrderDate
  }
}
// Compiler generates:
// MERGE ... 
// ON o.id = s.id 
// AND s.valid_to IS NULL...

Feature Storing

Define reusable ML features. SqlCAD handles point-in-time correctness to prevent training data leakage.

DEFINE FEATURE_SET CustomerFeatures {
  entity: Customers
  temporal: { point_in_time: true }
  features:
    - recent_order_count
    - lifetime_value
}

Point-in-Time Joins

Stop writing manual "AS OF" joins. SqlCAD automatically injects the correct temporal logic.

Valid: Jan-MarValid: Mar-JunOrder Event (Apr)Joins to State B automatically

Operations

Schema Evolution

Declaratively manage your database schema. The Diff Engine compares code to specific database state.

> sqlcad schema plan

Diff Engine detected:
- [NEW] Column 'Discount' in 'Orders'
- [MOD] Type 'Amount': INT -> DECIMAL

Generated 'migration_001.sql'

Multi-Dialect Support

Write logic once, compile to optimized SQL for multiple backends.

BigQuery
Snowflake
DuckDB