Skip to main content

What is a Query metric?

Query metrics are defined by a SQL expression written directly by the user, enabling arbitrary business logic that cannot be expressed through configuration-based rules. They give analysts and engineers full flexibility to define quality expectations using the same SQL they already write. Type: User-defined — Query metrics are created manually. Navigate to Metric → Add and select Subcategory: Query. Query metrics answer the question: Does this data satisfy a custom quality check I can express in SQL? Prizm runs the SQL on each operational cycle, records the returned numeric value, and trends it over time. Anomaly detection activates once enough historical runs have been collected.

Parameterized Query Metrics

Any Query metric can be made parameterized by placing {{param_name}} tokens anywhere in the SQL. Instead of a hardcoded value, that position accepts a runtime input — supplied via a popup in the UI, or passed through the API or CLI.
When a parameterized metric is run from the UI, Prizm shows a parameter input popup listing every {{token}} that needs a value. Fill in the fields and click Run — Prizm validates, renders the SQL, and executes it. The resolved SQL and parameter values are stored in the audit record for every run. Parameterized metrics are visually identified in the Metrics list by a Parameterized indicator tag — making it easy to audit which metrics use dynamic SQL.

Parameter types

SOURCE parameters are always resolved automatically. CONSTANT and METADATA parameters can have defaults set at the metric level. Any parameter without a default and without a caller-supplied value blocks execution until a value is provided.

Audit record

Every execution stores a complete run record for traceability.

Metric Templates

When the same parameterized SQL logic should apply across multiple assets — each with its own parameter overrides — use a Metric Template (Rule Library). Write the rule once, assign it to many assets, and update all assignments in one edit.

Setup

Creating a query metric and adding runtime parameters.

Metric Template

Reusable parameterized rules across many assets — overview, use cases, and setup.