-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: inline data saver & loaders #983
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Okay let's instead go for the following if it's simpler to implement: from hamilton.function_modifiers import loader, saver
from hamilton.io import utils as io_utils
@loader # injects node to pull out result
def foo() -> tuple[pd.DataFrame, dict]:
...
metadata = io_utils....(file, df)
return DF, metadata
@saver # all it does is add the right tags
def write_foo(...) -> dict:
...
metadata = io_utils....(file)
return metadata |
I also find it clearer :) |
skrawcz
force-pushed
the
feature/inlinedatasaverloaders
branch
from
July 13, 2024 04:28
47063c4
to
794c2c4
Compare
skrawcz
commented
Jul 13, 2024
skrawcz
changed the title
Example showing inline data saver & loaders
Feature: inline data saver & loaders
Jul 13, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't look for polish, otherwise a few comments, looks good
This is a proof of concept. What needs to be actually done: 1. ideally we expand/wrap the function with the dataloader type appropriately, to mirror the current process (I think that's what we want). I made them classes to make it easy to add from_X functions to create the metadata. Otherwise I don't type the metadata dictionaries -- so maybe we should do that / provide a way to push people to putting standard things in it. Otherwise I think this is more ergonomic for most people getting started.
They enable one to annotate a function as loading or saving data and then having that metadata available for capture. This also removes older code -- hopefully all of it...
skrawcz
force-pushed
the
feature/inlinedatasaverloaders
branch
from
July 22, 2024 17:11
794c2c4
to
a63c330
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change enables one to have inline loaders / savers and to expose metadata for them.
This results in the following being captured in the tracker / UI
Changes
How I tested this
Notes
Checklist