Skip to content

Commit

Permalink
Merge branch 'develop' into feature/sql_unexpected_index_list
Browse files Browse the repository at this point in the history
  • Loading branch information
William Shin authored Nov 10, 2022
2 parents b826b21 + 1669a8b commit 90eda4a
Show file tree
Hide file tree
Showing 57 changed files with 494 additions and 346 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[![PyPI](https://img.shields.io/pypi/v/great_expectations)](https://pypi.org/project/great-expectations/#history)
[![Build Status](https://dev.azure.com/great-expectations/great_expectations/_apis/build/status/great_expectations?branchName=develop&stageName=required)](https://dev.azure.com/great-expectations/great_expectations/_build/latest?definitionId=1&branchName=develop)
![Coverage](https://img.shields.io/azure-devops/coverage/great-expectations/great_expectations/1/main)
[![Documentation Status](https://readthedocs.org/projects/great-expectations/badge/?version=latest)](http://great-expectations.readthedocs.io/en/latest/?badge=latest)
Expand Down
24 changes: 24 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@
title: Changelog
---

### 0.15.32
* [BUGFIX] Patch broken `CloudNotificationAction` tests (#6327)
* [BUGFIX] add create_temp_table flag to ExecutionEngineConfigSchema (#6331) (thanks @tommy-watts-depop)
* [BUGFIX] MapMetrics now return `partial_unexpected` values for `SUMMARY` format (#6334)
* [DOCS] Re-writes "how to implement custom notifications" as "How to get Data Docs URLs for use in custom Validation Actions" (#6281)
* [DOCS] Removes deprecated expectation notebook exploration doc (#6298)
* [DOCS] Removes a number of unused & deprecated docs (#6300)
* [DOCS] Prioritizes Onboarding Data Assistant in ToC (#6302)
* [DOCS] Add ZenML into integration table in Readme (#6144) (thanks @dnth)
* [DOCS] add `pypi` release badge (#6324)
* [MAINTENANCE] Remove unneeded `BaseDataContext.get_batch_list` (#6291)
* [MAINTENANCE] Clean up implicit `Optional` errors flagged by `mypy` (#6319)
* [MAINTENANCE] Add manual prod flags to core Expectations (#6278)
* [MAINTENANCE] Fallback to isnot method if is_not is not available (old sqlalchemy) (#6318)
* [MAINTENANCE] Add ZEP postgres datasource. (#6274)
* [MAINTENANCE] Delete "metric_dependencies" from MetricConfiguration constructor arguments (#6305)
* [MAINTENANCE] Clean up `DataContext` (#6304)
* [MAINTENANCE] Deprecate `save_changes` flag on `Datasource` CRUD (#6258)
* [MAINTENANCE] Deprecate `great_expectations.render.types` package (#6315)
* [MAINTENANCE] Update range of allowable sqlalchemy versions (#6328)
* [MAINTENANCE] Fixing checkpoint types (#6325)
* [MAINTENANCE] Fix column_reflection_fallback for Trino and minor logging/testing improvements (#6218)
* [MAINTENANCE] Change the number of expected Expectations in the 'quick check' stage of build_gallery pipeline (#6333)

### 0.15.31
* [BUGFIX] Include all requirement files in the sdist (#6292) (thanks @xhochy)
* [DOCS] Updates outdated batch_request snippet in Terms (#6283)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Thus, the intention is for this Expectation Suite to be edited and updated to be
You can access this same functionality from the Great Expectations <TechnicalTag tag="cli" text="CLI" /> by running

```console
great_expectations suite new --profile
great_expectations suite new --profile rule_based_profiler
```

If you go that route, you can follow along in the resulting Jupyter Notebook instead of using this guide.
Expand Down
2 changes: 1 addition & 1 deletion docs/integrations/contributing_integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: How to write integration documentation

### Introduction
As the data stack ecosystem grows and expands in usage and tooling, so does the need to integrate with 3rd party
products or services. [Superconductive](https://superconductive.com) as drivers and ushers
products or services. As drivers and ushers
of [Great Expectations](https://greatexpectations.io), we want to make the process to integrating with Great Expectations
as low friction as possible. We are committed to work and iterate in the process and greatly value any feedback you may have.
The aim of this document is to provide guidance for vendors or community partners which wish to integrate with us as to
Expand Down
4 changes: 2 additions & 2 deletions docs/terms/execution_engine.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ If you are interested in using and accessing data with an Execution Engine that

- `name`
- `caching`
- `batch_spec_defaults` (is this needed?)
- `batch_spec_defaults`
- `batch_data_dict`
- `validator`

### Execution Engine Properties

- `loaded_batch_data` (all "loaded" batches)
- `loaded_batch_data`
- `active_batch_data_id`

### Execution Engine Methods
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
```
great_expectations, version 0.15.31
great_expectations, version 0.15.32
```
25 changes: 25 additions & 0 deletions docs_rtd/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,31 @@
Changelog
#########

0.15.32
-----------------
* [BUGFIX] Patch broken `CloudNotificationAction` tests (#6327)
* [BUGFIX] add create_temp_table flag to ExecutionEngineConfigSchema (#6331) (thanks @tommy-watts-depop)
* [BUGFIX] MapMetrics now return `partial_unexpected` values for `SUMMARY` format (#6334)
* [DOCS] Re-writes "how to implement custom notifications" as "How to get Data Docs URLs for use in custom Validation Actions" (#6281)
* [DOCS] Removes deprecated expectation notebook exploration doc (#6298)
* [DOCS] Removes a number of unused & deprecated docs (#6300)
* [DOCS] Prioritizes Onboarding Data Assistant in ToC (#6302)
* [DOCS] Add ZenML into integration table in Readme (#6144) (thanks @dnth)
* [DOCS] add `pypi` release badge (#6324)
* [MAINTENANCE] Remove unneeded `BaseDataContext.get_batch_list` (#6291)
* [MAINTENANCE] Clean up implicit `Optional` errors flagged by `mypy` (#6319)
* [MAINTENANCE] Add manual prod flags to core Expectations (#6278)
* [MAINTENANCE] Fallback to isnot method if is_not is not available (old sqlalchemy) (#6318)
* [MAINTENANCE] Add ZEP postgres datasource. (#6274)
* [MAINTENANCE] Delete "metric_dependencies" from MetricConfiguration constructor arguments (#6305)
* [MAINTENANCE] Clean up `DataContext` (#6304)
* [MAINTENANCE] Deprecate `save_changes` flag on `Datasource` CRUD (#6258)
* [MAINTENANCE] Deprecate `great_expectations.render.types` package (#6315)
* [MAINTENANCE] Update range of allowable sqlalchemy versions (#6328)
* [MAINTENANCE] Fixing checkpoint types (#6325)
* [MAINTENANCE] Fix column_reflection_fallback for Trino and minor logging/testing improvements (#6218)
* [MAINTENANCE] Change the number of expected Expectations in the 'quick check' stage of build_gallery pipeline (#6333)

0.15.31
-----------------
* [BUGFIX] Include all requirement files in the sdist (#6292) (thanks @xhochy)
Expand Down
166 changes: 166 additions & 0 deletions great_expectations/core/config_provider.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
from __future__ import annotations

import errno
import os
from abc import ABC, abstractmethod
from collections import OrderedDict
from typing import Dict, Optional, Type, cast

from great_expectations.core.yaml_handler import YAMLHandler
from great_expectations.data_context.types.base import GeCloudConfig
from great_expectations.data_context.util import (
substitute_all_config_variables,
substitute_config_variable,
)

yaml = YAMLHandler()


class AbstractConfigurationProvider(ABC):
@abstractmethod
def get_values(self) -> Dict[str, str]:
"""
Retrieve any configuration variables relevant to the provider's environment.
"""
pass


class ConfigurationProvider(AbstractConfigurationProvider):
"""
Wrapper class around the other environment-specific configuraiton provider classes.
Based on relevance, specific providers are registered to this object and are invoked
using the API defined by the AbstractConfigurationProvider.
In short, this class' purpose is to aggregate all configuration variables that may
be present for a given user environment (config variables, env vars, runtime environment, etc.)
"""

def __init__(self) -> None:
self._providers: OrderedDict[
Type[AbstractConfigurationProvider], AbstractConfigurationProvider
] = OrderedDict()

def register_provider(self, provider: AbstractConfigurationProvider) -> None:
"""
Saves a configuration provider to the object's state for downstream usage.
See `get_values()` for more information.
Args:
provider: An instance of a provider to register.
"""
type_ = type(provider)
if type_ in self._providers:
raise ValueError(f"Provider of type {type_} has already been registered!")
self._providers[type_] = provider

def get_provider(
self, type_: Type[AbstractConfigurationProvider]
) -> Optional[AbstractConfigurationProvider]:
"""
Retrieves a registered configuration provider (if available).
Args:
type_: The class of the configuration provider to retrieve.
Returns:
A registered provider if available.
If not, None is returned.
"""
return self._providers.get(type_)

def get_values(self) -> Dict[str, str]:
"""
Iterates through all registered providers to aggregate a list of configuration values.
Values are generated based on the order of registration; if there is a conflict,
subsequent providers will overwrite existing values.
"""
values: Dict[str, str] = {}
for provider in self._providers.values():
values.update(provider.get_values())
return values


class RuntimeEnvironmentConfigurationProvider(AbstractConfigurationProvider):
"""
Responsible for the management of the runtime_environment dictionary provided at runtime.
"""

def __init__(self, runtime_environment: Dict[str, str]) -> None:
self._runtime_environment = runtime_environment

def get_values(self) -> Dict[str, str]:
return self._runtime_environment


class EnvironmentConfigurationProvider(AbstractConfigurationProvider):
"""
Responsible for the management of environment variables.
"""

def get_values(self) -> Dict[str, str]:
return dict(os.environ)


class ConfigurationVariablesConfigurationProvider(AbstractConfigurationProvider):
"""
Responsible for the management of user-defined configuration variables.
These can be found in the user's /uncommitted/config_variables.yml file.
"""

def __init__(
self, config_variables_file_path: str, root_directory: Optional[str] = None
) -> None:
self._config_variables_file_path = config_variables_file_path
self._root_directory = root_directory

def get_values(self) -> Dict[str, str]:
env_vars = dict(os.environ)
try:
# If the user specifies the config variable path with an environment variable, we want to substitute it
defined_path: str = substitute_config_variable( # type: ignore[assignment]
self._config_variables_file_path, env_vars
)
if not os.path.isabs(defined_path):
root_directory: str = self._root_directory or os.curdir
else:
root_directory = ""

var_path = os.path.join(root_directory, defined_path)
with open(var_path) as config_variables_file:
contents = config_variables_file.read()

variables = dict(yaml.load(contents)) or {}
return cast(
Dict[str, str], substitute_all_config_variables(variables, env_vars)
)

except OSError as e:
if e.errno != errno.ENOENT:
raise
return {}


class CloudConfigurationProvider(AbstractConfigurationProvider):
"""
Responsible for the management of a user's GX Cloud credentials.
See `GeCloudConfig` for more information. Note that this is only registered on the primary
config provider when in a Cloud-backend environment.
"""

def __init__(self, cloud_config: GeCloudConfig) -> None:
self._cloud_config = cloud_config

def get_values(self) -> Dict[str, str]:
from great_expectations.data_context.data_context.cloud_data_context import (
GECloudEnvironmentVariable,
)

return {
GECloudEnvironmentVariable.BASE_URL: self._cloud_config.base_url,
GECloudEnvironmentVariable.ACCESS_TOKEN: self._cloud_config.access_token,
GECloudEnvironmentVariable.ORGANIZATION_ID: self._cloud_config.organization_id, # type: ignore[dict-item]
}
Loading

0 comments on commit 90eda4a

Please sign in to comment.