Hamilton (current version 1.89.0) is a Python micro-framework for defining dataflows as functions, enabling modular, testable, and maintainable data pipelines. It represents data transformations as a directed acyclic graph (DAG) where nodes are Python functions and edges are dependencies, making it easy to build complex dataframes. It has an active release cadence with frequent updates.
pip install sf-hamiltonVerified import paths — ran on the pinned version, not inferred.
This quickstart defines a simple dataflow: initial transactions are aggregated into daily spend, and then an average daily spend over a specific period is calculated. It demonstrates function-based node definition, the use of a function modifier (`@fm.config.when`), and executing the `Driver` to obtain a specific output.
Consult the official migration guide for versions 1.0.0 and above. Redesign dataflow functions to align with the new Hamilton paradigm.
Ensure that the parameter names in your functions exactly match the names of the functions producing their required inputs, or the names of initial inputs provided to the Driver.
Always add the name of the desired output function(s) to the `final_outputs` list in your `driver.execute()` or `driver.materialize()` call.
Check the spelling of `some_output_name`. Ensure the function `def some_output_name(...)` is correctly defined in an imported module or directly in the script, and that the `Driver` is aware of it.
Define a function `def some_dependency_name(...)` to provide the required input, or pass `some_dependency_name` as an initial input argument to the `Driver`'s constructor or `execute` method (e.g., `driver.execute(inputs={'some_dependency_name': ...}, ...) `).Install `pygraphviz` via `pip install "sf-hamilton[visualization]"`. For the underlying `graphviz` command-line tool, install it via your system's package manager (e.g., `sudo apt-get install graphviz` on Debian/Ubuntu, `brew install graphviz` on macOS) and ensure it's in your system's PATH.