diff --git a/examples/schema/dataflow.py b/examples/schema/dataflow.py index 2f52c5c56..d87013625 100644 --- a/examples/schema/dataflow.py +++ b/examples/schema/dataflow.py @@ -31,11 +31,7 @@ def df_with_renamed_cols(df_with_new_cols: pd.DataFrame) -> pd.DataFrame: from hamilton import driver from hamilton.plugins import h_schema - dr = ( - driver.Builder() - .with_modules(__main__) - .with_adapters(h_schema.SchemaValidator("./schemas")) - .build() - ) + validator_adapter = h_schema.SchemaValidator("./schemas") + dr = driver.Builder().with_modules(__main__).with_adapters(validator_adapter).build() res = dr.execute(["df_with_renamed_cols"]) - print(json.dumps(dr.adapter.adapters[0].json_schemas, indent=2)) + print(json.dumps(validator_adapter.json_schemas, indent=2)) diff --git a/examples/schema/multi_dataflow.py b/examples/schema/multi_dataflow.py index 0601be4c1..72c4423f6 100644 --- a/examples/schema/multi_dataflow.py +++ b/examples/schema/multi_dataflow.py @@ -61,18 +61,18 @@ def pandas_new_col__v4(ibis_rename: ir.Table) -> pd.DataFrame: "--no-check", action="store_false", help="Disable `check` to update the stored schemas." ) args = parser.parse_args() - + validator_adapter = h_schema.SchemaValidator( + "./multi_schemas", check=args.no_check, importance="warn" + ) dr = ( driver.Builder() .with_modules(__main__) .with_config(dict(version=args.version)) - .with_adapters( - h_schema.SchemaValidator("./multi_schemas", check=args.no_check, importance="warn") - ) + .with_adapters(validator_adapter) .build() ) res = dr.execute(["pandas_new_col"]) print(res["pandas_new_col"].head()) print() - print(json.dumps(dr.adapter.adapters[0].json_schemas, indent=2)) + print(json.dumps(validator_adapter.json_schemas, indent=2))