-
Notifications
You must be signed in to change notification settings - Fork 97
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
File upload #758
base: main
Are you sure you want to change the base?
File upload #758
Conversation
Deploying datachain-documentation with Cloudflare Pages
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #758 +/- ##
==========================================
- Coverage 87.24% 87.24% -0.01%
==========================================
Files 116 116
Lines 11018 11023 +5
Branches 1511 1511
==========================================
+ Hits 9613 9617 +4
- Misses 1028 1030 +2
+ Partials 377 376 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
efe4850
to
ec29c5d
Compare
Is |
Not really. I set it up via:
(see example in PR description). It is an open question of simplifying API (making |
@@ -364,6 +364,12 @@ def open_object( | |||
assert not file.location | |||
return FileWrapper(self.fs.open(self.get_full_path(file.path)), cb) # type: ignore[return-value] | |||
|
|||
def upload(self, path: str, data: bytes) -> "File": | |||
full_path = self.get_full_path(path) | |||
self.fs.pipe_file(full_path, data) |
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.
I wonder if we can make fsspec return File result object. It's very sad that we have to do the second call here to get info - it's an additional API call and slow.
@@ -364,6 +364,12 @@ def open_object( | |||
assert not file.location | |||
return FileWrapper(self.fs.open(self.get_full_path(file.path)), cb) # type: ignore[return-value] | |||
|
|||
def upload(self, path: str, data: bytes) -> "File": |
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.
why can't we add a tests here? or do you plan to rewrite it?
I know that it is a thin wrapper, but it still hits multiple apis + path, etc
Implementing file upload.
Usage example: