Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contract YAML updates #2122

Open
tombaeyens opened this issue Jul 2, 2024 · 1 comment
Open

Contract YAML updates #2122

tombaeyens opened this issue Jul 2, 2024 · 1 comment

Comments

@tombaeyens
Copy link
Contributor

tombaeyens commented Jul 2, 2024

There are 2 potential contract YAML syntax updates to consider:

  1. group checks by type and force single checks for basic types like eg
checks:
  schema: skip
  freshness:
    column: created_at
  row_count:
    detect_anomaly: true

columns:
  - name: id
    checks:
      missing_values:
      invalid_values:
        valid_values: ['M']
      duplicate_values:
      sql_expressions:
        - ...
      sql_queries:
        - ...
      recon:
        other_dataset: CSTMRS
  1. model the metadata separate from the checks. moving check configurations from the central metadata.
    Goal is to create a separation for the metadata that should go to data discovery from the unit testing responsibility.

The validity configurations in contracts now reside in the checks

dataset: dim_customer

columns:
- name: last_name
  data_type: character varying
  checks:
  - type: no_invalid_values
    valid_regex: '^(?:[A-Z])$'

There is the alternative to separate the meta data from the check configuration. For example:

dataset: dim_customer

columns:
- name: id
  data_type: character varying
  duplicates: not allowed
  missing: not allowed
  valid_regex: '^(?:[A-Z])$'
  checks:
  - type: no_missing_values
  - type: no_invalid_values

The above contains the metadata:

  duplicates: not allowed
  missing: not allowed
  valid_regex: '^(?:[A-Z])$'

And this metadata is in this alternative separated from the checks that configure Soda.

This way, metadata can be pushed to a catalog without it being tied to checks. So you can indicate that a column is unique without actually checking for it. Those are 2 separate concerns.

In similar style, we could also consider the schema check to be configured as a check. Eg

dataset: dim_customer

columns:
- name: id
  ...

checks:
- type: schema

But in the schema case, currently I think the default should be that the schema is checked. I think many users will forget to include the check and assume it's checked. And then later be surprised if the check is not performed.

  1. Improve variable declarations for better tool support eg
checks_filter:
  variables:
    START_TS:
      required: true
      format: timestamp
    END_TS:
      required: true
      format: timestamp
  sql_expression:  ${START_TS} < ${TABLE_PREFIX}.'created_at' < ${END_TS}
@tools-soda
Copy link

CLOUD-8016

@tombaeyens tombaeyens changed the title Decide on validity configs Decide on validity & other configs Jul 2, 2024
@tombaeyens tombaeyens changed the title Decide on validity & other configs Decide on validity & other metadata configs Jul 2, 2024
@tombaeyens tombaeyens changed the title Decide on validity & other metadata configs Contract YAML updates Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Goals
Development

No branches or pull requests

2 participants