You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Talking with @skrawcz and @elijahbenizzy on Slack about a use case @skrawcz discovered experimenting that using @inject decorator in conjunction with @pipe decorator does not work.
Current behavior
@skrawcz Please add more description here about the current behavior
Expected behavior
The decorators should work in conjunction.
The text was updated successfully, but these errors were encountered:
# functions.py - declare and link your transformations as functions....importpandasaspdfromhamilton.function_modifiersimportextract_fields, inject, source, pipe, step@extract_fields( {"col1 == 'A' and col2 =='B'": pd.DataFrame,"col1 == 'B' and col2 =='C'": pd.DataFrame, })defdataframe_partition(partitions: list[str], df: pd.DataFrame) ->dict:
# get a dict by grouping# return dict of name to dataframereturn {"col1 == 'A' and col2 =='B'": pd.DataFrame({'a': [1,2,3]}),
"col1 == 'B' and col2 =='C'": pd.DataFrame({'b': [1,2,3,]})}
def_echo(value: pd.DataFrame, v: int) ->pd.DataFrame:
print(v)
returnvalue@pipe(step(_echo, v=1),step(_echo, v=2),)@inject(A=source("col1 == 'A' and col2 =='B'"))# A should be applied on "A White Horse" DataframedefA_processed(A: pd.DataFrame) ->pd.DataFrame:
print("I've just done a ton of transformations, each one of which is a node in the DAG")
returnA# it gets passed the result of transforming them
#run.py# And run them!importfunctionsfromhamiltonimportdriverdr=driver.Driver({}, functions)
dr.display_all_functions(
"graph.dot", orient="TB", show_legend=False)
Talking with @skrawcz and @elijahbenizzy on Slack about a use case @skrawcz discovered experimenting that using
@inject
decorator in conjunction with@pipe
decorator does not work.Current behavior
@skrawcz Please add more description here about the current behavior
Expected behavior
The decorators should work in conjunction.
The text was updated successfully, but these errors were encountered: