VectorDumB is a Python script that provides a simple way to store and query vectors in an SQLite database. It leverages the power of NumPy for vector manipulation and SQLite for efficient storage and retrieval of data.
To use VectorDumB, you need to have the following installed on your system:
- Python (>=3.6)
- NumPy (>=1.19)
- SQLite (usually included with Python distributions)
Follow these steps to get started with the sqlite_vector
project:
- Clone the repository to your local machine:
git clone https://github.com/DaveOkpare/sqlite_vector
- Install
numpy
:
cd sqlite_vector
pip install -r requirements.txt
# OR
pip install numpy
# Import the necessary modules in your Python script:
from vector import VectorDB
import numpy
# Create random nd.array datasets
array1 = np.arange(10)
array2 = np.arange(11, 20)
array3 = np.arange(21, 30)
# Initialize the VectorDB class and create a collection name
db = VectorDB("students")
db.create()
# Insert the arrays into the database
db.insert([array1, array2, array3])
# Search for a specific value in the database
query = np.arange(2, 11, 2)
output = db.search(query=query, num_results=1)
print(f"Results: {output}")
"""
Results: [0 1 2 3 4 5 6 7 8 9]
"""
Feel free to explore and adapt the provided example to suit your needs! For more details, check out the source code in the repository.
This project is licensed under the MIT License