Hi, I find @save_to a bit strange... I'm using 1.6...
# hamilton-help
r
Hi, I find @save_to a bit strange... I'm using 1.62, and I follow the manual and code like this:
Copy code
@save_to.pickle(path="pickle_entry_point.pkl")
def entry_point(freq: float, phase: float) -> np.ndarray:
    return np.sin(freq * np.linspace(0, 2 * np.pi, 100) + phase)
According to the manual, I also need extra arguments
output_name
, but when I add it, it raises an error:
hamilton.function_modifiers.base.InvalidDecoratorException: Extra parameters for loader: <class 'hamilton.io.default_data_loaders.PickleSaver'> {'output_name'}. Choices for parameters are: dict_keys(['path'])
. Also, I use a materializer, and I don't know how to "call" this save in dr. materialize... Can you help me fix it?
s
@Roy Kid where in the documentation are you referring to? Otherwise what you have looks correct.
r
OHHH, it is
output_name_
with underscore not
output_name
!
s
what I would add is the following:
Copy code
@save_to.pickle(path="pickle_entry_point.pkl", output_name_="entry_point_pickle")
def entry_point(freq: float, phase: float) -> np.ndarray:
    return np.sin(freq * np.linspace(0, 2 * np.pi, 100) + phase)
you’d request this as part of the
additional_vars=["entry_point_pickle"]
if you are using
.materialize()
yep
r
😭 The error message is a little bit vague. It looks like it only takes
path
. Sorry for bothering you
👍 1