Skip to content

DaveOkpare/sqlite_vector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VectorDumB

Store and Query Vectors in SQLite

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.

Features

  • Efficient storage of vectors as NumPy arrays in an SQLite database.
  • Fast nearest neighbor search for query vectors based on Euclidean distance.
  • Easy-to-use and extendable with support for custom database tables and queries.
  • Support for SentenceTransformer embeddings, enabling semantic similarity searches.
  • Prerequisites

    To use VectorDumB, you need to have the following installed on your system:

    1. Python (>=3.6)
    2. NumPy (>=1.19)
    3. SQLite (usually included with Python distributions)

    Getting Started

    Follow these steps to get started with the sqlite_vector project:

    1. Clone the repository to your local machine:
    git clone https://github.com/DaveOkpare/sqlite_vector
    1. 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]
    """

    License

    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

    About

    A simple vector DB built on top of SQLite and Numpy

    Resources

    License

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published

    Languages