-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[FEATURE] V1 Validation scaffolding #9508
Changes from 8 commits
b718df3
3660097
86a8e46
be2240e
f088aa7
32862f6
ccfc32e
bd6144f
c79d06d
8ceb81b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from .checkpoint_factory import CheckpointFactory | ||
from .suite_factory import SuiteFactory | ||
from .validation_factory import ValidationFactory |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
from __future__ import annotations | ||
|
||
from great_expectations._docs_decorators import public_api | ||
from great_expectations.compatibility.typing_extensions import override | ||
from great_expectations.core.factory.factory import Factory | ||
from great_expectations.core.validation import Validation | ||
|
||
|
||
# TODO: Add analytics as needed | ||
class ValidationFactory(Factory[Validation]): | ||
def __init__(self, store) -> None: | ||
# TODO: Update type hints when new ValidationStore is implemented | ||
self._store = store | ||
|
||
@public_api | ||
@override | ||
def add(self, validation: Validation) -> Validation: | ||
"""Add a Validation to the collection. | ||
|
||
Parameters: | ||
validation: Validation to add | ||
|
||
Raises: | ||
DataContextError if Validation already exists | ||
""" | ||
raise NotImplementedError | ||
|
||
@public_api | ||
@override | ||
def delete(self, validation: Validation) -> Validation: | ||
"""Delete a Validation from the collection. | ||
|
||
Parameters: | ||
validation: Validation to delete | ||
|
||
Raises: | ||
DataContextError if Validation doesn't exist | ||
""" | ||
raise NotImplementedError | ||
|
||
@public_api | ||
@override | ||
def get(self, name: str) -> Validation: | ||
"""Get a Validation from the collection by name. | ||
|
||
Parameters: | ||
name: Name of Validation to get | ||
|
||
Raises: | ||
DataContextError when Validation is not found. | ||
""" | ||
raise NotImplementedError |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
from great_expectations._docs_decorators import public_api | ||
from great_expectations.compatibility.pydantic import BaseModel | ||
|
||
if TYPE_CHECKING: | ||
from great_expectations.core.batch_config import BatchConfig | ||
from great_expectations.core.expectation_suite import ExpectationSuite | ||
from great_expectations.datasource.fluent.interfaces import DataAsset | ||
|
||
|
||
class Validation(BaseModel): | ||
""" | ||
Responsible for running a suite against data and returning a validation result. | ||
|
||
Args: | ||
name: The name of the validation. | ||
data: An asset or batch config to validate. | ||
suite: A grouping of expectations to validate against the data. | ||
|
||
""" | ||
|
||
name: str | ||
data: DataAsset | BatchConfig | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know we've talked about this some, but did we land on this being a union with DataAsset? I know it can be done with discriminated unions, but do we currently have a good story around serialization there? I'm a bit concerned about the ergonomics of accessing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could make this a BatchConfig and use pydantic coercion to allow a user to instantiate one with an asset. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We've decided to define a protocol and allow this to be a union. |
||
suite: ExpectationSuite | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I make a change to a suite, how can I ensure that changes cascade through our persistence layer? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean a user has access to both a validation and a suite. They update the suite, how do we guarantee they see that in the validation? Would be make use of a property and have it do an external call each time someone gets this property? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm concerned that a deletion or material change to a suite would result in downstream errors if the validations store didn't stay in sync. Would we need to check every time a suite or batch config was updated/deleted? |
||
|
||
@public_api | ||
def run(self): | ||
raise NotImplementedError |
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.
Think I'm blocked on this. We have an existing
ValidationsStore
but those are for results?I think we need to do the following:
ValidationResultsStore
ValidationsStore
(orValidationStore
our inconsistent plurality should be resolved)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.
Working on the store now: #9515