I'm assuming one's input is someone else's output ...
# hamilton-help
i
I'm assuming one's input is someone else's output šŸ˜‰
y
Haha that’s usually the case. However, I’m hoping to validate a dataframe input provided by materializer, loaded from parquet for example.
šŸ‘ 1
i
So why not validate the materializer output?
A workaround that comes to mind is a passthrough task (i.e. output=input), after the materializer, that only does output checking
s
@Yijun Tang oh I see. I think you can combine the two. How are you using the materializer? As a decorator? or injecting it? or?
I think via the decorator we can combine them:
Copy code
@check_output(schema=...target_="a.select_data.input")
@load_from.csv(path=value('foo'))
def a(input: pd.DataFrame) -> pd.DataFrame:
    return ...
The above ā€œcompiledā€ but I didn’t run it. Otherwise for injecting I haven’t tested it, but you might be able to inject to the right node if you have this defined:
Copy code
@check_output(schema=...)
def a(input: pd.DataFrame) -> pd.DataFrame:
    return ...
and then you inject
a_raw
instead of
a
.
šŸ’” 1
y
Thanks for the suggestion. I’m using materializers this way:
Copy code
materializers = [
        from_.parquet(target="raw_df_1", path=data_path),
        from_.parquet(target="raw_df_2", path=data_path),
    ]
    dr = driver.Builder().with_modules(__main__).with_materializers(*materializers).build()
The reason I went this route is so that users don’t have to explicitly write the loader nodes
šŸ‘ 1