Arman Pouyaei Start a conversation

Blog.

39
Data Engineering Fundamentals

Capstone: backfill and the run report

The module's exam: re-running a past week safely (only possible because of bronze, keys, and gates) and the three numbers that prove a run was healthy.

Read →
38
Data Engineering Fundamentals

Serving the gold layer

Stage 4: publishing a pre-aggregated, date-partitioned gold table that DuckDB queries in place — speed designed in at publish time, not bought with a bigger server.

Read →
37
Data Engineering Fundamentals

Orchestration: the DAG runs the show

The layer that runs the stages in order, on a schedule, with retries: an Airflow DAG for the station pipeline, and what catchup=False protects you from.

Read →
36
Data Engineering Fundamentals

Incremental loads and idempotency

Process only what's new, and make re-running a window harmless: the dedupe key, keep='last', and the two-run test every pipeline must pass.

Read →
35
Data Engineering Fundamentals

Spatial enrichment: points meet polygons

Stage 3 continues: a spatial join attaches each station's county, so gold can aggregate by place — and the unmatched rows become a quality signal.

Read →
34
Data Engineering Fundamentals

Data quality gates: fail loud, fail early

A written contract for your data — columns, types, ranges, uniqueness — enforced between silver and gold with pandera, so bad data stops the run instead of reaching a map.

Read →
33
Data Engineering Fundamentals

Clean and standardize: the silver layer

Stage 3: turning nested raw GeoJSON into a flat, typed table with a geometry column and a declared CRS — the silver layer every later stage can trust.

Read →
32
Data Engineering Fundamentals

Land it raw: the bronze layer

Stage 2: saving API responses byte-for-byte, partitioned by day, before anyone cleans anything — the bronze layer as the pipeline's memory.

Read →
31
Data Engineering Fundamentals

Ingesting from an API: paginate, don't guess

Stage 1 of the pipeline: fetching a day of weather observations from the National Weather Service API — User-Agent, time windows, and following pagination links.

Read →
30
Data Engineering Fundamentals

Anatomy of a pipeline: ELT, stage by stage

One pipeline, four stages: extract, land raw, transform, serve — and why modern lakes load first and transform second (ELT).

Read →
29
Data Engineering Fundamentals

Spatial indexing: geohash and H3

Cell IDs as an index: geohash strings where a shared prefix means nearby, and H3 hexagons with equal-distance neighbours — one key to partition, group and join by place.

Read →
28
Data Engineering Fundamentals

Cloud-Optimized GeoTIFFs: read only the pixels you need

A GeoTIFF reorganised for the cloud: internal tiles plus built-in overviews, so a reader fetches only the pixels it needs instead of downloading the whole file.

Read →
27
Data Engineering Fundamentals

Raster vs. vector: grids and shapes

The two shapes of geospatial data: vector for discrete features (stations, counties), raster for continuous fields (temperature, rainfall) — and how to tell which one you have.

Read →
26
Data Engineering Fundamentals

Apache Sedona: Spark, but spatial

Sedona gives Spark a Geometry type, ST_ functions and real spatial joins — the SQL from Lesson 22, running across a cluster on GeoParquet files.

Read →
25
Data Engineering Fundamentals

Partition by place: spatial partitioning with geohashes

Lesson 15's partitioning trick, but for space: a geohash prefix becomes the partition key, so a query over one area reads only that area's folders.

Read →
24
Data Engineering Fundamentals

GeoParquet: Parquet that knows where things are

Parquet plus a geometry column: to_parquet on a GeoDataFrame writes GeoParquet — WKB geometry plus CRS and bounding-box metadata in the footer, readable by any Parquet engine.

Read →
23
Data Engineering Fundamentals

DuckDB goes spatial: no server, just a file

INSTALL spatial; LOAD spatial; turns DuckDB into a local spatial engine, and ST_Read queries a GeoJSON file as if it were a table — nearest stations, no server.

Read →
22
Data Engineering Fundamentals

Near me, in SQL: spatial filters with ST_DWithin

The spatial version of a WHERE filter: ST_DWithin finds every station within a distance of a point — longitude first, SRID 4326, and a spatial index doing the fast lookup.

Read →
21
Data Engineering Fundamentals

Read it in, write it out: read/write pipelines

The full pipeline shape in four lines: spark.read.csv raw data in, transform it, df.write.partitionBy("region").parquet clean data out — and read it back with spark.read.parquet.

Read →
20
Data Engineering Fundamentals

Join first, then summarize: aggregations + joins

Most PySpark summarizing is two moves in one order: join readings to station metadata on station_id, then groupBy + agg to one summary row per region.

Read →
19
Data Engineering Fundamentals

Nothing runs until you say so: transformations vs. actions

Transformations like filter and withColumn only build a plan — actions like show and count are what actually run it. Why laziness lets Spark optimize, and why collect() on a huge table can crash your job.

Read →
18
Data Engineering Fundamentals

Your first Spark job: SparkSession + DataFrames

PySpark starts here: one SparkSession entry point and a DataFrame — a pandas-like table that runs across a cluster instead of one machine.

Read →
17
Data Engineering Fundamentals

Only load what's new: incremental ingestion

Re-reading the whole source every run is the most expensive habit in data engineering. The watermark pattern — load only rows newer than MAX(recorded_at) — plus what watermarks can't see, and where CDC takes over.

Read →
16
Data Engineering Fundamentals

Parquet plus a ledger: open table formats

Delta Lake, Apache Iceberg, and Hudi add a transaction ledger on top of the same Parquet files. MERGE INTO upserts, ACID on the lake, time travel, and compaction — the fix for the small-files problem.

Read →
15
Data Engineering Fundamentals

Only read the folders you need: partitioning

Partitioning organizes the lake’s folder into Hive-style subfolders by the columns you filter on. PySpark partitionBy, partition pruning that skips ~119 of 120 folders, rules of thumb, and the small-files problem.

Read →
14
Data Engineering Fundamentals

Your table is a folder of files: Parquet

The data-lakes arc begins: a lake is files on object storage, and Parquet is the default file. Columnar storage, column pruning with columns=[...], built-in compression, a typed schema in the file, and the DuckDB connection.

Read →
13
Data Engineering Fundamentals

All or nothing: transactions

Transactions wrap multi-step writes into one atomic unit: BEGIN … COMMIT, ROLLBACK when it fails. The ACID promise, why pipelines wrap their writes, and the Delta Lake connection.

Read →
12
Data Engineering Fundamentals

Stop storing the same fact twice: normalization

Normalization means storing each fact once: splitting the station/region design into two tables linked by a foreign key. The 1NF/2NF/3NF rundown, update anomalies, why warehouses deliberately denormalize, and the DRY bridge.

Read →
11
Data Engineering Fundamentals

Finding rows without reading everything: indexes

An index is the database’s book index: a sorted lookup structure on a column so filters jump straight to matching rows. CREATE INDEX on the columns you filter, join, and sort on — plus the write-cost tradeoff, and the Python dict bridge.

Read →
10
Data Engineering Fundamentals

The IDs that hold tables together: primary and foreign keys

PRIMARY KEY gives every row a unique identity; REFERENCES turns the join contract between two tables into a rule the database enforces — so a bad row fails loudly at insert time instead of breaking a dashboard later.

Read →
9
Data Engineering Fundamentals

Folders inside the database: schemas

One database can hold hundreds of tables — schemas are the named folders that keep them organized. CREATE SCHEMA, the schema.table convention, and how teams split raw, weather, and geospatial tables into separate namespaces.

Read →
8
Data Engineering Fundamentals

Ranking rows without collapsing them: window functions

GROUP BY collapses rows into one per group — window functions keep every row and add a column computed across its peers. RANK() within a region, the OVER () marker, and the top-N-per-category pattern.

Read →
7
Data Engineering Fundamentals

Nesting queries with subqueries

A query inside a query: the inner one runs first and feeds its result to the outer one. The two pandas steps you do today — compute a list, then .isin() it — as one statement in the warehouse.

Read →
6
Data Engineering Fundamentals

Combining tables with JOIN

Facts in one table, context in another — JOIN stitches them together on a shared key. Pandas .merge(), done inside the warehouse.

Read →
5
Data Engineering Fundamentals

Filtering groups with HAVING

WHERE filters rows before grouping; HAVING filters groups after aggregation. And why WHERE COUNT(*) >= 5 is invalid — which is exactly why HAVING exists.

Read →
4
Data Engineering Fundamentals

One summary per group with GROUP BY

Aggregates collapse a whole table into one number — GROUP BY collapses it into one number per bucket. The per-country, per-day, per-category breakdown behind every dashboard.

Read →
3
Data Engineering Fundamentals

Summarizing data with COUNT, SUM, and AVG

How many, how much, on average: the three aggregate functions that turn a million rows into a single dashboard number.

Read →
2
Data Engineering Fundamentals

Sorting and taking the top N with ORDER BY and LIMIT

The top-N pattern: sort descending, keep a few rows. Leaderboards, latest records, biggest tables — it all starts here.

Read →
1
Data Engineering Fundamentals

Reading data with SELECT and WHERE

The first thing you do with any new table: pick columns, filter rows. SELECT is the column list, WHERE is the row filter — and it maps exactly onto pandas.

Read →