Acryl Great Expectations

0.15.50.1 · active · verified Thu Apr 16

Acryl Great Expectations is Acryl Data's opinionated flavor of the Great Expectations data validation library, providing a specific set of configurations and integrations primarily for use with the DataHub metadata platform. It currently pins to an older, V2 configuration API of Great Expectations (versions `<0.16.0`). Its release cadence is tied to DataHub releases.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates basic data validation using Great Expectations' V2 API, which `acryl-great-expectations` provides. It uses an in-memory Pandas DataFrame to create a `PandasDataset`, adds a few common expectations, and runs a validation.

import pandas as pd
from great_expectations.dataset import PandasDataset
from great_expectations.core.batch_spec import BatchSpec

# Sample data
df = pd.DataFrame({
    "id": [1, 2, 3, 4, 5],
    "value": [10, 20, 30, 40, 50],
    "category": ["A", "B", "A", "C", "B"]
})

# Create a PandasDataset (V2 API style for in-memory validation)
batch = PandasDataset(df, batch_spec=BatchSpec(data_asset_name="my_dataframe"))

# Define and add expectations
batch.expect_column_to_exist("id")
batch.expect_column_values_to_be_between("value", min_value=0, max_value=100)
batch.expect_column_distinct_values_to_be_in_set("category", ["A", "B", "C"])

# Validate the batch
validation_result = batch.validate()

print(f"Validation successful: {validation_result.success}")
if not validation_result.success:
    print("Validation failed details:")
    for result in validation_result.results:
        if not result.success:
            print(f"  Expectation: {result.expectation_config.expectation_type}, Status: {result.success}")

# Expected output: Validation successful: True

view raw JSON →