How to run a Checkpoint in python

This article is for comments to: https://docs.greatexpectations.io/en/latest/how_to_guides/validation/how_to_run_a_checkpoint_in_python.html

Please comment +1 if this How to is important to you.

on Windows I get an error when generating the python script this way.

  File "run_staging.chk.py", line 31
    context = DataContext("C:\***\***\***\ge_example\great_expectations")
                          ^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

i resolved by changing the line 31 from:

context = DataContext("C:\***\ge_example\great_expectations")

to adding the r:

context = DataContext(r"C:\***\ge_example\great_expectations")

this is because without the r windows thinks that the letter after \ is a special character.
Should be a easy fix.

1 Like

The example is incorrect.
for batch in checkpoint["batches"]:

It should be
for batch in checkpoint.batches

1 Like

@nok Would you like to create a PR with the fix? Thank you!

sure, but I want to make sure this is not a bug.

As the old version of ge did use the dictionary key style to access.

In latest version, the legacy batch API requires to use the dot to access instead.

I feel we should fix the LegacyBatchAPI instead of changing the doc here?