Skip to the page
Tecyfy

Data engineering in the AI era · intermediate · About 10 minutes

The new column that only exists in development

The shop's orders now carry a discount. You added it to the orders model, development and CI passed, and the first production run failed with "column discount_amount does not exist".

You look after the dbt project that builds the shop's revenue tables.

What happened

On 1 September the shop's checkout started recording a discount on each order, in a new column discount_amount in the source table raw_shop.orders. On 14 October you added the column to the orders model and wrote net revenue as amount minus discount.

Your development run built everything. CI built everything. The production run that night failed, and the morning revenue report did not refresh.

The incident is made up. How things work in it is real, with sources at the end.

The evidence

Everything you need is here. Read it before you decide.

01The orders model(Code)
-- models/marts/fct_orders.sql
{{ config(materialized='incremental', unique_key='order_id') }}

select order_id, customer_id, ordered_at, amount, discount_amount
from {{ ref('stg_orders') }}
{% if is_incremental() %}
  where ordered_at > (select max(ordered_at) from {{ this }})
{% endif %}
02The model that failed(Code)
-- models/marts/fct_net_revenue.sql
select date(ordered_at) as day,
       sum(amount - coalesce(discount_amount, 0)) as net_revenue
from {{ ref('fct_orders') }}
group by 1
03The production run(Log)
  1. 02:00:04info1 of 3 OK created sql view model analytics.stg_orders
  2. 02:00:41info2 of 3 OK created sql incremental model analytics.fct_orders (9,812 rows)
  3. 02:00:43error3 of 3 ERROR creating sql table model analytics.fct_net_revenue: column "discount_amount" does not exist
04The orders table in each environment(Table)
DevelopmentCIProduction
How it was builtFrom scratchFrom scratchIncremental, since March 2025
Has `discount_amount`yesyesno
Rows38.2M38.2M38.2M

Your decisions

Decision 1 of 3

  1. Decision 1

    Why did production fail when development and CI passed?

The ideas behind it

Sources

Where each fact comes from

  1. 1Configure incremental models