Skip to main content
Version: 1.2.1

AbstractDataContext

class great_expectations.data_context.AbstractDataContext(runtime_environment: Optional[dict] = None)#

Base class for all Data Contexts that contains shared functionality.

The class encapsulates most store / core components and convenience methods used to access them, meaning the majority of Data Context functionality lives here.

One of the primary responsibilities of the DataContext is managing CRUD operations for core GX objects:

Supported CRUD Methods#

Stores

Datasources

ExpectationSuites

Checkpoints

get

add

update

add_or_update

delete

add_data_docs_site(site_name: str, site_config: DataDocsSiteConfigTypedDict) None#

Add a new Data Docs Site to the DataContext.

New in version 0.17.2.

Example site config dicts can be found in our “Host and share Data Docs” guides.

Parameters
  • site_name – New site name to add.

  • site_config – Config dict for the new site.

build_data_docs(site_names: list[str] | None = None, resource_identifiers: list[great_expectations.data_context.types.resource_identifiers.ExpectationSuiteIdentifier] | list[great_expectations.data_context.types.resource_identifiers.ValidationResultIdentifier] | None = None, dry_run: bool = False, build_index: bool = True) dict[str, str]#

Build Data Docs for your project.

Relevant Documentation Links
Parameters
  • site_names – if specified, build data docs only for these sites, otherwise, build all the sites specified in the context’s config

  • resource_identifiers – a list of resource identifiers (ExpectationSuiteIdentifier, ValidationResultIdentifier). If specified, rebuild HTML (or other views the data docs sites are rendering) only for the resources in this list. This supports incremental build of data docs sites (e.g., when a new validation result is created) and avoids full rebuild.

  • dry_run – a flag, if True, the method returns a structure containing the URLs of the sites that would be built, but it does not build these sites.

  • build_index – a flag if False, skips building the index page

Returns

A dictionary with the names of the updated data documentation sites as keys and the location info of their index.html files as values

Raises

ClassInstantiationError – Site config in your Data Context config is not valid.

property checkpoints: great_expectations.core.factory.checkpoint_factory.CheckpointFactory#
property data_sources: great_expectations.datasource.fluent.sources.DataSourceManager#
delete_data_docs_site(site_name: str)#

Delete an existing Data Docs Site.

New in version 0.17.2.

Parameters

site_name – Site name to delete.

enable_analytics(enable: Optional[bool]) None#

Enable or disable analytics for this DataContext. With non-ephemeral contexts, this can be preserved via context.variables.save().

If set to None, the GX_ANALYTICS_ENABLED environment variable will be used.

list_data_docs_sites() dict[str, DataDocsSiteConfigTypedDict]#

List all Data Docs Sites with configurations.

New in version 0.17.2.

property suites: great_expectations.core.factory.suite_factory.SuiteFactory#

update_data_docs_site(site_name: str, site_config: DataDocsSiteConfigTypedDict) None#

Update an existing Data Docs Site.

New in version 0.17.2.

Example site config dicts can be found in our “Host and share Data Docs” guides.

Parameters
  • site_name – Site name to update.

  • site_config – Config dict that replaces the existing.

update_project_config(project_config: Union[great_expectations.data_context.types.base.DataContextConfig, Mapping]) great_expectations.data_context.types.base.DataContextConfig#

Update the context’s config with the values from another config object.

Parameters

project_config – The config to use to update the context’s internal state.

Returns

The updated project config.

property validation_definitions: great_expectations.core.factory.validation_definition_factory.ValidationDefinitionFactory#
view_validation_result(result: CheckpointResult) None#

New in version 0.16.15.

Opens a validation result in a browser.

Parameters

result – The result of a Checkpoint run.