Skip to main content

Django ORM & Python library for MariaDB Vector support

Project description

mariax

MariaDB extended helpers focused on Vector support.

Architecture

                 ┌───────────────────────┐
                 │   Python App          │
                 │(Django / Raw Scripts) │
                 └─────────┬─────────────┘
                           │
             ┌─────────────▼─────────────┐
             │       Library Layer       │
             │       (Mariax)            │
             └─────────────┬─────────────┘
                           │
           ┌───────────────┴───────────────┐
           │                               │
    ┌──────▼──────┐                 ┌──────▼──────┐
    │ Django ORM  │                 │ SQL/CLI     │
    │ Integration │                 │ Utilities   │
    │ (VectorField│                 │ (DBClient,  │
    │ + Manager)  │                 │ DDL helpers │
    │ + QuerySet) │                 │ query.py)   │
    └──────┬──────┘                 └──────┬──────┘
           │                               │
           │                               │
           ▼                               ▼
    ┌───────────────┐                ┌───────────────┐
    │ Vector Utils  │                │ MariaDB 11.x  │
    │ (serialize /  │<──────────────>│ Vector Column │
    │ deserialize)  │                │ + Vector Index│
    └───────────────┘                └───────────────┘

TL;DR

  • Low-level DB client (client.py)
  • Vector utilities (vector.py)
  • DDL helpers (ddl.py)
  • Raw vector query function (query.py)
  • CLI tool for index management (cli.py)
  • Django ORM integration (VectorField, VectorManager)
  • SQLAlchemy integration (VectorType)

Installation

pip install mariax

Example DDL

from mariax.django_integration.fields import VectorField
from mariax.django_integration.managers import VectorManager

class Document(models.Model):
    title = models.CharField(max_length=255)
    embedding = VectorField(dim=768)

    objects = VectorManager()

Example Query

similarity_search(db_client, table="docs", embedding_field="embedding", vector=[...], top_k=5)
# OR
top_docs = Document.objects.similarity_search(query_vector, top_k=5)

Example CLI

mariax create-index --table docs --name idx_docs_embedding --fields embedding --distance cosine

Project details


Release history Release notifications | RSS feed

This version

1.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mariax-1.1.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mariax-1.1-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file mariax-1.1.tar.gz.

File metadata

  • Download URL: mariax-1.1.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for mariax-1.1.tar.gz
Algorithm Hash digest
SHA256 00f4e7a68af8ba7259ad9b6b6c71afa62754f809b95580fb0633b89eee8a02b7
MD5 cf3275db549218f723e3d40a1d82f6a6
BLAKE2b-256 246c6f353f504d408602922b7e4625133b062290cedb33212fcc7d4d7581f933

See more details on using hashes here.

File details

Details for the file mariax-1.1-py3-none-any.whl.

File metadata

  • Download URL: mariax-1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for mariax-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7cca3c68ae0b7c5f4348c89edcee08742dc0f329342c2265e892c266ba079b9d
MD5 b277c8f2f66b22c889177e3f1262283b
BLAKE2b-256 e016bf7e6456c1091652b079008a686499bf08a080c48b621b4f7afff452159c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page