-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DOCS] Adds guidance around Checkpoints in 1.0 (#9675)
Co-authored-by: Rob Gray <104205257+kwcanuck@users.noreply.github.com>
- Loading branch information
1 parent
ab02092
commit eff37b8
Showing
10 changed files
with
428 additions
and
42 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
docs/docusaurus/docs/core/validate_data/checkpoints/_examples/create_a_checkpoint.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
""" | ||
This example script demonstrates how to create a Checkpoint and add it | ||
to a Data Context. | ||
The <snippet> tags are used to insert the corresponding code into | ||
GX documentation, and you can disregard them. | ||
""" | ||
|
||
# <snippet name="/core/validate_data/checkpoints/_examples/create_a_checkpoint.py full script"> | ||
# highlight-start | ||
# <snippet name="/core/validate_data/checkpoints/_examples/create_a_checkpoint.py import statements"> | ||
import great_expectations as gx | ||
from great_expectations.core import Checkpoint | ||
# </snippet> | ||
# highlight-end | ||
|
||
context = gx.get_context() | ||
|
||
validation_definition_name = "my_existing_validation_definition" | ||
validation_definition = context.validation_definitions.get(name=validation_definition_name) | ||
|
||
validation_definitions = [validation_definition] | ||
# <snippet name="/core/validate_data/checkpoints/_examples/create_a_checkpoint.py determine actions"> | ||
actions = [gx.UpdateDataDocs(...), gx.SlackNotification(...)] | ||
# </snippet> | ||
# <snippet name="/core/validate_data/checkpoints/_examples/create_a_checkpoint.py create checkpoint"> | ||
checkpoint_name = "my_checkpoint" | ||
|
||
# highlight-start | ||
checkpoint = Checkpoint( | ||
name=checkpoint_name, | ||
validations=validation_definitions, | ||
actions=actions | ||
) | ||
# highlight-end | ||
# </snippet> | ||
|
||
# highlight-start | ||
# <snippet name="/core/validate_data/checkpoints/_examples/create_a_checkpoint.py add checkpoint"> | ||
context.checkpoints.add(checkpoint) | ||
# </snippet> | ||
# highlight-end | ||
# </snippet> |
21 changes: 21 additions & 0 deletions
21
docs/docusaurus/docs/core/validate_data/checkpoints/_examples/delete_a_checkpoint.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
""" | ||
This example script demonstrates how to retrieve an existing Checkpoint | ||
from a Data Context and then delete it from the Data Context configuration. | ||
The <snippet> tags are used to insert the corresponding code into | ||
GX documentation, and you can disregard them. | ||
""" | ||
|
||
# <snippet name="/core/validate_data/checkpoints/_examples/delete_a_checkpoint.py full example script"> | ||
import great_expectations as gx | ||
|
||
context = gx.get_context() | ||
|
||
# <snippet name="/core/validate_data/checkpoints/_examples/delete_a_checkpoint.py delete checkpoint"> | ||
checkpoint_name = "my_checkpoint" | ||
# highlight-start | ||
context.checkpoints.delete(name=checkpoint_name) | ||
# highlight-end | ||
# </snippet> | ||
# </snippet> |
21 changes: 21 additions & 0 deletions
21
docs/docusaurus/docs/core/validate_data/checkpoints/_examples/get_checkpoint_by_name.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
""" | ||
This example script demonstrates how to retrieve an existing Checkpoint | ||
from a Data Context by name. | ||
The <snippet> tags are used to insert the corresponding code into | ||
GX documentation, and you can disregard them. | ||
""" | ||
|
||
# <snippet name="/core/validate_data/checkpoints/_examples/get_checkpoint_by_name.py full example script"> | ||
import great_expectations as gx | ||
|
||
context = gx.get_context() | ||
|
||
# <snippet name="/core/validate_data/checkpoints/_examples/get_checkpoint_by_name.py get checkpoint by name"> | ||
checkpoint_name = "my_checkpoint" | ||
# highlight-start | ||
checkpoint = context.checkpoints.get(name=checkpoint_name) | ||
# highlight-end | ||
# </snippet> | ||
# </snippet> |
24 changes: 24 additions & 0 deletions
24
...docusaurus/docs/core/validate_data/checkpoints/_examples/get_checkpoints_by_attributes.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
""" | ||
This example script demonstrates how to filter the list of Checkpoints in a | ||
Data Context on attributes. | ||
The <snippet> tags are used to insert the corresponding code into | ||
GX documentation, and you can disregard them. | ||
""" | ||
|
||
# <snippet name="/core/validate_data/checkpoints/_examples/get_checkpoints_by_attributes.py full example code"> | ||
import great_expectations as gx | ||
from great_expectations.checkpoints import SlackNotificationAction | ||
|
||
context = gx.get_context() | ||
|
||
# <snippet name="/core/validate_data/checkpoints/_examples/get_checkpoints_by_attributes.py filter checkpoints list on actions"> | ||
# highlight-start | ||
checkpoints_with_slack_alerts = [checkpoint.name for checkpoint in context.checkpoints | ||
if any(isinstance(action, SlackNotificationAction) for action in checkpoint.actions)] | ||
|
||
# highlight-end | ||
print(checkpoints_with_slack_alerts) | ||
# </snippet> | ||
# </snippet> |
21 changes: 21 additions & 0 deletions
21
docs/docusaurus/docs/core/validate_data/checkpoints/_examples/list_available_checkpoints.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
""" | ||
This example script demonstrates how to list the Checkpoints available | ||
in a Data Context and use attributes to filter the list. | ||
The <snippet> tags are used to insert the corresponding code into | ||
GX documentation, and you can disregard them. | ||
""" | ||
|
||
# <snippet name="/core/validate_data/checkpoints/_examples/list_available_checkpoints.py full example code"> | ||
import great_expectations as gx | ||
|
||
context = gx.get_context() | ||
|
||
# highlight-start | ||
# <snippet name="/core/validate_data/checkpoints/_examples/list_available_checkpoints.py print checkpoint names"> | ||
checkpoint_names = [checkpoint.name for checkpoint in context.checkpoints] | ||
print(checkpoint_names) | ||
# </snippet> | ||
# highlight-end | ||
# </snippet> |
8 changes: 8 additions & 0 deletions
8
docs/docusaurus/docs/core/validate_data/checkpoints/_examples/run_a_checkpoint.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
""" | ||
This example script demonstrates how to run a Checkpoint, how | ||
to determine what Batch Parameters and Suite Parameters to pass into the | ||
run command, and how to review the returned results. | ||
The <snippet> tags are used to insert the corresponding code into | ||
GX documentation, and you can disregard them. | ||
""" |
32 changes: 32 additions & 0 deletions
32
docs/docusaurus/docs/core/validate_data/checkpoints/_examples/update_a_checkpoint.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
""" | ||
This example script demonstrates how to update a Checkpoint's Validation Definitions | ||
and Actions list, and persist those changes to the Data Context. | ||
The <snippet> tags are used to insert the corresponding code into | ||
GX documentation, and you can disregard them. | ||
""" | ||
|
||
# <snippet name="/core/validate_data/checkpoints/_examples/update_a_checkpoint.py full example script"> | ||
import great_expectations as gx | ||
|
||
context = gx.get_context() | ||
|
||
checkpoint_name = "my_checkpoint" | ||
checkpoint = context.checkpoints.get(name=checkpoint_name) | ||
|
||
# <snippet name="/core/validate_data/checkpoints/_examples/update_a_checkpoint.py full update values"> | ||
new_validations_list = [context.validation_definitions.get(name="new_validation")] | ||
new_actions_list = [gx.UpdateDataDocs(...)] | ||
|
||
# highlight-start | ||
checkpoint.validations = new_validations_list | ||
checkpoint.actions = new_actions_list | ||
# highlight-end | ||
# </snippet> | ||
|
||
# highlight-start | ||
# <snippet name="/core/validate_data/checkpoints/_examples/update_a_checkpoint.py full save updates"> | ||
checkpoint.save() | ||
# </snippet> | ||
# highlight-end | ||
# </snippet> |
Oops, something went wrong.