Skip to main content

Definition

The SQL query return rows test allows you to write custom WHERE conditions to filter your data and set thresholds based on the number of rows that match your criteria. This test counts the rows that satisfy your specified conditions and compares the count against your defined thresholds. You write the filtering condition without the WHERE keyword - the system automatically applies it to your dataset as df.

Taxonomy

  • Task types: LLM, tabular classification, tabular regression, text classification.
  • Availability: and .

Why it matters

  • The SQL query return rows test provides a powerful way to validate data quality by counting rows that meet specific criteria.
  • You can easily identify data anomalies, outliers, or violations of business rules by setting thresholds on row counts.
  • This test is ideal for monitoring data consistency, detecting unusual patterns, or ensuring data meets expected distributions.
  • It simplifies the creation of data validation rules without requiring complex SQL knowledge - just specify the filtering conditions.

Restrictions

  • Creating this test, or editing its SQL, requires the View data permission, which Admin and Member have. Member Restricted cannot view data, so they cannot create the test or change its SQL. Changing only a threshold value on an existing test still works for them, and tests they already created keep running. See Roles and permissions.
  • The condition must not contain ; outside of string literals. It is rejected when you save the test.
  • The query that runs, with your condition applied to df, must be a single SELECT that reads only the dataset table df. Statements that write, multiple statements, table functions, and metadata or system functions are rejected, and the test fails with an error instead of running.
  • Syntax that cannot be parsed is also rejected when your data is backed by Snowflake or BigQuery. Other data runs the query in memory and accepts only one SELECT statement.
  • A query that runs longer than 300 seconds is cancelled.