Introduction
Evaluate Daana
A report joining orders to current customer values puts Emily Johnson's order 12 in Philadelphia. She placed it on 20 November 2024 at the example bookstore. The order query ran on DuckDB and the Free tier on 16 November 2026:
| order_id | city_at_order | status_at_order | tier_at_order | city_now |
|---|---|---|---|---|
| 12 | Boston | Active | Silver | Philadelphia |
Emily lived in Boston at the order's instant. Daana built her history from a change log, nightly snapshots, and a table updated in place. No history SQL was written.
Daana is a CLI that generates SQL from a YAML business model, deploys it and loads data on PostgreSQL, BigQuery, Snowflake and DuckDB. The page shows one history from three source tables, an order at its instant, and an attribute added with history and no table change.
Run it yourself
Install Daana CLI on macOS Apple silicon or Linux x86-64, and DuckDB CLI 1.5. On Linux ARM64, use the container that Prerequisites describes. The download needs no form and no login.
The route uses 13 terminal commands. DuckDB runs 8 queries, and two YAML edits need a text editor. Print both versions:
Run in terminal
daana --version
duckdb --version
Expected output of duckdb --version
v1.5.3 (Variegata) 14eca11bd9
Use DuckDB CLI 1.5.x. Daana CLI cannot open a database file that a newer DuckDB CLI creates. Create and enter the checkpoint ch1 project:
Run in terminal
daana init bookstore-evaluate --example bookstore --checkpoint ch1
cd bookstore-evaluate
Expected output of daana init
Loaded data/seed.sql into bookstore.duckdb: 54 source tables in schema stage
✨ Bookstore project initialized successfully!
Project: Bookstore example, checkpoint ch1
Location: <project>
The excerpt confirms ch1 and 54 source tables in stage. <project> is the full path. Outside the example, Daana reads existing source tables.
An entity models a business concept, and an attribute describes a property. Read customer_status in dab/model.yaml:
- id: customer_status
name: customer_status
definition: Account status (Active, Inactive, Suspended)
type: STRING
Below, # ... marks omitted lines. Read the mapping entry in dab/mappings/customer-mapping.yaml:
table: stage.customers
# ...
- id: customer_status
transformation_expression: account_status
The model defines the attribute's meaning and type without naming a source table. The mapping reads its value from the column account_status of stage.customers.
A pipeline loads one atomic context (one attribute or a group of attributes) or one relationship from one source table. For the Free tier's pipeline limit, identifier pipelines count too (one per source table when an entity has several identifiers). Validate the project, prepare the database, deploy the model, and load the data:
Run in terminal
daana check && daana install && daana deploy && daana execute
Expected output, summary line of daana execute
Pipelines: 13 ran
All 13 pipelines ran without a license.
One customer, three sources
Open the data warehouse in DuckDB with -readonly to prevent writes:
Run in terminal
duckdb -readonly bookstore.duckdb
The source table stage.customer_addresses holds a nightly snapshot of each customer's address, whether it changes or not. List the addresses for Emily, customer 2, with their snapshot dates:
Run in DuckDB
SELECT city, count(*) AS snapshots,
min(snapshot_date) AS first_snapshot,
max(snapshot_date) AS last_snapshot
FROM stage.customer_addresses
WHERE customer_id = 2
GROUP BY city
ORDER BY first_snapshot;
Expected output
| city | snapshots | first_snapshot | last_snapshot |
|---|---|---|---|
| Boston | 24 | 2024-11-05 | 2024-11-28 |
| Philadelphia | 1 | 2024-11-29 | 2024-11-29 |
Her Boston snapshots cover the order's day, 20 November. The CRM appends a row to stage.customers whenever a customer record changes. Read her CRM rows in UTC, noting the changed opt-in flag:
Run in DuckDB
SELECT timezone('UTC', updated_at) AS updated_at,
account_status, marketing_opt_in
FROM stage.customers
WHERE customer_id = 2
ORDER BY updated_at;
Expected output
| updated_at | account_status | marketing_opt_in |
|---|---|---|
| 2023-02-14 11:05:40 | Active | false |
| 2024-11-04 18:24:50 | Active | true |
The customer mapping leaves out the opt-in flag, so the row of 4 November adds no history row.
The bookstore's loyalty system overwrites a member's row, so stage.loyalty_memberships holds the current tier and no earlier one. Read Emily's membership:
Run in DuckDB
SELECT tier_level, join_date, last_activity_date
FROM stage.loyalty_memberships
WHERE customer_id = 2;
Expected output
| tier_level | join_date | last_activity_date |
|---|---|---|
| Silver | 2024-11-01 | NULL |
With last_activity_date missing, the mapping dates membership by join_date, 1 November 2024. The view view_customer_hist holds a history row for each instant when a mapped customer value changes. Read Emily's history:
Run in DuckDB
SELECT eff_tmstp, customer_city, customer_status,
customer_loyalty_tier
FROM daana_dw.view_customer_hist
WHERE customer_key = '2'
ORDER BY eff_tmstp;
Expected output
| eff_tmstp | customer_city | customer_status | customer_loyalty_tier |
|---|---|---|---|
| 2023-02-14 11:05:40 | NULL | Active | NULL |
| 2024-11-01 00:00:00 | NULL | Active | Silver |
| 2024-11-05 00:00:00 | Boston | Active | Silver |
| 2024-11-29 00:00:00 | Philadelphia | Active | Silver |
Her four rows start at her first CRM row, her tier, and her addresses. The column eff_tmstp holds the effective timestamp, which is the instant from which a row's values are valid. Her address snapshots start on 5 November, so the earlier rows have NULL for city and give no earlier address.
What Daana did
- Daana merged the source tables on
customer_idinto one timeline. - Daana deduplicated the 24 identical Boston snapshots into one history row, dated 5 November.
Order 12 at its own instant
view_order_with_rel joins orders to current customer values. Compare city, status, and tier at the order's purchase time with the current city, using the point-in-time function f_customer(ts):
Run in DuckDB
SELECT o.order_id,
c.customer_city AS city_at_order,
c.customer_status AS status_at_order,
c.customer_loyalty_tier AS tier_at_order,
o.customer_city AS city_now
FROM daana_dw.view_order_with_rel o,
LATERAL (SELECT * FROM daana_dw.f_customer(o.order_purchase_ts) fc
WHERE fc.customer_key = o.customer_key) c
WHERE o.order_id = '12';
Expected output
| order_id | city_at_order | status_at_order | tier_at_order | city_now |
|---|---|---|---|---|
| 12 | Boston | Active | Silver | Philadelphia |
f_customer returns Boston, active status, and Silver membership at the order's instant, while the current view gives Philadelphia. The query takes the customer key from the current relationship in view_order_with_rel. This is safe here because an order keeps its customer.
What the declaration replaced
Declarations define business concepts in YAML and name the sources of their values. Read the excerpt from dab/mappings/customer-mapping.yaml, noting the source table, key, timestamp, and columns:
# Source 2: Address snapshots, merged automatically with Source 1
- connection: duckdb
table: stage.customer_addresses
primary_keys:
- customer_id
ingestion_strategy: FULL_LOG
entity_effective_timestamp_expression: snapshot_date
attributes:
- id: customer_city
transformation_expression: city
- id: customer_state
transformation_expression: state
Inspect the loading SQL that the city pipeline ran, recorded in daana_metadata.batch_history_sql:
, prev_change AS(
SELECT
# ...
LAG(change_value.eff_tmstp) OVER (PARTITION BY change_value.focal_idfr, change_value.seq_nbr ORDER BY change_value.eff_tmstp, change_value.precedence_tmstp) AS prev_eff_tmstp,
LAG(change_value.delta_value) OVER (PARTITION BY change_value.focal_idfr, change_value.seq_nbr ORDER BY change_value.eff_tmstp, change_value.precedence_tmstp) AS prev_delta_value
FROM change_value
)
# ...
FROM prev_change
WHERE prev_eff_tmstp IS NULL
OR (delta_value IS NULL AND prev_delta_value IS NOT NULL)
OR (delta_value IS NOT NULL AND prev_delta_value IS NULL)
OR delta_value <> prev_delta_value
)
Daana compares consecutive rows' value hashes for each customer with LAG() and keeps only changes for customer_desc. The views and functions Daana generates are ordinary SQL objects in your database. You can open their definitions and read them.
A new attribute
Before adding marketing opt-in, count base tables and columns and calculate a checksum of their names and types:
Run in DuckDB
SELECT count(DISTINCT table_name) AS tables,
count(*) AS columns,
left(md5(string_agg(
table_name || '.' || column_name || ' ' || data_type,
', ' ORDER BY table_name, ordinal_position)), 12) AS checksum
FROM information_schema.columns
JOIN information_schema.tables USING (table_schema, table_name)
WHERE table_schema = 'daana_dw'
AND table_type = 'BASE TABLE';
Expected output
| tables | columns | checksum |
|---|---|---|
| 8 | 74 | e9a41358e736 |
Compare this structure after the change. Quit DuckDB with .quit, because even a read-only session holds a file lock that prevents Daana from writing.
In dab/model.yaml, find customer_loyalty_tier. After the blank line following its effective_timestamp: true line, add these four lines and a blank line:
- id: customer_marketing_opt_in
name: customer_marketing_opt_in
definition: CRM customer record's marketing opt-in flag (true or false)
type: STRING
The model has no boolean type. STRING holds text-based data of any length. In dab/mappings/customer-mapping.yaml, find stage.customers. Below the customer_status entry's transformation_expression: account_status line, add:
- id: customer_marketing_opt_in
transformation_expression: marketing_opt_in
Validate the project, deploy the model, and load the data:
Run in terminal
daana check && daana deploy && daana execute
Expected output, summary line of daana execute
Pipelines: 8 ran, 6 skipped: nothing new above the watermark to read (batch_history row_st S)
Customer pipelines, including the new one, read whole tables, while order pipelines were skipped because no new rows arrived. DAB (Data according to Business) has 14 pipelines, within the free DAB allowance of 90 executable pipelines. Reopen DuckDB:
Run in terminal
duckdb -readonly bookstore.duckdb
Read Emily's history with the new column:
Run in DuckDB
SELECT eff_tmstp, customer_marketing_opt_in,
customer_city, customer_status, customer_loyalty_tier
FROM daana_dw.view_customer_hist
WHERE customer_key = '2'
ORDER BY eff_tmstp;
Expected output
| eff_tmstp | customer_marketing_opt_in | customer_city | customer_status | customer_loyalty_tier |
|---|---|---|---|---|
| 2023-02-14 11:05:40 | false | NULL | Active | NULL |
| 2024-11-01 00:00:00 | false | NULL | Active | Silver |
| 2024-11-04 18:24:50 | true | NULL | Active | Silver |
| 2024-11-05 00:00:00 | true | Boston | Active | Silver |
| 2024-11-29 00:00:00 | true | Philadelphia | Active | Silver |
Reading the earlier CRM rows added the opt-in change of 4 November 2024, giving five history rows. Compare the base tables again:
Run in DuckDB
SELECT count(DISTINCT table_name) AS tables,
count(*) AS columns,
left(md5(string_agg(
table_name || '.' || column_name || ' ' || data_type,
', ' ORDER BY table_name, ordinal_position)), 12) AS checksum
FROM information_schema.columns
JOIN information_schema.tables USING (table_schema, table_name)
WHERE table_schema = 'daana_dw'
AND table_type = 'BASE TABLE';
Expected output
| tables | columns | checksum |
|---|---|---|
| 8 | 74 | e9a41358e736 |
The attribute has history from Emily's first CRM row, 14 February 2023, and the matching counts and checksum show unchanged base table structure. Daana therefore stored the new attribute as rows in the existing customer_desc table, and adding it needed no ALTER TABLE statement. The views present one column per attribute, with storage explained in the Focal Framework.
Check the source column's meaning, because Daana cannot tell what it means. Removing or renaming attributes was not tested.
Where it runs, and how you leave
This page ran on DuckDB only. The same model deploys to DuckDB on your laptop and to PostgreSQL, BigQuery or Snowflake; mapping expressions are SQL in each database's dialect, and the connected check shows what to adapt.
The outputs are ordinary tables and views any tool can read. Loading still needs daana execute. Who owns what says that existing tooling loads source tables and your scheduler runs daana execute.
In the 1.0 release candidate, the CLI sends no usage data. The CLI contacts the Daana license service (license.daana.dev) when you run daana license activate, to sign this machine in to your account (which starts a trial) and to fetch your license. On a machine activated this way, a deploy that needs more than the free limit also refreshes the license when it is due. On Free, the CLI never contacts Daana.
Daana is closed source. There are no compatibility guarantees before 1.0.0; upgrades may need a redeploy.
The Daana plugin works with Claude Code and Codex. Your agent models with you and reviews your work. The plugin is MIT-licensed and installable from GitHub.
Optional agent request
For the attribute, you could ask your agent:
Review the change in `bookstore-evaluate` that adds
`customer_marketing_opt_in`: four lines in `dab/model.yaml`
and two lines in `dab/mappings/customer-mapping.yaml`.
Check the definition and the source expression against
the CRM rows in `stage.customers`, and compare the loaded
values with the source. Read the files and query the
database read-only. Do not change anything.
The request was tried once, on 16 November 2026, with the plugin v0.1.1. Compare the proposed or approved change with the four model lines and their history row of 4 November 2024. Compare values with Emily's two CRM rows. The supplied YAML and queries run without an agent or plugin.
Build with Daana
Quit DuckDB. These chapters explain the results and related topics:
| Topic | Where the tutorial teaches it |
|---|---|
| One history from three source tables | Chapter 1: The history of each customer |
| How each source table dates its rows | Chapter 2: Three sources, three dates |
| An order read at its own instant | Chapter 6: Order 12 and its customer |
| The declaration and the generated SQL | Chapter 1: What the declarations replace |
An attribute added without ALTER TABLE | Chapter 3: Deploy and query the attribute |
| Pipelines skipped when no row is above the watermark | Chapter 4: Loading strategies |
| Reporting on the warehouse with DAR | Chapter 7: Reporting with DAR |
DAR (Data according to Requirements) is the reporting layer. On the full model, chapter 6 reads order 3 at one instant: whether paid, where its shipment was, and whether its customer was suspended.
Without a trial or a license, daana deploy of the full model stops before it writes anything. The developer trial is activated in the CLI with daana license activate. What you can run lists Free chapters.
The free developer trial lasts 30 days from your first activation in the CLI. After expiry: back to the free limit of 90 pipelines; data kept; loads keep running; no deploys above 90 until upgrade. Nothing is purchasable during the 1.0 release candidate. For activation, the license status, and what the CLI sends home, read Licensing and the Developer trial.
Start chapter 1 fresh in Build with Daana from the directory above bookstore-evaluate. To try Daana on your own tables, follow the existing-stack guide. Book a session with the Daana team at daana.dev/services.