Select Tables and Columns for a Template Test (Metadata Driven)

Prev Next

On a Metadata Driven template test, the Metadata Selection tab decides which tables or columns get a child test. Use Filters selects every catalog object that matches your rules. Select Objects is a list you pick by name.

Both read the catalog of the data source chosen in Where to get the data on the Test Definition tab. Until a data source is chosen there, the tab says metadata cannot be selected. The template's Target Object Type decides whether you are selecting tables or columns.

Filters or a list?

Use Filters Select Objects
You describe A rule, such as "every table in the Sales schema" The exact objects
New tables in the catalog Picked up at the next materialize Not picked up until you add them
Dropped tables Leave the selection at the next materialize Stay in the list and are reported as not found
Offered in the Catalog Test Wizard No Yes, with Enable Adding from Catalog
Best for Coverage that should grow with the source A hand-picked set, or a quick test

Most templates should use filters. A rule written once keeps covering the source as it grows, which is the reason to use a template.

Select with filters

  1. Open the template and go to the Metadata Selection tab.
  2. Choose Use Filters.
  3. Click Add Filter.
  4. Choose a Field, an Operator and the Criteria, and save the filter.
  5. Add more filters if you need them. An object must match every filter.
  6. Click Preview Objects. The Object Selection Preview dialog lists every object the filters match.
  7. Save the template, then materialize it to create the child tests. See Materialize Child Tests.

The Metadata Selection tab with Use Filters and one filter, Table Type Equals Table, with Add Filter and Preview Objects highlighted

The Object Selection Preview dialog listing the 49 tables the filter selects, with schema, table, type and record count

Example: every base table

The template Wholesale Row Counts Match the Warehouse compares the row count of each table in the Wholesale Distribution System with its warehouse copy. It uses one filter:

Field Operator Criteria
Table Type Equals Table

That selects the 49 base tables in the source and leaves out the three views in the Website schema, which the warehouse does not copy. When the source team adds a 50th table and the catalog is ingested again, the filter matches it, and the next materialize creates its child test.

Example: only the tables someone marked

Sometimes the rule is "the tables the data team says need it". Mark those tables in the Catalog with a tag, such as Reconciliation Needed in Table Tags, and filter on the mark:

Field Operator Criteria
Table Tags Contains Any Of Reconciliation Needed

Adding the tag to another table in the Catalog is then all it takes to bring that table under test. The Key-Based Reconciliation pack selects its tables this way: see Key-Based Reconciliation Test Pack.

Filter fields

Field Level Operators
Schema Name Schema Equals, Not Equals, Contains, Does Not Contain, Starts With, Does Not Start With, Ends With, Does Not End With
Table Name Table The same text operators
Table Record Count Table Equals, Not Equals, Less Than, Greater Than, Less Than Or Equal, Greater Than Or Equal
Table Type Table Equals, Not Equals (Table or View)
Column Name Column The text operators
Column Data Type Column The text operators, against the type name in the source, such as nvarchar
Column Mapped Type Column Is Any Of, Is None Of, Is Known, Is Unknown, against Validatar's data types
Column Nullable, Column Identity, Column Primary Key Column Equals (yes or no)
Column Max Length Column The number operators
Custom fields Schema, Table or Column Depends on the field type, and every type adds Is Known and Is Unknown. Text: the text operators. Dropdown: Is Any Of, Is None Of. Tags: Equals, Contains Any Of, Contains All Of, Does Not Contain. Date: On, Before, After, On Or Before, On Or After

Rules that decide what a set of filters matches:

  • Filters combine with AND. The only OR is a list of values inside one filter, as with Is Any Of or Contains Any Of. To cover two schemas, use a tag or a custom field both sets of tables share, or use Select Objects.
  • A column filter has no effect on a Table template. It neither selects tables that have a matching column nor trims anything inside each child.
  • Tag filters match whole tags. Contains Any Of Reconciliation Needed matches that tag and not Reconciliation Needed Later.
  • Is Known on a custom field selects every object where someone filled the field in, which makes any catalog field usable as an opt-in mark.

Convert to Static List turns whatever the filters match right now into a Select Objects list. Use it when you want to freeze the set, then remove a few objects by hand.

Pick objects by name

  1. On the Metadata Selection tab, choose Select Objects.
  2. Click Search for metadata.
  3. Type part of a name and tick each table or column you want.
  4. Close the search. Metadata List shows how many objects are selected.
  5. Save the template.

In the list, click the cross on a row to remove that object, and the arrow on a removed row to restore it. Clear Items empties the list. A warning icon on a row means that object is no longer in the ingested catalog. If the template has test variables, the list shows each object's values; values set through the Catalog Test Wizard appear here.

Enable Adding from Catalog makes the template a quick test. People looking at a table or column of this data source in the Catalog can then add it from the Test Wizard, which puts that object on this list and creates its child test. See Add Quick Tests from the Catalog.

The Metadata Selection tab with Select Objects chosen: a Metadata List of Sales.Customers, Sales.Invoices and Sales.Orders, with Search for metadata and Enable Adding from Catalog highlighted

How new and dropped tables are handled

Filters are evaluated each time the template materializes, against the catalog as it is at that moment. So the order is:

  1. The source gains or loses a table.
  2. Metadata ingestion updates the catalog. See Ingesting Schema Metadata.
  3. The template materializes. A new table that matches gets a child test. A table that no longer matches loses its child test, but only if Delete all child tests for objects no longer selected in metadata is ticked.

A job step can materialize the template and run its child tests together every night: tick Materialize child tests before execution on the template's step. See Create a Job.

With Select Objects, nothing is added automatically. If a selected object is gone from the catalog, materializing reports how many selected metadata objects could not be found, and creates no child test for them.

Warning: if a filter suddenly matches nothing, for example after the data source was re-ingested from an empty schema, a materialize with Delete all child tests for objects no longer selected in metadata ticked deletes every child test. Click Preview Objects before you materialize after a change to the filters or the source.

Validatar AI

The Validatar AI chat (Validatar Cloud, beta) can create a new template test with its selection, but it cannot change the selection of an existing template and it cannot materialize. Change the selection on this tab yourself. To have the AI create a template, see Create a Template Test.

Troubleshooting

Symptom Cause Fix
The tab says metadata cannot be selected No data source in Where to get the data Choose the data source on the Test Definition tab
Preview Objects shows nothing The filters exclude everything, or the catalog for the data source is empty Remove filters one at a time to find the one that excludes everything; ingest the data source
A column filter on a table template changes nothing Column filters do not apply to Table templates Filter on a table field or a table-level tag instead
A new table did not get a child test The catalog was not ingested again, or the template was not materialized since Ingest, then materialize; or add a materialize to the job step
A table you removed still has a child test Delete all child tests for objects no longer selected in metadata was not ticked Materialize again with that option ticked