How to pass an environment variable to a checkpoint yml file?

Can you pass a date as env variable to the checkpoint yml file like this:

  - batch_kwargs:
      query: "SELECT * FROM table
              WHERE start = '$validation_date'"
        validation_date: ${VALIDATION_DATE}
      datasource: athena
    expectation_suite_names: # one or more suites may validate against a single batch
      - athena_table

“When I run checkpoint it does not evaluate to my local env variable, although I can do echo $VALIDATION_DATE on my terminal and see my date correctly.
How do you pass query parameter to your checkpoint yml file?”


Great Expectations supports variable substitution in great_expectations.yml and config_variables.yml files, but not in the yml config files of Checkpoints.

We are working on making it possible to pass more flexible config to Checkpoints.

In the meantime, a workaround is to use the lower level API - Validation Operator. A Checkpoint is a wrapper around a Validation Operator. You should invoke a Validation Operator from Python like in this example:

1 Like