Skip to main content

High-performance embedded database with Rust core and Python API

Project description

ApexBase

High-performance embedded database with Rust core and Python API

ApexBase is a high-performance embedded database powered by a Rust core, with a clean and ergonomic Python API.

โœจ Features

  • ๐Ÿš€ High performance - Rust core with batch write throughput up to 970K+ ops/s
  • ๐Ÿ“ฆ Single-file storage - custom .apex file format with no external dependencies
  • ๐Ÿ” Full-text search - NanoFTS integration with fuzzy search support
  • ๐Ÿ Python-friendly - clean API with Pandas/Polars/PyArrow integrations
  • ๐Ÿ’พ Compact storage - ~45% smaller on disk compared to traditional approaches

๐Ÿ“ฆ Installation

# Install from PyPI
pip install apexbase

# Build from source (recommended in the conda dev environment)
# conda activate dev
maturin develop --release

๐Ÿš€ Quick Start

from apexbase import ApexClient

# Create a client
client = ApexClient("./data")

# Store data
client.store({"name": "Alice", "age": 30, "city": "Beijing"})
client.store([
    {"name": "Bob", "age": 25},
    {"name": "Charlie", "age": 35}
])

# SQL query (recommended)
results = client.execute("SELECT * FROM default WHERE age > 28")

# You can also pass a WHERE expression (compatibility mode)
results2 = client.query("age > 28", limit=100)

# Retrieve by _id (_id is an internal auto-increment ID)
record = client.retrieve(0)
all_data = client.retrieve_all()

# Full-text search
client.init_fts(index_fields=["name", "city"], lazy_load=True)
doc_ids = client.search_text("Alice")
records = client.search_and_retrieve("Beijing")

# Convert to DataFrame
df = results.to_pandas()
pl_df = results.to_polars()

# Close
client.close()

๐Ÿ“Š Performance Comparison

Operation ApexBase (Rust) Baseline Speedup
Batch write (10K) 17ms 57ms 3.3x
Single read 0.01ms 0.4ms 40x
Batch read (100) 0.08ms 1.1ms 14x
Storage size 2.1 MB 3.9 MB 1.8x smaller

๐Ÿ“ Project Structure

ApexBase/
โ”œโ”€โ”€ apexbase/                    # main package
โ”‚   โ”œโ”€โ”€ src/                     # Rust source
โ”‚   โ”‚   โ”œโ”€โ”€ storage/             # storage engine
โ”‚   โ”‚   โ”œโ”€โ”€ table/               # table management
โ”‚   โ”‚   โ”œโ”€โ”€ query/               # query executor
โ”‚   โ”‚   โ”œโ”€โ”€ index/               # B-tree index
โ”‚   โ”‚   โ”œโ”€โ”€ cache/               # LRU cache
โ”‚   โ”‚   โ”œโ”€โ”€ data/                # data types
โ”‚   โ”‚   โ””โ”€โ”€ python/              # PyO3 bindings
โ”‚   โ”œโ”€โ”€ python/                  # Python wrapper
โ”‚   โ”‚   โ””โ”€โ”€ apexbase/
โ”‚   โ”‚       โ””โ”€โ”€ __init__.py      # Python API
โ”‚   โ”œโ”€โ”€ Cargo.toml
โ”‚   โ””โ”€โ”€ pyproject.toml
โ”œโ”€โ”€ Cargo.toml                   # workspace config
โ””โ”€โ”€ pyproject.toml               # project config

๐Ÿ”ง API Reference

ApexClient

# Initialization
client = ApexClient(
    dirpath="./data",           # data directory
    drop_if_exists=False,       # whether to delete existing data
    batch_size=1000,
    enable_cache=True,
    cache_size=10000,
    prefer_arrow_format=True,
    durability="fast",         # fast | safe | max
)

# Table operations
client.create_table("users")
client.use_table("users")
client.drop_table("users")
tables = client.list_tables()

# CRUD operations
client.store({"key": "value"})
client.store([{...}, {...}])
record = client.retrieve(0)
records = client.retrieve_many([1, 2, 3])
client.replace(0, {"new": "data"})
client.delete(0)
client.delete([1, 2, 3])

# Query
results = client.query("age > 30")
results = client.query("name LIKE 'A%'")
results = client.execute("SELECT name, age FROM default ORDER BY age DESC LIMIT 10")
count = client.count_rows()

# Full-text search
client.init_fts(index_fields=["title", "content"], lazy_load=True)
ids = client.search_text("keyword")
ids = client.fuzzy_search_text("keywrd")  # fuzzy search
records = client.search_and_retrieve("keyword")

# DataFrame integrations
client.from_pandas(df)
client.from_polars(df)
results.to_pandas()
results.to_polars()
results.to_arrow()

๐Ÿงช Development & Testing

# Run tests (recommended in the conda dev environment)
# conda activate dev
python run_tests.py

# Or run pytest directly
pytest -q

๐Ÿ“ฆ Release Process (GitHub Actions)

This repository provides a tag-based automated build and release workflow. When you push a v* tag, CI runs tests, builds wheels/sdist, and publishes to PyPI via twine.

  • Workflow: .github/workflows/build_release.yml
  • Tag: format like v0.4.0
  • Secret: PYPI_API_TOKEN

๐Ÿ“š Documentation

Documentation entry point: docs/README.md

๐Ÿ“„ License

Apache-2.0

Project details


Download files

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

Source Distribution

apexbase-0.4.0.tar.gz (298.3 kB view details)

Uploaded Source

Built Distributions

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

apexbase-0.4.0-cp313-cp313-win_amd64.whl (4.4 MB view details)

Uploaded CPython 3.13Windows x86-64

apexbase-0.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

apexbase-0.4.0-cp313-cp313-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

apexbase-0.4.0-cp312-cp312-win_amd64.whl (4.4 MB view details)

Uploaded CPython 3.12Windows x86-64

apexbase-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

apexbase-0.4.0-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

apexbase-0.4.0-cp311-cp311-win_amd64.whl (4.4 MB view details)

Uploaded CPython 3.11Windows x86-64

apexbase-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

apexbase-0.4.0-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

apexbase-0.4.0-cp310-cp310-win_amd64.whl (4.4 MB view details)

Uploaded CPython 3.10Windows x86-64

apexbase-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

apexbase-0.4.0-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

apexbase-0.4.0-cp39-cp39-win_amd64.whl (4.4 MB view details)

Uploaded CPython 3.9Windows x86-64

apexbase-0.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

apexbase-0.4.0-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file apexbase-0.4.0.tar.gz.

File metadata

  • Download URL: apexbase-0.4.0.tar.gz
  • Upload date:
  • Size: 298.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for apexbase-0.4.0.tar.gz
Algorithm Hash digest
SHA256 bf455d8753c80509c72c5e8f8fd7928e492d90a424c037b53ecf33dda4b6de1d
MD5 04587c58fd1d46070d6479656e6e818c
BLAKE2b-256 6c1525119a34980639818d22149313b41c09e44863103e2038df3729fc363095

See more details on using hashes here.

File details

Details for the file apexbase-0.4.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: apexbase-0.4.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 4.4 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for apexbase-0.4.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8ba623cf98c270ee96e30469dd53890e96bdd23277da4d62ca6a39cec19441e0
MD5 04431ade46bcf5dbed7930c78d83ef79
BLAKE2b-256 13e078037ca5a339d066d724070972d2977d548f1a231803e5d7aee7f9d11d9f

See more details on using hashes here.

File details

Details for the file apexbase-0.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for apexbase-0.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4e0ab14066f515e73c7eb0ad2a5a2d42b7811f98205d837f5a9e7fa8d71b1eca
MD5 e2ad0a972f95a0dcf0d41d72e56766f8
BLAKE2b-256 45a3c9fecd477f9d23999b09f7e72e730f4e617986c305edfcc05413a220e6c3

See more details on using hashes here.

File details

Details for the file apexbase-0.4.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for apexbase-0.4.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5e62dd2cb886e33e2f374c3aea544d92bc6e4aa244d367a14c1f4014c53cb551
MD5 9e5514789d4b9291cbae2529b6853e4a
BLAKE2b-256 8f7535dc37c8a1cb0c9cce390fb6f2a519abf05e56a909f33ce56b9c3495d0c2

See more details on using hashes here.

File details

Details for the file apexbase-0.4.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: apexbase-0.4.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 4.4 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for apexbase-0.4.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 77e55588dc38b8d6ddab94651232afeb8e9055455b3c45a901a5c7ab0e19bc8c
MD5 14f55a2fb57e961e99657c38c0e33433
BLAKE2b-256 0a02a286091954f7574b880c5d2d1f5babc8fa293eca2c2b4b4a531774f27846

See more details on using hashes here.

File details

Details for the file apexbase-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for apexbase-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 333d6a67cbf3e48880b077448fe6a153cccfe5216eb98ea459088c9236963eef
MD5 d4bef220fbb0f039bf139076e0649f27
BLAKE2b-256 f883f2d4311618e94e8cde971828a91902295bf2137466bfee7e64f86da3b5f1

See more details on using hashes here.

File details

Details for the file apexbase-0.4.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for apexbase-0.4.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d3e60d65222b88f5ad5413ed7cdcb671f44b9710fec6c144919cb9186c2515db
MD5 40c8a484061d45c42ca34f0e37af10ad
BLAKE2b-256 20c4809b73a75c2e352c8d29fbe18400f8665079ef98add40b4df39eaa293046

See more details on using hashes here.

File details

Details for the file apexbase-0.4.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: apexbase-0.4.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 4.4 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for apexbase-0.4.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 afcee24132be01097f63bb1cf9fb0f2ee8782d23deb54779559e4e14a56a4e66
MD5 6fb1dfc6136d748f35fc795f2621d26e
BLAKE2b-256 23adca3a9780e0bf8f93eb5bd57ae6706cfa5badaf3abab68f5dbf9776571ee9

See more details on using hashes here.

File details

Details for the file apexbase-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for apexbase-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 72162c55634bc979e3b6bba2e6cc544ae1f101338e76968f06458aa2bafc4be3
MD5 d07961f5166084873299900611cc7a10
BLAKE2b-256 6014dbf98f705909c1dbbf93fac24760144c1c2b81d57ef9efb22fab85a2b25e

See more details on using hashes here.

File details

Details for the file apexbase-0.4.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for apexbase-0.4.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 534a78899959e0d3d1d4b49a550af1dfe99503a8b4179d1b70ac269d9f0bd604
MD5 98d599c4f1893818cf8b41d0373a3fd6
BLAKE2b-256 e98e37e5505f337a792df39e666ce203ee06982942f39840cd4608070214e623

See more details on using hashes here.

File details

Details for the file apexbase-0.4.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: apexbase-0.4.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 4.4 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for apexbase-0.4.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9595e26ffdd768a9db58920a78585708b2525ea74d2cd96a7618b0c3a2e51a22
MD5 8864b4ef075b6c5ce0ae9bc11d783c77
BLAKE2b-256 e76185a13fa2c838c670eeeae1c121f76eaaeec997769f14b8cdb156b81d465e

See more details on using hashes here.

File details

Details for the file apexbase-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for apexbase-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5e43822633a82b27d8e1cfa397ec500f0d8cd3fd09ddad93b034f5880fdc2404
MD5 0befb58938a458affd3e8d23626b0ac5
BLAKE2b-256 d733c608a111c2602d5cf68c63bb3b3b346586b7f3df77918ba421321849a426

See more details on using hashes here.

File details

Details for the file apexbase-0.4.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for apexbase-0.4.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 887897a8fddaec81c92cd9eac3aac3aa0fb6f8f5bd9c5af999e7853b31c6c3f7
MD5 3ebdeeeb0453ac0b662a513f7802d69e
BLAKE2b-256 1ab4a88ce5ceff207db5dd9764549fb64101454834d13712406a43d9ffab177c

See more details on using hashes here.

File details

Details for the file apexbase-0.4.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: apexbase-0.4.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 4.4 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for apexbase-0.4.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 625f13c23fe1735e5d0d4632a6ca16b7381f8f0113e97b4c3803ca1b5769e398
MD5 1cb0b9e1cad18ca6b51b281562b26eec
BLAKE2b-256 7a52a322d7d5ec79cdfb9edec94bf4e6a61425d1d96905e35b0c1d37dbb60f34

See more details on using hashes here.

File details

Details for the file apexbase-0.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for apexbase-0.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f808facf1038cf38d5ce6e3eae3d7d47d9c752cd6be138910797e8686c232492
MD5 2f2593e53d32c69b476740fcc86a724b
BLAKE2b-256 e745755bb8ccc5185be178f0d13973ccb0e1f8e864534d4b240e180ff0f357a9

See more details on using hashes here.

File details

Details for the file apexbase-0.4.0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for apexbase-0.4.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fd1e44e3ee7f0ba4b19c0408620415a6e0eebab750f1daf0796cb32fff8087f2
MD5 d813118a7c29b06c5108681a277cc2c0
BLAKE2b-256 3dddb687c5977ac055e40bcb997b23802238282329850c1690c3a46ed8316d61

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