Link Search Menu Expand Document

Add check attributes

Last modified on 26-Jan-23

As a Soda Cloud Admin user, you can define check attributes that your team can apply to checks when they write them in an agreement or in a checks YAML file for Soda Core.

checks for dim_product:
  - missing_count(discount) < 10:
      attributes:
        department: Marketing
        priority: 1
        tags: [event_campaign, webinar]
        pii: true
        created_at: 2022-02-20

Use attributes to organize your checks and alert notifications in Soda Cloud.

  • Apply attributes to checks to label and sort them by department, priority, location, etc.
  • Add a check attribute to define, for example, whether a check executes against personally identifiable information (PII).
  • Use the Soda Cloud Reporting API to access information about checks according to their attributes.
  • Define rules to route alert notifications according to check attributes.

Prerequisites
Define a check attribute
Apply an attribute to a check
Optional check attribute SodaCL configurations
Go further

Prerequisites

  • You have created a Soda Cloud account.
  • To define new check attributes, you must have Admin rights on your Soda Cloud account. Any Soda Cloud user or Soda Core user can apply existing attributes to new or existing checks.

Define a check attribute

Note that you can only define or edit check attributes as an Admin in Soda Cloud. You cannot define new attributes in Soda Core. Once defined in Soda Cloud, any Soda Cloud or Soda Core user can apply the attribute to new or existing checks.

  1. In your Soda Cloud account, navigate to your avatar > Attributes > New Attribute.
  2. Follow the guided steps to create the new attribute. Use the details below for insight into the values to enter in the fields in the guided steps.
Field or Label Guidance
Label Enter the key for the key:value pair that makes up the attribute. In the example above, the check attribute’s key is department and the value is marketing.
Note that though you enter a value for label that may contain spaces or uppercase characters, users must use the attribute’s NAME as the key, not the Label as Soda Cloud automatically formats the label into SodaCL-friendly syntax. Refer to the screenshot in the section below.
Resource Type Select Check to define an attribute for a check.
Type Define the type of input a check author may use for the value that pairs with the attribute’s key.
    - Single select
    - Multi select
    - Checkbox
    - Text
    - Number
    - Date
Allowed Values Applies only to Single select and Multi select. Provide a list of values that a check author may use when applying the attribute key:value pair to a check.
Description (Optional) Provide details about the check attribute to offer guidance for your fellow Soda users.

Adjust attributes

  • Once created, you cannot change the type of your attribute. For example, you cannot change a checkbox attribute into a multi-select attribute.
  • Once created, you can change the display name of an attribute.
  • For a single- or multi-select attribute, you can remove, change, or add values to the list of available selections. However, if you remove or change values on such a list, you cannot use a previous value to route alert notifications.

Apply an attribute to a check

While only a Soda Cloud Admin can define or revise check attributes, any Author user can apply attributes to new or existing checks when:

  • writing or editing checks in an agreement in Soda Cloud,
    OR
  • writing or editing checks in a checks YAML file for Soda Core.

Apply attributes to checks using key:value pairs, as in the following example which applies five Soda Cloud-created attributes to a new row_count check.

checks for dim_product:
  - row_count = 10:
      attributes:
        department: Marketing
        priority: 1
        tags: [event_campaign, webinar]
        pii: true
        best_before: 2022-02-20

During a scan, Soda validates the attribute’s input – NAME (the key in the key:value pair), Type, Allowed Values – to ensure that the key:value pairs match the expected input. If the input is unexpected, Soda evaluates no checks, and the scan results in an error. For example, if your attribute’s type is Number and the check author enters a value of one instead of 1, the scan produces an error to indicate the incorrect attribute value.

The following table outlines the expected values for each type of attribute.

Attribute type (key) Attribute value
Single select Any value that exactly matches the Allowed Values for the attribute as defined by the Soda Admin who created the attribute. Values are case sensitive.
Refer to example above in which the department attribute is a Single select attribute.
Multi select Any value(s) that exactly matches the Allowed Values for the attribute as defined by the Soda Admin who created the attribute. Values are case sensitive.
You must wrap input in square brackets, which indicates a list, when adding Multi select attribute key:value pair to a check.
Refer to example above in which the tags attribute is a Multi select attribute.
Checkbox true or false
Text string
Number integer or float
Date ISO-formatted date or datetime.

Note that users must use the attribute’s NAME as the attribute’s key in a check, not the Label as defined by a Soda Admin in Soda Cloud. Refer to screenshot below.

name-not-label

Optional check attribute SodaCL configurations

Using SodaCL, you can use variables to populate either the key or value of an existing attribute, as in the following example. Refer to Configure variables in SodaCL for further details.

checks for dim_product:
  - row_count = 10:
      attributes:
        department: ${DEPT}
        ${DEPT}_owner: Mohammed Patel

You can use attributes in checks that Soda executes as part of a for each configuration, as in the following example. Refer to Optional check configuration for further details on for each.

for each dataset T:
 datasets:
   - dim_customers
 checks:
   - row_count > 0:
        attributes:
          department: [Marketing]
          priority: 2

Go further


Was this documentation helpful?

What could we do to improve this page?


Last modified on 26-Jan-23