copy()

hamilton.dataflows.copy(dataflow: ModuleType, destination_path: str, overwrite: bool = False, renamed_module: str = None)

Copies a dataflow module to the passed in path.

from hamilton import dataflows

# dynamically pull and then copy
NAME_OF_DATAFLOW = dataflow.import_module("NAME_OF_DATAFLOW", "NAME_OF_USER")
dataflow.copy(NAME_OF_DATAFLOW, destination_path="PATH_TO_DIRECTORY")
# copy from the installed library
from hamilton.contrib.user.NAME_OF_USER import NAME_OF_DATAFLOW
dataflow.copy(NAME_OF_DATAFLOW, destination_path="PATH_TO_DIRECTORY")
Parameters:
  • dataflow – the module to copy.

  • destination_path – the path to a directory to place the module in.

  • overwrite – whether to overwrite the destination. Default is False and raise an error.

  • renamed_module – whether to rename the copied module. Default is None and will use the original name.