Skip to content
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

Support attachments #126

Closed
jl-wynen opened this issue Aug 11, 2023 · 2 comments
Closed

Support attachments #126

jl-wynen opened this issue Aug 11, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@jl-wynen
Copy link
Collaborator

Need to find a good interface to expose attachments. One idea is:

dset = client.get_dataset(...)
assert dset.attachments is Unset  # not initialised
attachments = client.fetch_attachments(dset) # or pass pid
# or
dset = client.with_fetched_attachments(dset)
assert dset.attchments == [ ... ] # all attachments stored as a list

dset = Dataset(...)
assert dset.attachments == []
dset.attachments.append(Attachment(...))
finalized = client.upload_new_dataset_now(dset)  # uploads attachments if the list is non-empty

We can also add an argument to get_dataset to immediately download the attachments.

when downloading w/o attachments, they are Unset in order to stop users from adding attachments and getting into an inconsistent state between the client and database (e.g., client as attachment A and dbase has [B, C]).

@jl-wynen jl-wynen added the enhancement New feature or request label Aug 11, 2023
@jl-wynen jl-wynen self-assigned this Aug 11, 2023
@nitrosx
Copy link
Collaborator

nitrosx commented Aug 11, 2023

@jl-wynen this looks good and reasonable.
I would make the attachment functionality as similar as we can to the file download one.

@jl-wynen
Copy link
Collaborator Author

Done in #135

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants