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

UPath kwargs are not persisted from layout root to BIDSFiles #1098

Open
effigies opened this issue Nov 11, 2024 · 0 comments
Open

UPath kwargs are not persisted from layout root to BIDSFiles #1098

effigies opened this issue Nov 11, 2024 · 0 comments
Labels

Comments

@effigies
Copy link
Collaborator

The sqlalchemy serialize/deserialize loop makes it nontrivial to keep track of keyword arguments. For example:

from upath import UPath
from bids.layout import BIDSLayout

ds_root = UPath("s3://openneuro.org/ds000102", anon=True)
layout = BIDSLayout(ds_root)

description = layout.get(suffix='description', extension='.json')[0]
assert description._path.storage_options == ds_root.storage_options  # boom

Consequently, anonymous access to S3 datasets is not currently possible, and presumably there are other impacts on other protocols. This should be fixed.

Some previous notes from #1094:

If universal_pathlib provides an API to access these additional parameters, we could consider adding a column to the BIDSFile model and use it while reconstructing. Another approach could be to mutate BIDSFiles after creation, provided the access happens through a BIDSLayout method call that has access to ._root. Alternately, if we could somehow put this information in the SQLAlchemy session, then the BIDSFile.path property could access it on demand.

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

No branches or pull requests

1 participant