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.post2-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.post2-cp314-cp314-manylinux_2_28_aarch64.whl (88.7 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.14macOS 15.0+ ARM64

pylibseekdb-1.3.0.post2-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.post2-cp313-cp313-manylinux_2_28_aarch64.whl (88.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.13macOS 15.0+ ARM64

pylibseekdb-1.3.0.post2-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.post2-cp312-cp312-manylinux_2_28_aarch64.whl (88.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.12macOS 15.0+ ARM64

pylibseekdb-1.3.0.post2-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.post2-cp311-cp311-manylinux_2_28_aarch64.whl (88.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

pylibseekdb-1.3.0.post2-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.post2-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pylibseekdb-1.3.0.post2-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2c6c6f7d60c5e1b0736a6dc53ad896dd055b9cd226ae31e1702565ec9e03e32f
MD5 3f2b2b3a693f2a4244963a9037d7131f
BLAKE2b-256 1768a37dd599348de50790aab4567f1db50140093dec8f0ffb7b908889d13bf6

See more details on using hashes here.

File details

Details for the file pylibseekdb-1.3.0.post2-cp314-cp314-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pylibseekdb-1.3.0.post2-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4c340bb4e2e58cafe96b24ce2246591ce3d68ab267c8ac74c0174a65d8e1cf4a
MD5 ebcd99fb356f38660687b63c9a53bd71
BLAKE2b-256 7182080a83b4b1872e0d83c7608b81d908ac0d0af4cc1f28a81ed042c34dc22f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pylibseekdb-1.3.0.post2-cp314-cp314-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 c91509cab2e1fc8d1c155d4ed51eda1aa96ed3d8a6bb08c1804723712fd1a348
MD5 7d15621d5380fd3596aa9235f7cf5b7a
BLAKE2b-256 82161e66b8caa0bdee1f6b49785478ac83285cb196c1d75b14fe86eb63226465

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pylibseekdb-1.3.0.post2-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f49605c0db72183737c446f3730a3fbe3ae70e6163490bcfaf533e763d9072fc
MD5 419f8c55eeadb10ccd5b556ccb576863
BLAKE2b-256 59403bc3acfa3968e50add2760cc40ab068b155c54036f5009c5b99d66b018f8

See more details on using hashes here.

File details

Details for the file pylibseekdb-1.3.0.post2-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pylibseekdb-1.3.0.post2-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e2d0980654018e96ddab8a722fb88c3e27d58a58cb256fb497cbed44143f4d0f
MD5 6f63e6e3cc92701c7a463d337f307f5a
BLAKE2b-256 5f21af704eb87a744782183adc1efe41628c6d53118a52d36c0f078637aa205c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pylibseekdb-1.3.0.post2-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 ff8cd736496fe30e70789c5207fb214b687236d03bfb8473a3721c6113dccbf9
MD5 732cfb564fc7f4157522b2ff8ea693c1
BLAKE2b-256 838edf505e4b10f6fc909a81f61d5064364abcecf73a3f54f365bd518069f6f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pylibseekdb-1.3.0.post2-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d0ef75b6f35c2686238c573f0fa1075b2f3c054d441ae9a907e3ff68d732f65d
MD5 c7b7805487040767cfb64bfbb5cf457b
BLAKE2b-256 7b514ce05677cff75b01f0322c2cce1472f8fb37ea420a5525d417b11c825a5a

See more details on using hashes here.

File details

Details for the file pylibseekdb-1.3.0.post2-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pylibseekdb-1.3.0.post2-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1f2a55eb5646fecfacafd0241339709feec9dff59b852bd1aee3db408b87a412
MD5 a69ce91216b9680799622e5b6803bb72
BLAKE2b-256 428b8595c0996b80144a96e051eeb5f77766b1b6d7674b928f722b01c1298e26

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pylibseekdb-1.3.0.post2-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 21bf563aa8b7d990a73b9e6ec5f8a83aedc2845a28381b7ced6c25603cd0ffef
MD5 2d98d3043e002e6ec620b7ebf660f0a9
BLAKE2b-256 89c8bf8858259c2ae1c43bc530c0b289de66b7563c50694787152dbb4c8415ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pylibseekdb-1.3.0.post2-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8ed2edef2ac70f52a2562313d7007e8d3977b694c022c0253acc1c6145231dd4
MD5 a041769f3acdb0a1542585682910e7ea
BLAKE2b-256 3da6123641847d9d43bd8b9d761669594140d0c3f78e55e5dcd5a3ad76cf0bda

See more details on using hashes here.

File details

Details for the file pylibseekdb-1.3.0.post2-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pylibseekdb-1.3.0.post2-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 cedf59067c648e37eab9f15eec122be508353f76ac1871506f5aba51d0bd57f5
MD5 a42839b2719ff89acff49a92b0949d97
BLAKE2b-256 d09d06c54c3276f74a5512c106cc4361dce871b648185087b3a56b6cbc29aa47

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pylibseekdb-1.3.0.post2-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 1c8a90368970e0c761a832754deeb3459f6a8365ba019f52c9f7b75e0cae8010
MD5 36ba222851b1b98f9f5fa2bc5c29af1f
BLAKE2b-256 20cfc4747e0af14fa92bfc94c228bd28a57d58db99a4c020a59eb4de96071cae

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