weaviate / weaviate/weaviate-python-client
[DX] Save a Collection's objects into a local JSON file
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 227
- Forks
- 151
- Avg merge
- 3d 14h
- Merged PRs (30d)
- 11
Description
What?
Get the objects from a Collection in Weaviate and to a local JSON file.
Why?
This helps with quick experimentation, maybe other use cases.
How?
Thinking this API:
collection = client.collections.get("WineReview")
collection.to_json(savepath="wine_reviews.json", num_samples=100) # returns bool success/fail
That pretty much just wraps the cursor API,
collection = client.collections.get("WineReview")
for item in collection.iterator():
print(item.uuid, item.properties)
And then dumps the JSON file with the savepath.
Maybe also makes the json Python library another dependency of Weaviate's Python Client (if not already).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Collection iterator API shown in the issue and trace how collection.iterator() exposes UUIDs and properties. Define the JSON export behavior around savepath and num_samples, then verify that the requested objects are written to the local file and the operation reports success or failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, data
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100