mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 02:48:13 -05:00
[PR #21931] [MERGED] feat: add MariaDB Vector backend #26344
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/21931
Author: @seulement55
Created: 2/27/2026
Status: ✅ Merged
Merged: 3/8/2026
Merged by: @tjbck
Base:
dev← Head:Add-support-mariadb-vector-capabilities📝 Commits (1)
a67bb72Add support for mariadb-vector as backing vector DB📊 Changes
7 files changed (+653 additions, -0 deletions)
View changed files
📝
Dockerfile(+1 -0)📝
backend/open_webui/config.py(+72 -0)➕
backend/open_webui/retrieval/vector/dbs/mariadb_vector.py(+570 -0)📝
backend/open_webui/retrieval/vector/factory.py(+4 -0)📝
backend/open_webui/retrieval/vector/type.py(+1 -0)📝
backend/requirements.txt(+1 -0)📝
pyproject.toml(+4 -0)📄 Description
Pull Request Checklist
devbranch. PRs targetingmainwill be immediately closed.devto ensure no unrelated commits (e.g. frommain) are included. Push updates to the existing PR branch instead of closing and reopening.Description
This PR adds MariaDB Vector as a supported vector database backend in Open-WebUI, enabling
VECTOR_DB=mariadb-vectordeployments. The implementation uses the official MariaDB connector (mariadb+mariadbconnector://...) to ensure correct parameter binding ofVECTOR(n)values (float32 binary payload), and provides configurable index and pooling parameters.This work addresses the request to support MariaDB as a vector database backend (see discussion https://github.com/open-webui/open-webui/discussions/21363).
Key changes
Adds a new
mariadb-vectorvector database backend, including configuration/env support and factory wiring, plus a MariaDB Vector client implementation that initializes the required schema and performs insert/upsert/search operations using the official MariaDB connector for correctVECTOR(n)float32 binding. Updates container and Python dependencies to include MariaDB driver support, and exposes tuning knobs for vector length, distance strategy, HNSWM, and connection pooling.Schema and compatibility notes
VECTOR INDEX. This backend usesid VARCHAR(254) CHARACTER SET ascii COLLATE ascii_bin PRIMARY KEYto ensure the PK stays under the 256-byte limit and comparisons are stable.VECTOR(n)mismatch and fails fast if the configured dimension differs from the stored column dimension.Dependencies
New dependency added:
mariadb==1.1.14(Python driver), pluslibmariadb-devin the container image.Rationale:
VECTOR(n)values as float32 binary payloads; the official MariaDB connector provides the expected driver behavior and qmark paramstyle.Compatibility notes:
MARIADB_VECTOR_DB_URLmust usemariadb+mariadbconnector://...(official driver).VECTORandVECTOR INDEXfeatures.Testing
Manual test (repro steps)
1) Build image
2) Start Open-WebUI (Postgres main DB + MariaDB Vector DB)
3) Configure RAG in the UI
Follow the official RAG tutorial: https://docs.openwebui.com/tutorials/tips/rag-tutorial/#setup
4) Validate ingestion + retrieval
Observed results
When comparing similarity search results between
mariadb-vectorandpgvectorusing Open-WebUI documentation as the knowledge base andllama3.1:8bas the base model, retrieval outcomes were similar in most cases, with no major differences observed.Documentation
I will add documentation to https://github.com/open-webui/docs covering: https://github.com/open-webui/docs/pull/1125
VECTOR_DB=mariadb-vectorsetupMARIADB_VECTOR_*environment variablesmariadb+mariadbconnector://...Screenshots
Knowledge Base ingestion

Example RAG answers with sources.

Changelog Entry
Description
VECTORandVECTOR INDEXfeatures.Added
mariadb-vectoras a vector database backend for RAG retrieval, including newMARIADB_VECTOR_*configuration options and a MariaDB Vector client implementation for insert/upsert/search. Requires the official MariaDB connector scheme (mariadb+mariadbconnector://) for correctVECTOR(n)binding.Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.