AbstractDataContext
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 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
Name Description site_name
New site name to add.
site_config
Config dict for the new site.
Build Data Docs for your project.
- Relevant Documentation Links
Parameters
Name Description 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
Type Description dict[str, str]
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
Type Description ClassInstantiationError
Site config in your Data Context config is not valid.
Delete an existing Data Docs Site.
New in version 0.17.2.
Parameters
Name Description site_name
Site name to delete.
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 all Data Docs Sites with configurations.
New in version 0.17.2.
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
Name Description site_name
Site name to update.
site_config
Config dict that replaces the existing.
Update the context's config with the values from another config object.
Parameters
Name Description project_config
The config to use to update the context's internal state.
Returns
Type Description great_expectations.data_context.types.base.DataContextConfig
The updated project config.
New in version 0.16.15.
Opens a validation result in a browser.
Parameters
Name Description result
The result of a Checkpoint run.
class great_expectations.data_context.AbstractDataContext(
runtime_environment: Optional[dict] = None,
user_agent_str: Optional[str] = None
)
Properties
Name | Description | Reference |
---|---|---|
| Responsible for basic CRUD operations on a context's Checkpoints. | CheckpointFactory |
| Responsible for basic CRUD operations on a context's DataSources. | DataSourceManager |
| Responsible for basic CRUD operations on a context's ExpectationSuites. | SuiteFactory |
| Responsible for basic CRUD operations on a context's ValidationDefinitions. | ValidationDefinitionFactory |
Methods
add_data_docs_site
add_data_docs_site(
site_name: str,
site_config: DataDocsSiteConfigTypedDict
) → None
build_data_docs
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]
delete_data_docs_site
delete_data_docs_site(
site_name: str
)
enable_analytics
enable_analytics(
enable: Optional[bool]
) → None
list_data_docs_sites
list_data_docs_sites() → dict[str,
DataDocsSiteConfigTypedDict]
update_data_docs_site
update_data_docs_site(
site_name: str,
site_config: DataDocsSiteConfigTypedDict
) → None
update_project_config
update_project_config(
project_config: Union[great_expectations.data_context.types.base.DataContextConfig,
Mapping]
) → great_expectations.data_context.types.base.DataContextConfig
view_validation_result
view_validation_result(
result: CheckpointResult
) → None