Generic
Generic
Result builders help you augment what is returned by the driver’s execute() function. Here are the generic ones.
class hamilton.base.ResultMixin[source]
Legacy result builder – see lifecycle methods for more information.
class hamilton.base.DictResult[source]
Simple function that returns the dict of column -> value results.
It returns the results as a dictionary, where the keys map to outputs requested, and values map to what was computed for those values.
Use this when you want to:
- debug dataflows.
- have heterogeneous return types.
- Want to manually transform the result into something of your choosing.
from hamilton import base, driver
dict_builder = base.DictResult()
adapter = base.SimplePythonGraphAdapter(dict_builder)
dr = driver.Driver(config, *modules, adapter=adapter)
dict_result = dr.execute([...], inputs=...)Note, if you just want the dict result + the SimplePythonGraphAdapter, you can use the DefaultAdapter
adapter = base.DefaultAdapter()static build_result(**outputs: dict[str, Any]) → dict[source]
This function builds a simple dict of output -> computed values.
input_types() → list[type[type]] | None[source]
Gives the applicable types to this result builder. This is optional for backwards compatibility, but is recommended.
Returns:
A list of types that this can apply to.
output_type() → type[source]
Returns the output type of this result builder the type that this creates
评论
登录后参与评论
KnowForge