> For the complete documentation index, see [llms.txt](https://v2.dataos.info/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://v2.dataos.info/references/october2026/engine-guide/athena/materialization-behavior.md).

# Materialization behavior

Understand how Vulcan model kinds map to native Athena operations.

With a validated gateway, this is the build stage. Choose a model kind and understand its Athena operation before running it.

## Materialization behavior per model kind

SQL models compile to Athena SQL (Presto/Trino family).

| Model kind                  | Athena operation (conceptual)                         |
| --------------------------- | ----------------------------------------------------- |
| `FULL`                      | Table rebuild / insert-overwrite per adapter strategy |
| `VIEW`                      | `CREATE VIEW`                                         |
| `INCREMENTAL_BY_TIME_RANGE` | Windowed delete/overwrite + insert                    |
| `INCREMENTAL_BY_UNIQUE_KEY` | `MERGE` or equivalent where supported                 |
| `INCREMENTAL_BY_PARTITION`  | Partition-scoped overwrite                            |

### Engine-native feature support

Use Athena-specific capabilities where they add clear value.

| AWS / Athena feature         | Vulcan pattern                     | Notes                                 |
| ---------------------------- | ---------------------------------- | ------------------------------------- |
| Workgroup                    | `work_group` / `ATHENA_WORK_GROUP` | Primary execution knob                |
| Glue database                | `schema_name`                      | Vulcan creates schemas/tables inside  |
| External table (Parquet)     | `before_all`, seeds, Nilus         | Source / staging layer                |
| Managed table (Hive/Iceberg) | `FULL` / incrementals              | Requires `s3_warehouse_location`      |
| Iceberg state tables         | Default adapter state path         | Slower but self-contained             |
| Views                        | kind `VIEW`                        | Staging / intermediate                |
| Python models                | `.py` models                       | Validate on your image                |
| Lake Formation               | Platform boundary                  | Apply LF grants outside Vulcan        |
| EMR / Spark jobs             | Boundary                           | Land outputs to S3 for Vulcan to read |

#### Not supported

Vulcan does not manage these Athena capabilities:

* Workgroup creation or resizing: no lifecycle API in Vulcan. Provision through the AWS console, Terraform, or Control Tower.
* Non-default Glue catalog creation: an AWS admin boundary. Configure federated or cross-account catalogs directly in AWS.
* Databricks-style Unity Catalog row policies; enforce at Glue/Lake Formation instead, and test with the service principal.
* Strong `REPLACE TABLE` semantics (`SUPPORTS_REPLACE_TABLE = False`); use the FULL-refresh patterns Vulcan emits.
* Arbitrary SQL in leading block comments for correlation IDs: the Athena parser rejects some comment patterns; avoid a leading `/* ... */` on statements.
* ML or streaming ingest inside Vulcan: out of scope. Use Kinesis Firehose, Nilus, or Glue jobs to land data in S3, then read it as external tables.

Vulcan also does not create S3 buckets, Athena workgroups, or the Glue metastore account setup; provision those out of band. `s3_warehouse_location` and `s3_staging_dir` must both be valid before `apply`, and there are no multi-statement transactions, so a pipeline that fails mid-run may need manual cleanup or an idempotent re-run.

### Reference layering pattern (Kimball retail)

| Layer  | Kind                                 | Reads from                         |
| ------ | ------------------------------------ | ---------------------------------- |
| Source | External tables in a source database | S3 Parquet (`before_all` or Nilus) |
| Bronze | `FULL` / views                       | Source / external models           |
| Silver | `FULL`, Python analytics             | Bronze                             |
| Gold   | `FULL`                               | Silver                             |

### Lifecycle DDL guards

```sql
@IF(@runtime_stage = 'evaluating',
  -- DDL that must not run on plan-only
  SELECT 1
);
```

### External sources

Declare tables in `inputs.yaml`, or bootstrap with `before_all`:

```sql
CREATE EXTERNAL TABLE ... STORED AS PARQUET LOCATION '{{ env_var('ATHENA_S3_WAREHOUSE_LOCATION') }}...';
```

### Column naming for semantics

Keep **snake\_case** consistent from SQL through semantic YAML where that's your project convention (`order_date`, `customer_id`). Match semantic dimensions/measures to model column names exactly.

## Semantic models

Semantic models compile to SQL against the Glue tables Vulcan creates. Use explicit `joins` for multi-entity queries; cross-join-shaped queries are a primary latency and cost driver, since Athena bills on bytes scanned.

## Business metrics

```yaml
kind: metric
name: daily_sales_performance
measure: daily_sales.total_daily_revenue
ts: daily_sales.order_date
granularity: day
```

Heavy `COUNT(DISTINCT ...)` over large facts increases scanned data; pre-aggregate in Silver/Gold where possible.

## Data quality

| Layer                 | Where it runs                               | Athena cost    | When it catches a problem |
| --------------------- | ------------------------------------------- | -------------- | ------------------------- |
| Linter                | Local                                       | None           | Authoring time            |
| Assertions            | Athena during materialization               | Per query scan | Every run                 |
| Unit tests (`tests/`) | Local (DuckDB)                              | None on Athena | Pre-merge                 |
| Audits (`audits/`)    | Athena post-run                             | Per query      | Post-run                  |
| Data quality (`dq/`)  | Athena after a successful run or plan apply | Per query      | Drift / freshness         |

{% hint style="info" %}
Unit tests use DuckDB even when the gateway is Athena; this is expected. Use audits and DQ checks for warehouse-side validation.
{% endhint %}

## Lineage and version rollback

Lineage is computed from Vulcan's SQL parse. Cross-database references (for example `retail_source.orders_ext`) need to be declared, or visible to the linter, in `inputs.yaml`.

`vulcan rollback` replays prior plan strategies; incrementals re-touch affected windows and incur scan charges when they do.

## Before you ship checklist (Data Product developer)

* [ ] Semantic identifiers match **physical column casing**
* [ ] Lifecycle DDL guarded with `@IF(@runtime_stage = 'evaluating', …)` where applicable
* [ ] External / source tables declared or bootstrapped (`before_all`, seeds, or `inputs.yaml`)
* [ ] Joins declared for all multi-entity semantic queries
* [ ] Grains declared correctly on facts and dimensions
* [ ] Audits and DQ checks tagged separately from production reads where cost attribution matters
* [ ] `endOn` set and reviewed in the Vulcan resource schedule

## Next step

After models deploy, make data available through [Serve](https://v2.dataos.info/references/october2026/engine-guide/athena.md#serve), or skip straight to a ready-made shape in [Deployment recipes](https://v2.dataos.info/references/october2026/engine-guide/athena/recipes/deployment-recipes.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://v2.dataos.info/references/october2026/engine-guide/athena/materialization-behavior.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
