Skip to main content

ETL & integration

ETL and integration roles move data between systems reliably: from operational databases, partner files and APIs into the warehouse, and sometimes back out. Interviews are SQL-heavy and scenario-driven: "a file arrived late", "3% of rows were rejected", "implement this mapping", "rerun yesterday's load safely". Coding is usually lighter than for platform roles; questions about specific tools are common.

The load patterns​

PatternHow it worksUse whenWatch out for
Full reloadTruncate and reload everythingSmall tables, or no reliable change markerCost and runtime as data grows; a brief empty table unless you swap atomically
Incremental by watermarkPull rows with updated_at after the last successful runThe source has a trustworthy update timestampLate or backdated updates; equal timestamps at the boundary (overlap a little and upsert)
CDCRead the database's change log (inserts, updates, deletes)Large or busy tables, or you need deletesOrdering, schema changes, the initial snapshot
File feedsPartners or systems drop files on a scheduleExternal parties, legacy systemsMissing, late, duplicate or truncated files; layout changes

Whatever the pattern, make the load idempotent: running it twice for the same input gives the same result (upsert by key, or overwrite the date partition in one transaction). Resends, retries and backfills then become routine.

Validation and rejects​

  1. File-level checks first: the expected file arrived, once, on time, complete (header and trailer counts or a manifest), with the right layout. If any fails, stop the whole file.
  2. Row-level checks: required keys present, types and formats parse, codes are known. Give each rejected row one reason in a defined order.
  3. Quarantine, don't drop. Write rejects to a table with file, line number, reason and the raw content, report them to the source, and reprocess fixed rows.
  4. Threshold. Load the valid rows only if the reject rate is normal. A spike usually means a format change, and loading the rest would publish a partial picture.

Change detection and upserts​

  • Deduplicate first: one row per key (the latest), or MERGE will fail or behave unpredictably.
  • Trim and normalize keys before matching, or padded codes become new records.
  • Compare NULL-safely: a <> b is NULL when either side is NULL. Use IS DISTINCT FROM, COALESCE on both sides, or a row hash.
  • Type 1 vs type 2: overwrite changed attributes, or close the current version and insert a new one. See the SCD cheatsheet.

ETL tools and ELT​

Traditional ETL tools are visual and run transformations on their own servers:

  • Informatica PowerCenter: mappings run by sessions inside workflows.
  • SSIS: packages with control flows and data flows.
  • Azure Data Factory: pipelines of activities, plus mapping data flows.

Pushdown turns parts of a mapping into SQL that runs in the database instead. ELT loads raw data first and transforms it with SQL in the warehouse (often with dbt), so transformations scale with the warehouse, are versioned and tested, and can be rerun from raw data.

Schedulers such as Control-M and Autosys often hold the real dependency graph, so include them in any migration inventory.

Practice on messy files​

The integration dataset in the SQL playground is a month of raw daily CRM files exactly as an ETL team receives them. It has a missing day, a resent file, late and truncated deliveries, and lines with blank codes, bad emails and unparseable timestamps. The SQL questions below use it.

Related questions elsewhere in the bank:

Then try the incident drills "The partner's file didn't arrive" and "The reject rate jumped to 30%".

Common traps​

  • Loading a resent file on top of the original instead of replacing it.
  • Assuming a file is complete because it exists; check the trailer or manifest.
  • Loading late files under the arrival date instead of their business date.
  • CAST on raw text that fails the whole load on one bad value; use safe parsing and rejects.
  • Comparing columns with <> when either side can be NULL.

Further reading​