Great Expectations custom Ecpectation for a BigQuery Table

47 Views Asked by At

I have followed the great expectations documentation and tried to create a columnmap expectation and querytype expecation for my a BQ table .

i am able to create validators and import a simple custom expectation in the format specified by the V3 documentation .this code works class ColumnValuesEqualLondon(ColumnMapMetricProvider): """MetricProvider Class for Custom Aggregate Max MetricProvider"""

condition_metric_name = "column_values.equal_london"

@column_condition_partial(engine=SqlAlchemyExecutionEngine)
def _sqlalchemy(cls, column, **kwargs):
    """SqlAlchemy Max Implementation    """
    return column=="London"

but i am not sure how to implement custom logic using lambda and equate the sql column object . can someone help with a neat example

i tried this class ColumnValuesEqualLondon(ColumnMapMetricProvider): """MetricProvider Class for Custom Aggregate Max MetricProvider"""

condition_metric_name = "column_values.equal_london"

@column_condition_partial(engine=SqlAlchemyExecutionEngine)
def _sqlalchemy(cls, column, **kwargs):
    """SqlAlchemy Max Implementation    """
    return column=="London"

i am expecting how to extend this logic to complex business functions and equate the sql column object as shown here

0

There are 0 best solutions below