restaurant-analytics — Snowflake CDC Analytics Warehouse
gitlab.com/shassan.de-group/restaurant-analytics 31-model dbt project transforming Postgres CDC events into an analytics-ready Snowflake warehouse for a multi-tenant restaurant SaaS (~50 restaurant groups, ~440 locations). ● Designed a three-layer architecture on Snowflake — bronze views over Airbyte-landed raw, silver current-state collapse, gold star schema — with 7 dimensions, 3 incremental fact tables, and a generated date dimension. ● Collapsed append-only CDC streams to current state using LSN-ordered dedupe windows rather than updated_at, which is non-monotonic under concurrent writers; implemented soft-delete propagation and cross-batch tenant lookup to preserve the tenant invariant through DELETE-only batches under REPLICA IDENTITY DEFAULT. ● Built incremental materializations on LSN watermarks so reruns process only new change events, with no-op runs merging zero rows. ● Authored reusable dbt macros: a parameterised business-date function converting UTC timestamps to local trading days with per-location cutoff handling across US and Canadian timezones, and a schema-name override giving uniform layer-first schemas across dev and prod targets. ● Enforced multi-tenant isolation through every layer via composite tenant-safe joins and FK relationship tests. ● Covered the project with ~200 dbt tests — primary keys, cross-layer foreign keys, accepted-values enums, tenant relationships — executing in under 15 seconds. ● Applied Snowflake clustering keys on tenant_id across large fact and dimension models to drive micro-partition pruning on tenant-scoped queries, the dominant access pattern in a multi-tenant workload. ● Configured Snowflake role-based access (TRANSFORMER_ROLE), separate raw/dev/prod databases, a dedicated transform warehouse, and key-pair authentication. Stack: Snowflake, dbt, Airbyte, PostgreSQL, Python, SQL