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

**URL:** <https://discourse.greatexpectations.io/t/how-to-pass-an-environment-variable-to-a-checkpoint-yml-file/451>\
**Category:** Archive\
**Created:** [October 13, 2020, 8:05pm UTC](https://discourse.greatexpectations.io/t/how-to-pass-an-environment-variable-to-a-checkpoint-yml-file/451 "2020-10-13T20:05:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhcastleton](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.greatexpectations.io/bhcastleton/32/73_2.png) [@bhcastleton](https://discourse.greatexpectations.io/u/bhcastleton)\
**Post date:** [October 13, 2020, 8:05pm UTC](https://discourse.greatexpectations.io/t/how-to-pass-an-environment-variable-to-a-checkpoint-yml-file/451/1 "2020-10-13T20:05:45Z")

</div>

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

```auto
batches:
  - batch_kwargs:
      query: "SELECT * FROM table
              WHERE start = '$validation_date'"
      query_parameters:
        validation_date: ${VALIDATION_DATE}
      datasource: athena
      data_asset_name:
    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?”

---

<div class="post-metadata">

**Author:** ![eugene.mandel](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.greatexpectations.io/eugene.mandel/32/22_2.png) [@eugene.mandel](https://discourse.greatexpectations.io/u/eugene.mandel)\
**Post date:** [October 13, 2020, 11:53pm UTC](https://discourse.greatexpectations.io/t/how-to-pass-an-environment-variable-to-a-checkpoint-yml-file/451/2 "2020-10-13T23:53:02Z")

</div>

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: [https://github.com/great-expectations/great\_expectations/blob/develop/great\_expectations/init\_notebooks/sql/validation\_playground.ipynb](https://github.com/great-expectations/great_expectations/blob/develop/great_expectations/init_notebooks/sql/validation_playground.ipynb)
