weaviate / weaviate/weaviate-python-client

[DX] Save a Collection's objects into a local JSON file

Open
#1,172 1 comment 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.