The Close: Week 5

The Close

Next drop Monday Oct 19, 16:00 UTC

Week 5

hosted bydatadriven

Results

next drop

13 scored

66 submissions

first in shparky, 2d 0h

Your DAG2026-10-17 · night 30 of 30

raw_payments281,166 rows
raw_fx_rates350 rows
raw_merchants18,487 rows
payments_history
fx_rates_history
merchants_history
fct_payments
fct_payments
  • payment_idTEXT
  • statusTEXT
  • amount_usdNUMERIC
  • settled_usdNUMERIC
  • settled_in_period_usdNUMERIC
  • captured_atTEXT
  • order_refTEXT
  • merchant_countryTEXT

The challenge

You're a data engineer at a card payments company. Every night, a job copies the day's changes from its database into 3 raw tables, which keep only recent copies. Finance is closing its books through and needs 1 clean row per payment. Write the DAG that builds that table from to : it runs on the schedule you set, and each run sees only what the raw tables hold then.

The mess

3 services write to the database, each in its own format and on its own clock, and each records only what it knows. Columns changed meaning, and old rows were never updated. Support fixes stuck payments in the database. A night that fails, or a day with wrong figures, is sent again days later. A copy can still be running when a run starts, or arrive empty. Each export tool writes NULL its own way.

Raw tables

raw_payments
raw_fx_rates
04_batch_idTEXT
05_loaded_atTEXT
raw_merchants
02nameTEXT
05_batch_idTEXT
06_loaded_atTEXT

Target table

fct_payments

Click a column for what it holds, or click the bottom of a sheet to see its sample rows.

Notes from finance

  • Test merchants are not business: their payments stay out.
  • A day with no rate uses the latest earlier rate.
  • A rate landed again replaces the one before it.
  • The landing column for metadata is 40 characters wide.

How you're scored

  • +1the right value. A right null counts.
  • 0null where the source held a value. Silence is free.
  • −1a wrong value. Silent corruption costs.
  • −2a row that should not exist: no matching key, or a second row for the same key. The last row for a key is the one scored.
Questions go in this week's thread.