tree: 6830fe0986fe07ce8877afc372b2a5b6cd0825b8 [path history] [tgz]
  1. airflow/
  2. async/
  3. aws/
  4. caching/
  5. caching_nodes/
  6. cli/
  7. contrib/
  8. dagster/
  9. dask/
  10. data_loaders/
  11. data_quality/
  12. dbt/
  13. decoupling_io/
  14. dlt/
  15. due_date_probabilities/
  16. experiment_management/
  17. feast/
  18. feature_engineering/
  19. hamilton-tutorials/
  20. hamilton_ui/
  21. hello_world/
  22. ibis/
  23. ibisml/
  24. jupyter_notebook_magic/
  25. kedro/
  26. lineage/
  27. LLM_Workflows/
  28. materialization/
  29. mlflow/
  30. model_examples/
  31. module_overrides/
  32. mutate/
  33. narwhals/
  34. numpy/
  35. openlineage/
  36. opentelemetry/
  37. pandas/
  38. parallelism/
  39. people_data_labs/
  40. plotly/
  41. polars/
  42. prefect/
  43. ray/
  44. reusing_functions/
  45. reverse_etl/
  46. schema/
  47. scikit-learn/
  48. slack/
  49. snowflake/
  50. spark/
  51. streamlit/
  52. styling_visualization/
  53. vaex/
  54. validation/
  55. Dockerfile
  56. make_python_virtualenv.sh
  57. README.md
  58. validate_examples.py
examples/README.md

Examples

Here you‘ll find various examples, some relatively simple, to a few that are more complex. As you can see there are MANY examples, that are mostly organized by a thematic topic that matches the folder name they’re in.

Note: hub.dagworks.io is also a good spot to find Apache Hamilton examples.

If you have questions, or need help with these examples, join us on slack, and we'll try to help!

Running examples through a docker image

Examples could also be executed through a docker image which you can build or pull yourself. Each example directory inside docker image contains a hamilton-env Python virtual environment. hamilton-env environment contains all the dependencies required to run the example.

NOTE: If you already have the container image you can skip to container initialization (step 3).

  1. Change directory to examples.
cd hamilton/examples
  1. Build the container image.
docker build --tag hamilton-example .

Docker build takes around 6m16.298s depending on the system configuration and network. Alternatively, you can pull the container image from https://hub.docker.com/r/skrawcz/sf-hamilton. docker pull skrawcz/sf-hamilton.

  1. Starting the container. If you built it yourself:
docker run -it --rm --name hamilton-example hamilton-example

If you pulled it from dockerhub:

docker run -it --rm --name hamilton-example skrawcz/sf-hamilton

This will start the container and put you into a bash prompt.

  1. Start running examples. E.g. running the hello_world example inside the container:
cd hamilton/examples/hello_world
source hamilton-env/bin/activate  # this will activate the right python environment
python my_script.py
deactivate # this will deactivate the virtual environment so you can activate another

To run another example:

  1. change directory to it.
  2. activate the environment (source hamilton-env/bin/activate).
  3. run the code, e.g. python run.py.
  4. deactivate the environment (deactivate). And then exit to quit out of the running docker container.