---
title: "Building a cost-effective analytics stack with Modal, dlt, and dbt"
description: "Modal runs its whole analytics stack on Modal: dlt loads data from a Postgres read replica into Snowflake, dbt transforms it, and GitHub Actions handles CI/CD. dlt replaced hand-written psycopg2 code and removes manual schema definitions, Snowflake DDL and error-prone incremental logic."
url: "https://swe.quest/articles/building-a-cost-effective-analytics-stack-with-modal-dlt-and-dbt-7ea1b0034997749a"
canonical: "https://modal.com/blog/analytics-stack"
source: "Modal"
published: "2024-09-10"
difficulty: "medium"
kind: "How-to"
reading_minutes: 11
tags: ["data-pipelines","analytics","serverless","ci-cd","cost-optimization"]
---

# Building a cost-effective analytics stack with Modal, dlt, and dbt

A post on [Modal](https://swe.quest/sources/modal.md), published 2024-09-10, 11 min read, How-to. Original: [https://modal.com/blog/analytics-stack](https://modal.com/blog/analytics-stack)

## Summary

Modal runs its whole analytics stack on Modal: dlt loads data from a Postgres read replica into Snowflake, dbt transforms it, and GitHub Actions handles CI/CD. dlt replaced hand-written psycopg2 code and removes manual schema definitions, Snowflake DDL and error-prone incremental logic. One daily job loaded about 1.4M rows in 47 seconds for fractions of a cent, versus an estimated $4,738/month on Fivetran. Also covered: fanning out per-table jobs with starmap, an "Activity Schema lite" dbt modeling approach with window-function concurrency queries, and a cicd.py script that discovers and deploys Modal apps from comment flags.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Data pipelines](https://swe.quest/tags/data-pipelines.md) (Data & databases)
- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)
- [Serverless](https://swe.quest/tags/serverless.md) (Backend & APIs)
- [CI/CD](https://swe.quest/tags/ci-cd.md) (Reliability & operations)
- [Cost optimization](https://swe.quest/tags/cost-optimization.md) (Reliability & operations)

## Prerequisites

- Python ([easy posts on Python](https://swe.quest/tags/python.md?difficulty=easy))
- SQL basics ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- data warehouse concepts ([easy posts on Analytics & OLAP](https://swe.quest/tags/analytics.md?difficulty=easy))
- GitHub Actions ([easy posts on CI/CD](https://swe.quest/tags/ci-cd.md?difficulty=easy))

## Keywords

Modal, dlt, dbt, Snowflake, PostgreSQL, GitHub Actions, Activity Schema, Fivetran

## Related posts

- [My first 3 months at incident.io](https://swe.quest/articles/my-first-3-months-at-incident-io-57d9570909595399.md): incident.io · 2024-08-02 · Medium · 5 min read · Data pipelines, Analytics & OLAP, Cost optimization, CI/CD
  A new Data Engineer's first quarter rebuilding a Fivetran, BigQuery, dbt, CircleCI and Omni data stack.
- [Why you should move your ETL stack to Modal](https://swe.quest/articles/why-you-should-move-your-etl-stack-to-modal-f0b59ab318e09bd3.md): Modal · 2024-04-18 · Medium · 6 min read · Data pipelines, Serverless, Cost optimization, Python
  Modal's serverless Python functions can replace ETL vendors and orchestrators for simple batch jobs.
- [A modern data stack for startups](https://swe.quest/articles/a-modern-data-stack-for-startups-20644b674a9fc96e.md): incident.io · 2022-01-25 · Medium · 15 min read · Data pipelines, Analytics & OLAP, PostgreSQL
  A small startup data stack built in two weeks: Fivetran (plus Stitch for connectors Fivetran lacks, like the Close CRM) extracts data into BigQuery, dbt transforms it, and Metabase lets non-engineers explore it without SQL.
- [How SproutMe Cut Integration Test Time by 92.9% with DuckDB](https://swe.quest/articles/how-sproutme-cut-integration-test-time-by-92-9-with-duckdb-9ab70e2382f9172c.md): DuckDB · 2026-11-24 · Medium · 5 min read · Testing, Analytics & OLAP, CI/CD, Data pipelines, Developer productivity
  SproutMe runs its Dagster + dbt ad-analytics pipeline against a local DuckDB file for development and CI while keeping BigQuery in production, switching targets via environment variables (including forcing TZ=UTC to match BigQuery timestamp semantics).
- [Updating our data stack](https://swe.quest/articles/updating-our-data-stack-8fc5fea19caac0a4.md): incident.io · 2022-08-24 · Medium · 12 min read · Data pipelines, Analytics & OLAP, CI/CD, SQL
  incident.io's two-person data team reworked its BigQuery/dbt analytics stack as the company grew from 10 to 30 people.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
