Skip to main content

Python bindings for the seekdb C client

Project description

pylibseekdb

Low-level Python bindings for the seekdb C client library.

🚀 What is OceanBase seekdb?

OceanBase seekdb is an AI-native search database that unifies relational, vector, full-text, JSON, and GIS in a single engine, enabling hybrid search and in-database AI workflows.

📖 Read the launch blog → · 📚 Docs →

✨ Why seekdb for Agents?

🔥 Streaming Write + Concurrent Search, Without the P99 Spike

Agent workloads are continuous write + millisecond-later read. seekdb's async index pipeline (Change Stream) decouples DML from index build, and its two-level HNSW (incremental + snapshot) makes newly-written vectors immediately searchable.

seekdb async index pipeline architecture

The write path commits and returns without waiting on index construction. The Change Stream pipeline consumes the redo log asynchronously and updates the delta HNSW. Queries hit both delta and snapshot indexes with fine-grained read locks — this is why P99 stays flat under concurrency.

🌿 Copy-on-Write Sandboxes for Agent Exploration

FORK DATABASE snapshots an entire database in seconds — no data copy. Agents experiment freely (write, query, even break tables); then MERGE TABLE commits the work back, or DROP DATABASE discards it.

🔍 Hybrid Search in a Single SQL

Vector + full-text + scalar filter pushed into one execution plan. No N+1 client-side merging, no glue code to combine results.

🐬 MySQL-Compatible, ACID, Embeddable

Built on the proven OceanBase SQL engine. Works as an embedded library, a single-node server, or in the OceanBase distributed cluster. Full ACID, real-time writes, and the entire MySQL ecosystem out of the box.

Installation

pip install pylibseekdb

Requirements

  • CPython >= 3.11
  • Linux x86_64 with glibc >= 2.28 (Alpine / musl not supported yet)
  • macOS arm64 >= 15.5

🎬 Quick Start

pylibseekdb exposes a lightweight DB-API 2-style interface directly over the seekdb C driver. It currently starts a local seekdb runtime via open(). Native embedded-mode support will be released soon.

import pylibseekdb as seekdb

# Start a local seekdb runtime (embedded-mode support will be released soon)
seekdb.open(db_dir="./seekdb.db")

# Get a connection and a cursor
conn   = seekdb.connect(database="test", autocommit=True)
cursor = conn.cursor()

# Create a table with a vector column and an HNSW index
cursor.execute("""
    CREATE TABLE IF NOT EXISTS articles (
        id        INT PRIMARY KEY,
        title     TEXT,
        embedding VECTOR(4),
        VECTOR INDEX idx_vec (embedding)
            WITH (DISTANCE=l2, TYPE=hnsw, LIB=vsag)
    ) ORGANIZATION = HEAP
""")

# Insert a row
cursor.execute(
    "INSERT INTO articles VALUES (1, 'Hello seekdb', '[0.1, 0.2, 0.3, 0.4]')"
)

# Hybrid / vector search
cursor.execute("""
    SELECT id, title,
           l2_distance(embedding, '[0.1, 0.2, 0.3, 0.4]') AS dist
    FROM articles
    ORDER BY dist APPROXIMATE
    LIMIT 5
""")
rows = cursor.fetchall()
for row in rows:
    print(row)

cursor.close()
conn.close()

Transaction support

conn = seekdb.connect(database="test", autocommit=False)
cursor = conn.cursor()
try:
    conn.begin()
    cursor.execute("INSERT INTO articles VALUES (2, 'Second', '[0.5,0.6,0.7,0.8]')")
    conn.commit()
except seekdb.SeekdbError:
    conn.rollback()
    raise
finally:
    cursor.close()
    conn.close()

SQL — Hybrid Search

-- Create table with vector column, full-text index, and HNSW vector index
CREATE TABLE docs (
    id        INT PRIMARY KEY,
    title     TEXT,
    content   TEXT,
    embedding VECTOR(384),
    FULLTEXT INDEX idx_fts (content) WITH PARSER ik,
    VECTOR   INDEX idx_vec (embedding)
        WITH (DISTANCE=l2, TYPE=hnsw, LIB=vsag)
) ORGANIZATION = HEAP;

-- Hybrid search: vector similarity + full-text match in one query
SELECT id, title,
       l2_distance(embedding, '[0.12, 0.34, ...]') AS dist
FROM docs
WHERE MATCH(content) AGAINST('quarterly report')
ORDER BY dist APPROXIMATE
LIMIT 10;

API Reference

Module-level functions

Function Description
open(db_dir="./seekdb.db") Start a local seekdb runtime for the given database directory. Embedded-mode support will be released soon. Must be called before connect().
connect(database="test", autocommit=False) Return a Connection to the given database.

Connection

Method Description
cursor() Return a new Cursor.
begin() Begin a transaction.
commit() Commit the current transaction.
rollback() Roll back the current transaction.
close() Disconnect and release resources.

Cursor

Method Description
execute(sql) Execute sql; returns the number of rows in the result set (0 for statements without a result set).
fetchone() Return the next row as a tuple, or None.
fetchall() Return all remaining rows as a list of tuple.
close() Free the result set.

SeekdbError

Exception raised on driver errors. Subclass of RuntimeError.

📚 Use Cases

  • 🤖 Agentic AI — streaming memory writes, millisecond-later vector retrieval, FORK DATABASE for safe exploration
  • 📖 RAG & Knowledge Retrieval — hybrid search across enterprise knowledge bases
  • 🔍 Semantic Search — embedding-based search for text, images, and other modalities
  • 💻 AI-Assisted Coding — semantic code search with multi-project isolation
  • 📱 On-Device & Edge AI — lightweight local deployments today, with embedded-mode support coming soon

🌐 Resources

License

Apache-2.0 — see LICENSE.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

pylibseekdb-1.3.0.post3-cp314-cp314-manylinux_2_28_x86_64.whl (126.2 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

pylibseekdb-1.3.0.post3-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (111.1 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

pylibseekdb-1.3.0.post3-cp314-cp314-macosx_15_0_arm64.whl (111.4 MB view details)

Uploaded CPython 3.14macOS 15.0+ ARM64

pylibseekdb-1.3.0.post3-cp313-cp313-manylinux_2_28_x86_64.whl (126.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

pylibseekdb-1.3.0.post3-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (111.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

pylibseekdb-1.3.0.post3-cp313-cp313-macosx_15_0_arm64.whl (111.4 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

pylibseekdb-1.3.0.post3-cp312-cp312-manylinux_2_28_x86_64.whl (126.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

pylibseekdb-1.3.0.post3-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (111.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

pylibseekdb-1.3.0.post3-cp312-cp312-macosx_15_0_arm64.whl (111.4 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

pylibseekdb-1.3.0.post3-cp311-cp311-manylinux_2_28_x86_64.whl (126.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

pylibseekdb-1.3.0.post3-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (111.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

pylibseekdb-1.3.0.post3-cp311-cp311-macosx_15_0_arm64.whl (111.4 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

File details

Details for the file pylibseekdb-1.3.0.post3-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pylibseekdb-1.3.0.post3-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2cd976b01d410b8cb07f190eb69d20b76f97257439f1d421b9bc5939bc227aff
MD5 0a793432d88acc77c0f0197ac2228ecd
BLAKE2b-256 9e2a5ce7a6ef1c992faa094d9b53807bf221e6e76f9ce4e6c75e0bd41af34e8d

See more details on using hashes here.

File details

Details for the file pylibseekdb-1.3.0.post3-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pylibseekdb-1.3.0.post3-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5b830bde12333c28d754dcafa07eec0742c70c68b237383861375a312e878a4e
MD5 94b2e83053b51ffec4c45db4571eb48c
BLAKE2b-256 63cffdf9b38800387e8364927e6e3fc0747141ed12981abd8ea4b9537e6d86dc

See more details on using hashes here.

File details

Details for the file pylibseekdb-1.3.0.post3-cp314-cp314-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pylibseekdb-1.3.0.post3-cp314-cp314-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 d80831551c0bc89c0ec65c7dcc8307a3fc21dc8be63b7c7032cd8ff48038e421
MD5 9f207719b5b10f08b3eac7c009eee74e
BLAKE2b-256 d5e918391d35352b8a0ba34e314bcfc4618695caf582a380d37554eefdc570ca

See more details on using hashes here.

File details

Details for the file pylibseekdb-1.3.0.post3-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pylibseekdb-1.3.0.post3-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b57df3dabce5c80bf2230db2dc3f55b8eb6807a79b0884c748c0380aa34aa466
MD5 67f94477bcdf8d518dbe0f1798fc685b
BLAKE2b-256 ed50054eacf5b3a20d7c1e1966b4151c96403931b9b2a0c6e1ac95764b3890d0

See more details on using hashes here.

File details

Details for the file pylibseekdb-1.3.0.post3-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pylibseekdb-1.3.0.post3-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 aaee77db55170af5fe32a8fde4041dc3f3bf2648f25a254c2742eaa6599fad5b
MD5 57f4ea2d26d8e416a8965d06c9aedbb5
BLAKE2b-256 f9f9a1e6179b1d8963610f45d24f2c3d68bd9dc075dc541f5ee9573d7963e570

See more details on using hashes here.

File details

Details for the file pylibseekdb-1.3.0.post3-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pylibseekdb-1.3.0.post3-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 ba5e515340988e4d8906ac386497cbab0849c3ecbe5d782fd72093f4d208f94e
MD5 36bfc55738b25827b0e5714573c508fc
BLAKE2b-256 4e62a144f6a513ac659ea3bf4d65d1f800db8eb63f9c5d0c42c8c1adc5c28bd4

See more details on using hashes here.

File details

Details for the file pylibseekdb-1.3.0.post3-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pylibseekdb-1.3.0.post3-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5733828a73f9723e84cf9ca318b228e7a9bf3c66b4684e08701373a438d087c7
MD5 3fe402ed3c5da4de281141f188318433
BLAKE2b-256 c43e262eee5c442bce35f718a01b8c3a7dbb6aae4fef60dcdb1579d8fd3d6cee

See more details on using hashes here.

File details

Details for the file pylibseekdb-1.3.0.post3-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pylibseekdb-1.3.0.post3-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 fadcf644e9d1187f04d671816ac0ddb0ae88018fefd53b40eee2f81ee509bb97
MD5 18003a49f42bce3de6a40b6309c33142
BLAKE2b-256 d37d498704c1d2d3fb5788d561ee575097ec0a844b3c6a020e959d6f4d6fc0b9

See more details on using hashes here.

File details

Details for the file pylibseekdb-1.3.0.post3-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pylibseekdb-1.3.0.post3-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 58cbe0c4ed609fc67f9012760c5529858ceebe96fd79a4042cddf52b7ea4813e
MD5 753dfe42b486fed7b97b2ceffb22c856
BLAKE2b-256 e7119b3e832cb4bd86c8bc04fc4b837881274afd239d90d34de4ec216e43b8cd

See more details on using hashes here.

File details

Details for the file pylibseekdb-1.3.0.post3-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pylibseekdb-1.3.0.post3-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 514ba51eeff4a982d015c938f605ec9782aa7eedf0040af0e6adc102bd565417
MD5 1b38f25066449da43b37a4cf5a9f4782
BLAKE2b-256 a10f9a6092594b5940bae9f2c267e4cc9a923b0402349cba172ca2697e98a6d9

See more details on using hashes here.

File details

Details for the file pylibseekdb-1.3.0.post3-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pylibseekdb-1.3.0.post3-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 da1f1e8ae274281a2fb93505f688525ec50a4c02c680ebbe384313bf65862b3a
MD5 9d9fb1bb0271c4b6ca54699c12623549
BLAKE2b-256 71db38f49f9ddd500824c1036e42e4ee766592ea39180e99b2e070d56d82a66e

See more details on using hashes here.

File details

Details for the file pylibseekdb-1.3.0.post3-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pylibseekdb-1.3.0.post3-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 e89ce984e3222f5af7cb276510f208c07dfdf89c3a812b8ee56b86f869685e0e
MD5 2a194bef838c8869b1edadd6b852c9c3
BLAKE2b-256 6fb0fbe09403c8c379e90cca2f5cc117a46915fd1ed8d405a39bca273076b72f

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