Building a cost-effective analytics stack with Modal, dlt, and dbt
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.
Related posts
- My first 3 months at incident.io
incident.io mediumAdeptA new Data Engineer's first quarter rebuilding a Fivetran, BigQuery, dbt, CircleCI and Omni data stack. Uploading dbt artifacts to GCS after each production run enabled `defer` for local development and `state:modified` for faster, more reliable CI. Prebuilt Docker images of the dbt repo replaced per-job environment setup. Google Datastream, Stitch and Airbyte all cost more than Fivetran because the Cloud SQL Postgres workload is upsert-heavy, so Fivetran stayed. Clustering Fivetran destination tables by primary key cut their BigQuery cost by about 75%, and making heavy dbt models incremental with enforced partitioning cut dbt costs by about 20%.
- Why you should move your ETL stack to Modal
Modal mediumAdept
Modal's serverless Python functions can replace ETL vendors and orchestrators for simple batch jobs. A worked example copies 12M ClickHouse rows into Snowflake in 16 minutes for about $0.29, using five parallel per-date jobs via for_each and 10,000-row executemany batches under Snowflake's 16,384-row insert limit. Fivetran pricing for the same volume is estimated at roughly $3,300. A second example enriches warehouse users with company data from the GitHub API on a cron schedule, while Fivetran and Airflow are still recommended for common connectors and long-running multi-stage pipelines that need partial retries and observability.
- A modern data stack for startups
incident.io mediumAdeptA 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. The dbt project skips 'base' models and goes straight to staging tables, producing dimension and fact marts only when joining across sources or doing complex transforms, which keeps schema maintenance low. Other practical details: Fivetran's xmin-cursor fallback for Heroku Postgres without logical replication, per-engineer BigQuery dev datasets, and using dbt-metabase to turn dbt relationship tests into Metabase foreign keys so joins auto-fill.
- How SproutMe Cut Integration Test Time by 92.9% with DuckDB
DuckDB mediumAdeptSproutMe 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). Across 88 CI runs the per-merge integration test step dropped from a median 639 s to 45.6 s (92.9%), and local dbt backfill and incremental builds were 42–60% faster. CI builds the whole dbt project on DuckDB from committed fixtures and compares selected models to golden files. The gains are scoped to the dev/test workflow and are not a general engine comparison; production migration would need separate evaluation.
- Updating our data stack
incident.io mediumAdeptincident.io's two-person data team reworked its BigQuery/dbt analytics stack as the company grew from 10 to 30 people. Fivetran moved to a separate BigQuery project after dbt tests in CI timed out because concurrent interactive queries exceeded BigQuery's 100-query quota. A CircleCI queue orb now serialises overlapping dbt runs that were creating and dropping the same tables. Unreliable GOOGLEFINANCE FX rates were replaced with a version-controlled seed plus a daily APILayer pull, checked by uniqueness and gaplessness tests. Models now materialise as tables rather than views, intermediate models sit between staging and fact/dimension models to avoid duplicated logic, SQLFluff enforces formatting, and Metabase folders separate sandbox work from locked-down core dashboards.