Skip to main content

Image Index Importer for BeaverDB

A command-line tool to import image index files (generated by siglip2-image-indexer) into a BeaverDB database for vector search.

This tool uses the full path of each image as its unique ID. Running the importer multiple times with the same or updated index files automatically updates existing entries and adds new ones (an "upsert" operation), preventing duplicates.

Installation

The tool can be installed using two methods. The key dependencies, including beaver-db[full], tqdm, and PyYAML, will be installed automatically.

If the package is published on PyPI, you can install it directly:

pip install beaver-index-importer

2. Install from Source (For Developers)

To install the package in editable mode for development or using the latest source code:

  1. Clone the Repository:
  2. Access the Directory: Navigate into the cloned directory, which is beaver-index-importer.
  3. Install in Editable Mode:
# Clone your repository
git clone https://github.com/yudivian/beaver-index-importer
cd beaver-index-importer

# Install the package in editable mode
pip install -e .

Usage

You can run the importer using command-line arguments, a YAML configuration file, or a combination of both. Command-line arguments will always take precedence over settings in the configuration file.

1. Using Command-Line Arguments

The most direct way is to provide all parameters via the command line.

beaver-index-importer --index-file /path/to/your/image_index.jsonl --db-file /path/to/your/images.db

2. Using a Configuration File

For easier management, you can define your settings in a YAML file (e.g., config.yml).

Example config.yml:

index_file: /path/to/your/image_index.jsonl
db_file: /path/to/your/images.db
collection: my_image_collection
mode: upsert

Then, run the importer by pointing it to your config file:

beaver-index-importer --config config.yml

Execution Examples

Here are simple examples demonstrating how to run the importer using different modes and configurations.

Operation Mode Purpose Command Example
upsert (Default). Updates existing and inserts new. beaver-index-importer --index-file index.jsonl --db-file images.db --mode upsert
rebuild Deletes the entire collection before importing. beaver-index-importer --index-file index.jsonl --db-file images.db --mode rebuild
insert-only Only adds documents that do not exist; ignores existing ones. beaver-index-importer --index-file index.jsonl --db-file images.db --mode insert-only
update-only Only updates existing documents; ignores new ones. beaver-index-importer --index-file index.jsonl --db-file images.db --mode update-only
sync Performs upsert and then removes documents from the DB that are missing from the index file. beaver-index-importer --index-file index.jsonl --db-file images.db --mode sync
--collection Imports to a collection with a specific name. beaver-index-importer --index-file index.jsonl --db-file images.db --collection my_photos

Import Modes

The tool supports five different modes of operation, controlled by the --mode argument (or mode in the config file).

Mode Description Behavior
upsert (Default) Update or Insert. Uses the image path as a unique ID. It updates existing documents and inserts new ones. Ideal for incremental synchronization.
rebuild Clear and Re-insert. Completely deletes all documents from the collection before importing the new data. Use to start from a clean slate.
insert-only Insert New Documents Only. Only inserts documents that do not have an existing ID in the database. Existing documents are skipped (not updated).
update-only Update Existing Documents Only. Only updates documents that already exist in the database. New documents from the index file are skipped (not inserted).
sync Mirror/Synchronize. Performs an upsert of all index file documents, and then removes any documents from the database that are missing from the current index file. This ensures the database exactly mirrors the index source.

All Options

Argument Short Description Default
--config -c Path to a YAML configuration file. None
--index-file Path to the .jsonl or .pkl index file to import. Required
--db-file Path to the BeaverDB database file to create or update. Required
--collection The name of the collection to use inside the database. images
--mode The import strategy: upsert, rebuild, insert-only, update-only, or sync. upsert

Metadata

Release files for beaver-index-importer 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for beaver-index-importer 0.1.2
File Size Uploaded Provenance Actions
beaver_index_importer-0.1.2.tar.gz 6.7 kB Without provenance Details for beaver_index_importer-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for beaver-index-importer 0.1.2
File Interpreter ABI Platform Actions
beaver_index_importer-0.1.2-py3-none-any.whl Python 3 none any Details for beaver_index_importer-0.1.2-py3-none-any.whl

Total release size: 13.4 kB

Release files / beaver_index_importer-0.1.2.tar.gz

Download URL beaver_index_importer-0.1.2.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d0d66365e15fde469a47f6a897faa4d65f742c1c92ddebe01449e11f33fcdd65
BLAKE2b-256 checksum
How to use checksums
279a0b6c588100484c16a468987dc0e4de37e4c159a091b936980d9b9102e5c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release files / beaver_index_importer-0.1.2-py3-none-any.whl

Download URL beaver_index_importer-0.1.2-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
50d8f48d14e6d7b00fd2f94e17384af3496bda3ac38fd87b20024e58209447f3
BLAKE2b-256 checksum
How to use checksums
da94c76aa83d64fa4505bd0aa3d281c48d2d8d69dfd752d0253faf6e5dd63a0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Security for beaver-index-importer 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page