-
Notifications
You must be signed in to change notification settings - Fork 44
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
Question on using UPath and fs copy/put #309
Comments
Hello @scholtalbers Here is an explanation for how all of this works together. Some of it skips over details, so I really recommend to read the filesystem_spec docs thoroughly and look at the fsspecAll the filesystem abstractions and filesystem operations are implemented and defined in filesystem_spec. The base class of all these filesystems is in To use a filesystem registered in fsspec, you instantiate the specific subclass of When you want to reference an object on a filesystem, you need 3 pieces of information:
If you have all three pieces of information, you can provide access to the information stored in the object you're referencing. Some filesystems in fsspec support combining the 3 pieces of information into a single string urlpath, usually of the form: upathThe
The copy functionality between filesystems will be available in UPath once #227 is completed, which relies on #193. And once that interface exists, the internal implementation will likely be based on the generic filesystem, but that's tbd. when to use what
For cases where it's you need to move between them: UPath().protocol # the protocol string used by fsspec
UPath().storage_options # the storage_options required to create the fsspec filesystem instance
UPath().path # a path string that can be used by the fsspec instance
UPath().fs # a convenience helper to do fsspec.filesystem(pth.protocol, **pth.storage_options) Regarding your question
As mentioned above: not yet. But hopefully soon. Let me know if this helped, |
Yes thanks a lot Andreas, this clarifies a few things for me and I'm looking forward for the upcoming features! |
Not sure if this is the right place to ask this question, and I debated if it should go in the community Q&A?
Anyway, I want to leverage UPath and fsspec to work with multiple storage backends, for now limited to local disk and s3. One of the main use cases is to copy files and folders from one to the other.
So triggered by the answer, I feel I may have some misunderstanding of how to use the library effectively. I have read some of the documentation, but I may have missed something obvious.
What I started doing is along these lines:
I also explored the generic filesystem with something like
It feels (at least) the part
dest.fs.put(str(src), str(dest))
is not the right way for my use case, is there a better way?The text was updated successfully, but these errors were encountered: