import_module()#
- hamilton.dataflows.import_module(dataflow: str, user: str = None, version: str = 'latest', overwrite: bool = False) module #
Pulls & imports dataflow code from github and returns a module.
from hamilton import dataflow, driver # downloads into ~/.hamilton/dataflows and loads the module -- WARNING: ensure you know what code you're importing! # NAME_OF_DATAFLOW = dataflow.import_module("NAME_OF_DATAFLOW") # if using official dataflow NAME_OF_DATAFLOW = dataflow.import_module("NAME_OF_DATAFLOW", "NAME_OF_USER") dr = ( driver.Builder() .with_config({}) # replace with configuration as appropriate .with_modules(NAME_OF_DATAFLOW) .build() ) # execute the dataflow, specifying what you want back. Will return a dictionary. result = dr.execute( [NAME_OF_DATAFLOW.FUNCTION_NAME, ...], # this specifies what you want back inputs={...} # pass in inputs as appropriate )
- Parameters:
dataflow β the name of the dataflow.
user β Optional. If none it assumes official.
version β the version to get. βlatestβ will resolve to the most recent commit. Otherwise pass a the commit SHA you want to pull.
overwrite β whether to overwrite the local path. Default is False.
- Returns:
a Module that you can then pass to Hamilton.