Skip to content

Commit

Permalink
[ENHANCEMENT] update list_expectation_suite_names and ExpectationSuit…
Browse files Browse the repository at this point in the history
…eValidationResult payload (#3419)

* Add ge_cloud_page.j2 template

* Add expectation_suite_id to result payload

* If context is in ge_cloud_mode, return list of ids instead of names

* black

* Rename template to page_minimal

* Update docstring
  • Loading branch information
roblim committed Sep 20, 2021
1 parent 82b3e29 commit 0007ecc
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 3 deletions.
7 changes: 7 additions & 0 deletions great_expectations/checkpoint/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,10 +758,17 @@ def _run(
if self.data_context.ge_cloud_mode and checkpoint_identifier:
contract_ge_cloud_id = checkpoint_identifier.ge_cloud_id

expectation_suite_ge_cloud_id = None
if self.data_context.ge_cloud_mode and expectation_suite_identifier:
expectation_suite_ge_cloud_id = str(
expectation_suite_identifier.ge_cloud_id
)

return_val = self.target_store.set(
validation_result_suite_identifier,
validation_result_suite,
contract_id=contract_ge_cloud_id,
expectation_suite_id=expectation_suite_ge_cloud_id,
)
if self.data_context.ge_cloud_mode:
return_val: GeCloudResourceRef
Expand Down
12 changes: 10 additions & 2 deletions great_expectations/data_context/data_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -2084,7 +2084,7 @@ def get_datasource(
return datasource

def list_expectation_suites(self):
"""Return a list of available expectation suite names."""
"""Return a list of available expectation suite keys."""
try:
keys = self.expectations_store.list_keys()
except KeyError as e:
Expand Down Expand Up @@ -2276,7 +2276,15 @@ def get_expectation_suite(
)

def list_expectation_suite_names(self) -> List[str]:
"""Lists the available expectation suite names"""
"""
Lists the available expectation suite names. If in ge_cloud_mode, a list of
GE Cloud ids is returned instead.
"""
if self.ge_cloud_mode:
return [
suite_key.ge_cloud_id for suite_key in self.list_expectation_suites()
]

sorted_expectation_suite_names = [
i.expectation_suite_name for i in self.list_expectation_suites()
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class GeCloudStoreBackend(StoreBackend, metaclass=ABCMeta):
ALLOWED_SET_KWARGS_BY_RESOURCE_TYPE = {
"expectation_suite": {"clause_id"},
"rendered_data_doc": {"source_type", "source_id"},
"suite_validation_result": {"contract_id"},
"suite_validation_result": {"contract_id", "expectation_suite_id"},
}

def __init__(
Expand Down
35 changes: 35 additions & 0 deletions great_expectations/render/view/templates/page_minimal.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<title>Data documentation compiled by Great Expectations</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="UTF-8">
<title>{% block title %}{% endblock %}</title>

{# {# Remove this when not debugging: #}
{# <meta http-equiv="refresh" content="1"/> #}
<link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.16.0/dist/bootstrap-table.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" href="https://unpkg.com/bootstrap-table@1.16.0/dist/extensions/filter-control/bootstrap-table-filter-control.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/css/bootstrap-datepicker.min.css">

<style>{% include 'data_docs_default_styles.css' %}</style>
<style>{% include 'data_docs_custom_styles.css' ignore missing %}</style>

{% include 'js_script_imports.j2' %}
{% include 'favicon.j2' %}
</head>

<body>
<div class="container-fluid pt-4 pb-4 pl-5 pr-5">
<div class="row">
<div class="col-12">
{% for section in sections %}
{% set section_loop = loop -%}
{% include 'section.j2' %}
{% endfor %}
</div>
</div>
</div>
</body>
</html>

0 comments on commit 0007ecc

Please sign in to comment.