Sidemantic supports authoring semantic layers as SQL DDL blocks.

## MODEL

```sql doc-validate=lint
MODEL (
  name orders,
  table orders,
  primary_key id
);
```

## DIMENSION

```sql doc-validate=lint
DIMENSION (
  name created_at,
  type time,
  sql created_at,
  granularity day
);
```

## METRIC (Model-Level)

```sql doc-validate=lint
METRIC (
  name revenue,
  agg sum,
  sql amount
);
```

## RELATIONSHIP

```sql doc-validate=lint
RELATIONSHIP (
  name customers,
  type many_to_one,
  foreign_key customer_id
);
```

## SEGMENT

```sql doc-validate=lint
SEGMENT (
  name completed,
  sql {model}.status = 'completed'
);
```