
CEO & Co-founder of Visivo
How to Implement CI/CD in Analytics for Reliable Pipelines
Master CI/CD implementation for analytics projects to achieve reliable data pipelines, faster releases, and immediate error detection.

Continuous Integration and Continuous Delivery (CI/CD) changed software development by automating testing and deployment. The DORA State of DevOps Report found that elite performers deploy 208x more frequently than low performers, and recover from failures significantly faster. The same practices apply to analytics. Put every SQL model, dashboard, and metric definition through an automated pipeline and you catch errors before users see them, deploy with confidence, and ship dashboard changes the way you ship code.
What CI/CD means in analytics
Continuous Integration means every change to your analytics code is tested automatically, whether it is a SQL transformation, a dashboard configuration, or a metric definition. Continuous Delivery means a change that passes those tests is deployed to production automatically, so users always see the latest tested version.
The traditional analytics workflow is manual testing, occasional deployments, and hoping nothing breaks. According to Gartner analyst Nick Heudecker, 85% of big data projects fail because of those manual processes and the lack of proper testing. A pipeline replaces the hoping:
# .gitlab-ci.yml for analytics project
stages:
- validate
- test
- deploy
validate:sql:
stage: validate
script:
- sqlfluff lint models/
test:transformations:
stage: test
script:
- dbt test
- pytest tests/transformations/
test:dashboards:
stage: test
script:
- visivo run
- visivo test
deploy:production:
stage: deploy
script:
- visivo deploy --branch production
only:
- main
Every change, however small, passes the same checks before it reaches users.
Prerequisites for CI/CD in BI
Three things have to be in place before automation can do anything useful. Teams that treat infrastructure as code deploy significantly more often than teams with manual processes, and the same holds for analytics. Skip the prerequisites and the pipeline has nothing to run against.
Analytics code in version control. Every analytics artifact lives in Git: SQL, dashboard configuration, tests, and documentation. Our BI version control best practices guide covers the layout in depth. The short version:
analytics-repo/
├── models/
│ ├── staging/
│ │ └── stg_orders.sql
│ └── marts/
│ └── fct_revenue.sql
├── dashboards/
│ ├── executive_dashboard.yml
│ └── sales_dashboard.yml
├── tests/
│ ├── data_quality/
│ └── dashboard_validation/
└── .github/
└── workflows/
└── ci-cd-pipeline.yml
Tests for the data and for the dashboards. Test the columns at the model, and test the numbers the dashboard shows:
# models/marts/schema.yml (dbt™ data tests on the model)
models:
- name: fct_revenue
columns:
- name: revenue_amount
data_tests:
- not_null
# project.visivo.yml (Visivo tests on the computed insight values)
tests:
- name: revenue-is-never-negative
assertions:
- ">{ numpy.min( ${ref(revenue-per-day).props.y} ) >= 0 }"
- name: revenue-grains-reconcile
assertions:
- ">{ round( numpy.sum( ${ref(revenue-per-week).props.y} ) ) == round( numpy.sum( ${ref(revenue-per-month).props.y} ) ) }"
dbt™ tests check the columns of your models. visivo test checks the numbers your charts show, after visivo run computes them.
Separate environments. Keep development, staging, and production apart. In Visivo, the connection fields of a source read environment variables, so one project points at a different database in each environment:
# project.visivo.yml
sources:
- name: warehouse
type: snowflake
account: ${env.SNOWFLAKE_ACCOUNT}
warehouse: ${env.SNOWFLAKE_WAREHOUSE}
database: ${env.SNOWFLAKE_DATABASE}
username: ${env.SNOWFLAKE_USER}
password: ${env.SNOWFLAKE_PASSWORD}
Set SNOWFLAKE_DATABASE to analytics_dev in your local .env file and to analytics_staging or analytics_prod in your CI secrets. Then deploy each environment to its own branch in Visivo Cloud (visivo deploy --branch staging, visivo deploy --branch production). Refresh cadence is the schedule of the CI job that runs visivo run and visivo deploy.
Continuous integration
CI runs the tests on every commit, so an error surfaces on the change that caused it. Three pieces make it work for analytics.
Run the tests on every commit. GitHub Actions is the common choice:
# GitHub Actions workflow
name: Analytics CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
pip install dbt-snowflake visivo pytest
npm install -g sql-lint
- name: Lint SQL
run: sql-lint models/**/*.sql
- name: Run dbt tests
run: |
dbt deps
dbt seed
dbt run
dbt test
# Learn more: https://docs.getdbt.com/docs/building-a-dbt-project/tests
- name: Test dashboards
run: |
visivo compile
visivo run
visivo test
Test the transformations. Assert that each transformation produces the numbers you expect:
# tests/transformations/test_revenue.py
def test_revenue_calculation():
"""Test that revenue is calculated correctly"""
result = run_transformation("calculate_revenue")
assert result["total_revenue"] == sum(result["line_items"])
assert result["tax_amount"] == result["subtotal"] * 0.08
assert all(result["revenue"] >= 0)
def test_revenue_aggregation():
"""Test that revenue aggregates correctly by period"""
daily = run_query("SELECT SUM(revenue) FROM daily_revenue")
monthly = run_query("SELECT SUM(revenue) FROM monthly_revenue")
assert abs(daily - monthly) < 0.01 # Allow for rounding
Build the dashboards. Compile, run, and test the project, then publish a preview a reviewer can open. Our guide on testing before dashboard deployment goes deeper:
visivo compile # parse and validate the project, and build every query without running it
visivo run # run every model and insight query against your source
visivo test # assert on the computed insight values
visivo deploy --branch "$BRANCH_NAME" # publish a preview that reviewers open next to the diff
The preview branch is how a reviewer sees that the dashboard renders. When the pull request closes, visivo archive --branch "$BRANCH_NAME" archives it.
Continuous delivery
CD deploys a validated change to production with no human in the loop. According to the GitLab DevSecOps report, version control adoption increases team productivity by 40%, and an automated deploy is where a versioned project pays that back.
Deploy after the tests pass. The Visivo deployment guide has complete workflows for GitHub Actions and RWX:
# .github/workflows/deploy.yml
name: Deploy analytics
on:
push:
branches: [main]
schedule:
- cron: "0 6 * * *"
jobs:
deploy:
runs-on: ubuntu-latest
env:
SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}
SNOWFLAKE_WAREHOUSE: ${{ secrets.SNOWFLAKE_WAREHOUSE }}
SNOWFLAKE_DATABASE: analytics_prod
SNOWFLAKE_USER: ${{ secrets.SNOWFLAKE_USER }}
SNOWFLAKE_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Visivo
run: pip install visivo
- name: Run and test dashboards
run: |
visivo run
visivo test
- name: Deploy
run: visivo deploy --branch production
env:
VISIVO_TOKEN: ${{ secrets.VISIVO_TOKEN }}
visivo test fails the job when an assertion fails, so nothing reaches production until the numbers pass.
Preview before production. Show a change to reviewers before it reaches everyone. Each pull request deploys to its own branch in Visivo Cloud (visivo deploy --branch my-feature), next to production. Reviewers open the preview, compare it with production, and approve the diff and the preview together. After the merge, the same pipeline deploys to production.
Rollback. Because the project is code, a rollback is a revert. Run git revert on the bad commit and let the pipeline deploy the previous version. Visivo Cloud also keeps each deploy to a branch as a new, timestamped version, so you can open an earlier version of a dashboard and compare it with the current one (full version history is on the Platform plan).
What CI/CD gives an analytics team
Fewer incidents. Tests catch a bad number before it propagates. McKinsey Global Institute research shows that data-driven organizations are 23x more likely to acquire customers.
Faster releases. What once took days takes hours, because nobody waits for a deployment window.
Errors found in minutes. A problem surfaces on the commit that introduced it, not days later when a user complains, and a fix on a fresh commit is cheap.
Clear handoffs. The pipeline is the state of the system. Anyone on the team can see what is deployed, what is in review, and what failed.
An audit trail. Every change is logged, tested, and traceable to a commit and a reviewer.
Time back for analysis. Analysts spend less time on deployment mechanics and more on the analysis itself. According to Anaconda's State of Data Science report, data scientists spend 45% of their time on data preparation and cleaning, and CI/CD automates part of that work.
The point is trust, not automation for its own sake. When every change is tested and every deploy is validated, stakeholders stop second-guessing the numbers, and the pipeline pays for itself in incidents that never happen.
Start with one test and one automated deploy, then grow the pipeline from there. The guides on BI-as-code and reproducible BI environments cover the foundations, and /get-started is the shortest path to running the loop above on your own project.