Build a Sigma dashboard
Load Soda Cloud check and dataset results into PostgreSQL with the Soda Cloud API, and build a data quality dashboard on them in Sigma.
This guide shows how to build a data quality dashboard in Sigma from your Soda Cloud results. Sigma reads data from a warehouse, not from an API, so a short Python script copies the results of every dataset and check from the Soda Cloud API into two PostgreSQL tables. A Sigma workbook then reports on those tables.
Use the example as a starting point: the same approach works with any warehouse Sigma connects to.
Prerequisites
A Soda Cloud API key. See Generate API keys.
A PostgreSQL database that Sigma can connect to, and a user that can create a schema and tables in it
A Sigma account that can create workbooks, and a Sigma connection to the database, or permission to create one
Load the results into PostgreSQL
The script reads every page of GET /api/v1/datasets and GET /api/v1/checks, and replaces the content of two tables:
datasets_report
dataset
ID, name, qualified name, data source, health status, number of checks, last update, Soda Cloud link
checks_report
check
ID, name, dataset, column, latest evaluation status (pass, warn, fail, or notEvaluated), last run time, check attributes as JSON, Soda Cloud link
Each row also records when the script extracted it.
"""Copy Soda Cloud dataset and check results into PostgreSQL for Sigma."""
import json
import os
import time
from datetime import datetime, timezone
import psycopg
import requests
SODA = os.environ["SODA_CLOUD_HOST"].rstrip("/") + "/api/v1"
AUTH = (os.environ["SODA_CLOUD_API_KEY_ID"], os.environ["SODA_CLOUD_API_KEY_SECRET"])
SCHEMA = os.environ.get("POSTGRES_SCHEMA", "soda_reporting")
def get_all(path: str) -> list[dict]:
"""Read every page of a Soda Cloud list endpoint."""
rows, page = [], 0
while True:
response = requests.get(f"{SODA}/{path}", auth=AUTH, params={"page": page, "size": 100})
if response.status_code == 429:
time.sleep(int(response.headers.get("Retry-After", "10")))
continue
response.raise_for_status()
body = response.json()
rows.extend(body["content"])
page += 1
if page >= body["totalPages"]:
return rows
def main() -> None:
extracted_at = datetime.now(timezone.utc)
datasets = get_all("datasets")
checks = get_all("checks")
with psycopg.connect(
host=os.environ["POSTGRES_HOST"],
port=os.environ.get("POSTGRES_PORT", "5432"),
user=os.environ["POSTGRES_USER"],
password=os.environ["POSTGRES_PASSWORD"],
dbname=os.environ["POSTGRES_DATABASE"],
) as conn, conn.cursor() as cur:
cur.execute(f"CREATE SCHEMA IF NOT EXISTS {SCHEMA}")
cur.execute(f"""
CREATE TABLE IF NOT EXISTS {SCHEMA}.datasets_report (
dataset_id text PRIMARY KEY, dataset_name text, qualified_name text,
data_source text, health_status integer, checks integer,
last_updated timestamptz, cloud_url text, extracted_at timestamptz)""")
cur.execute(f"""
CREATE TABLE IF NOT EXISTS {SCHEMA}.checks_report (
check_id text PRIMARY KEY, check_name text, dataset_id text,
dataset_name text, column_name text, evaluation_status text,
last_check_run_time timestamptz, attributes jsonb, cloud_url text,
extracted_at timestamptz)""")
cur.execute(f"TRUNCATE {SCHEMA}.datasets_report, {SCHEMA}.checks_report")
cur.executemany(
f"INSERT INTO {SCHEMA}.datasets_report VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
[(d["id"], d["name"], d.get("qualifiedName"), (d.get("datasource") or {}).get("name"),
d.get("healthStatus"), d.get("checks"), d.get("lastUpdated"), d.get("cloudUrl"),
extracted_at) for d in datasets],
)
cur.executemany(
f"INSERT INTO {SCHEMA}.checks_report VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
[(c["id"], c["name"], (c.get("datasets") or [{}])[0].get("id"),
(c.get("datasets") or [{}])[0].get("name"), c.get("column"),
c.get("evaluationStatus"), c.get("lastCheckRunTime"),
json.dumps(c.get("attributes") or {}), c.get("cloudUrl"), extracted_at)
for c in checks],
)
print(f"Loaded {len(datasets)} datasets and {len(checks)} checks into {SCHEMA}")
if __name__ == "__main__":
main()Install the two packages the script uses, set the environment variables, and run it:
Use https://cloud.soda.io for SODA_CLOUD_HOST if your organization is in the EU region. The script prints how many datasets and checks it loaded.
To keep the dashboard current, run the script on a schedule, for example in the same orchestrator that runs your other data jobs.
For every field the endpoints return, see the Soda Cloud REST API.
Connect Sigma to the database
If Sigma doesn't have a connection to the database yet, an admin creates one. See Connect to PostgreSQL in the Sigma documentation.
If the connection already exists, open it from Connections and click Sync connection metadata, so that Sigma lists the new schema and tables.
Build the workbook
Create a workbook and add the two tables from the connection as data elements. See Create a workbook in the Sigma documentation.
On top of the tables, build the elements of your dashboard. For example:
A KPI chart with the share of checks that pass, with the formula
CountIf([Evaluation Status] = "pass") / Count()formatted as a percentage. See Build a KPI chart.A bar chart with the number of checks per dataset, colored by evaluation status. See Build a bar chart.
A table of failing checks, with the Soda Cloud link of each check, so a reader can open the check's history in one click.

Next steps
Use check attributes to group the dashboard by team or domain. See Check and dataset attributes.
Read the full API reference for more fields to report on. See Soda Cloud REST API.
Last updated
Was this helpful?
