- Notifications
You must be signed in to change notification settings - Fork328
Batch upsert documents#1539
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
SilasMarvin commentedJun 19, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I'm not sure why a user would use that, and not just: frompgmlimportCollection,Batchcollection=Collection("my_collection")# batch = Batch(collection, 25, {"merge": True})batch= []# await batch.upsert_documents([{"id": 1}]) # Doesn't upsert yetbatch.append({"id":1})foriinrange(23):# await batch.upsert_documents([{"id": i}]) # Doesn't upsert yetbatch.append({"id":i})# Upserts whatever is in the current batch# and appends the document to the next batch# await batch.upsert_documents([{"id": 1}])awaitcollection.upsert_documents(batch, {"merge":True})# Upserts the final batch# await batch.finish() |
Oh I see the automatic handling of upserting after they hit the threshold is nice, but it is a bit confusing. I think most people in the Python world are used to using batching systems already built into the dataset they are operating on. For example:https://huggingface.co/docs/datasets/en/process#batch-processing Not saying we shouldn't add it, but maybe we should clarify the name to like |
Why not use the |
levkk commentedJun 19, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Datasets are one of very many sources for data. For example, my use case that triggered the desire for this feature was streaming WET files from a
|
Right, having to call flush/finish is only an issue because of this new API you’re introducing. The example Silas gave doesn’t have the issue. |
Uh oh!
There was an error while loading.Please reload this page.
Features
Bugs