What one direct invocation of an asset built with dd.asset yielded.
testing.DirectInvocationResult(
materialization,
checks,
)
Attributes
materialization: dg.MaterializeResult[pl.DataFrame] | None
-
The asset’s materialization, or None when the decorated function returned None.
checks: dict[str, dg.AssetCheckResult]
-
Every check result, keyed by check name, in the order the call yielded them.
Examples
import dagster as dg
import polars as pl
import dagster_dataframely as dd
from dagster_dataframely.data import OrdersSchema, storefront_orders
@dd.asset(OrdersSchema)
def orders(raw_orders: pl.DataFrame) -> pl.DataFrame:
return raw_orders
result = dd.testing.DirectInvocationResult.from_invocation(
orders(dg.build_asset_context(), storefront_orders)
)
result.materialization.value.height, len(result.checks)
Methods
|
Name
|
Description
|
|
from_invocation()
|
Separate what a direct invocation yields into the materialization and the check results.
|
from_invocation()
Separate what a direct invocation yields into the materialization and the check results.
Parameters
called: object
-
What calling the asset returns. Dagster annotates
AssetsDefinition.__call__ as returning object, so a narrower annotation would make every test cast.
Returns
Self
-
The materialization, or
None on a skip, and every check result keyed by check name.
Raises
TypeError
-
called is not iterable, or yields a second materialization, a check name twice, or a value of another type.
Examples
import dagster as dg
import polars as pl
import dagster_dataframely as dd
from dagster_dataframely.data import OrdersSchema, storefront_orders
@dd.asset(OrdersSchema)
def orders(raw_orders: pl.DataFrame) -> pl.DataFrame:
return raw_orders
result = dd.testing.DirectInvocationResult.from_invocation(
orders(dg.build_asset_context(), storefront_orders)
)
[name for name, check in result.checks.items() if not check.passed]