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.