-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
my python file
import great_expectations as gx
from prefect import flow
from prefect_great_expectations import run_checkpoint_validation
def create_expectation_suite_and_checkpoint():
"""Create a DataContext, connect to data, create Expectations, create and return a checkpoint."""
context = gx.get_context()
validator = context.sources.pandas_default.read_csv(
"https://raw.githubusercontent.com/great-expectations/gx_tutorials/main/data/yellow_tripdata_sample_2019-01.csv"
)
validator.expect_column_values_to_not_be_null("pickup_datetime")
# this expectation will fail
validator.expect_column_values_to_be_between(
"passenger_count", min_value=1, max_value=5
)
# checkpoints are reusble and only need to be created once
checkpoint = gx.checkpoint.SimpleCheckpoint(
name="taxi_check",
data_context=context,
validator=validator,
)
return checkpoint
@flow
def validation_flow(checkpoint):
"""Creates a task that validates a run of a Great Expectations checkpoint"""
res = run_checkpoint_validation(checkpoint=checkpoint)
return
if __name__ == "__main__":
checkpoint = create_expectation_suite_and_checkpoint()
validation_flow(checkpoint=checkpoint)
versions:
great-expectations 0.18.5
prefect-great-expectations 0.2.1
prefect 2.14.11
error:
Traceback (most recent call last):
File "...", line 1, in <module>
import great_expectations as gx
File "...", line 5, in <module>
from prefect_great_expectations import run_checkpoint_validation
File ".../.venv/lib/python3.9/site-packages/prefect_great_expectations/__init__.py", line 2, in <module>
from .validation import run_checkpoint_validation # noqa
File ".../.venv/lib/python3.9/site-packages/prefect_great_expectations/validation.py", line 6, in <module>
from great_expectations import DataContext
ImportError: cannot import name 'DataContext' from partially initialized module 'great_expectations' (most likely due to a circular import) (...)
Metadata
Metadata
Assignees
Labels
No labels