-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[DOCS] Add an Expectation using the GX Cloud API #11567
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
Open
r34ctor
wants to merge
35
commits into
develop
Choose a base branch
from
DOC-1187_add_expectation_with_api
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+201
−21
Open
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
d9bd351
Initial commit for structure and prereqs
r34ctor cc0c4de
Fix tab structure
r34ctor 16a0f45
Merge branch 'develop' into DOC-1187_add_expectation_with_api
r34ctor c236d4a
Create structure
r34ctor 2f03274
Add steps
r34ctor 6af1d26
Include example code
r34ctor a3367a4
Add steps for the suite
r34ctor ae209b1
Merge branch 'develop' into DOC-1187_add_expectation_with_api
r34ctor 8702b3d
Add next steps and small clean up
r34ctor 0b2621e
Fix link
r34ctor 350628d
Fix link
r34ctor 40089d2
Merge branch 'develop' into DOC-1187_add_expectation_with_api
r34ctor d3a6a07
Add prereq for cloud context
r34ctor 3991a04
Update Expectation Suite description
r34ctor dade731
Update intro
r34ctor b0d3261
Add Expectations that are only configurable through the API
r34ctor efd00e0
Merge branch 'develop' into DOC-1187_add_expectation_with_api
r34ctor 805dc6b
Move asterisks
r34ctor 99fe384
Merge branch 'develop' into DOC-1187_add_expectation_with_api
r34ctor cc9501c
Clean up
r34ctor 1c9f747
Merge branch 'develop' into DOC-1187_add_expectation_with_api
r34ctor 481cd62
Add section for row conditions
r34ctor ccf8c89
Merge branch 'develop' into DOC-1187_add_expectation_with_api
r34ctor 7e4e758
Merge branch 'develop' into DOC-1187_add_expectation_with_api
r34ctor 4ba3cab
Clean up
r34ctor 08a0993
Merge branch 'develop' into DOC-1187_add_expectation_with_api
r34ctor 447c3f8
Apply suggestions from code review
r34ctor 535570e
Add sample code to test suite
r34ctor 26687b3
Remove full code example snippet
r34ctor 53fa47b
Update anchor links
r34ctor 47c5aaf
Remove prerequisites sub-headers
r34ctor d2d8934
Remove optional section
r34ctor ff470fe
Fix build problem?
r34ctor 5abf813
Fix build problem?
r34ctor 45953a7
Fix indent?
r34ctor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
48 changes: 48 additions & 0 deletions
48
docs/docusaurus/docs/cloud/expectations/examples/create_an_expectation.py
This file contains hidden or 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,48 @@ | ||
| """ | ||
| This is an example script for creating an expectation with preset parameters. | ||
|
|
||
| To test, run: | ||
| pytest --docs-tests -k "doc_example_create_an_expectation_for_cloud" tests/integration/test_script_runner.py | ||
| """ | ||
|
|
||
|
|
||
| def set_up_context_for_example(context): | ||
| pass | ||
|
|
||
|
|
||
| # EXAMPLE SCRIPT STARTS HERE: | ||
| import great_expectations as gx | ||
|
|
||
| context = gx.get_context() | ||
| # Hide this | ||
| set_up_context_for_example(context) | ||
|
|
||
| # All Expectations are found in the `gx.expectations` module. | ||
| # This Expectation has all values set in advance: | ||
| # <snippet name="docs/docusaurus/docs/cloud/expectations/examples/create_an_expectation.py - preset expectation"> | ||
| expectation = gx.expectations.ExpectColumnMaxToBeBetween( | ||
| column="passenger_count", min_value=1, max_value=6, severity="warning" | ||
| ) | ||
| # </snippet> | ||
|
|
||
| # Expectations need to be added to an Expectation Suite before being associated with a Data Asset. | ||
| # Create the Expectation Suite and add it to your Data Context | ||
| # <snippet name="docs/docusaurus/docs/cloud/expectations/examples/create_an_expectation.py - create expectation suite"> | ||
| suite_name = "my_expectation_suite" | ||
| suite = gx.ExpectationSuite(name=suite_name) | ||
| context.suites.add(suite) | ||
| # </snippet> | ||
|
|
||
| # Optional. If you have an existing Expectation Suite you'd like to use, get it from the Data Context. | ||
| # <snippet name="docs/docusaurus/docs/cloud/expectations/examples/create_an_expectation.py - get expectation suite"> | ||
| existing_suite_name = ( | ||
| "my_expectation_suite" # replace this with the name of your Expectation Suite | ||
| ) | ||
| suite = context.suites.get(name=existing_suite_name) | ||
| # </snippet> | ||
|
|
||
| # Add the Expectation to the Expectation Suite. | ||
| # <snippet name="docs/docusaurus/docs/cloud/expectations/examples/create_an_expectation.py - add expectation to suite"> | ||
| suite.add_expectation(expectation) | ||
r34ctor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| suite.save() | ||
| # </snippet> | ||
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this new code sample file needs to be added to docs/docusaurus/docs/components/examples_under_test.py to be tested as part of CI