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.3.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.3.0.tar.gz (293.0 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.3.0-cp313-cp313-win_amd64.whl (4.2 MB view details)

Uploaded CPython 3.13Windows x86-64

apexbase-0.3.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

apexbase-0.3.0-cp313-cp313-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

apexbase-0.3.0-cp312-cp312-win_amd64.whl (4.2 MB view details)

Uploaded CPython 3.12Windows x86-64

apexbase-0.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

apexbase-0.3.0-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

apexbase-0.3.0-cp311-cp311-win_amd64.whl (4.2 MB view details)

Uploaded CPython 3.11Windows x86-64

apexbase-0.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

apexbase-0.3.0-cp311-cp311-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

apexbase-0.3.0-cp310-cp310-win_amd64.whl (4.3 MB view details)

Uploaded CPython 3.10Windows x86-64

apexbase-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

apexbase-0.3.0-cp310-cp310-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

apexbase-0.3.0-cp39-cp39-win_amd64.whl (4.2 MB view details)

Uploaded CPython 3.9Windows x86-64

apexbase-0.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

apexbase-0.3.0-cp39-cp39-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for apexbase-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1366af9d675bfc4490205f53fc4dde1c5f32695e7882e139ba355a1fb3824b9a
MD5 1aa81d9e9f3a7f2a8a253c94f33bf77a
BLAKE2b-256 62ba3828ea55b1517f7377ed2b2bdde883a482c0e197651c13a7d88eac62f40b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: apexbase-0.3.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 4.2 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.3.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 cb76e0b4f088558bbdbea26bbaeef0bb463b61fb468724a965ed5eec14389904
MD5 578ee12d82b7c438de343f16ffdc3a99
BLAKE2b-256 59754aeaf3c782d48ca40638cf98954b81aaf89b2f27a64378b7d77fb49d6383

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for apexbase-0.3.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 479a69a9d1d348b6f1b7db2f87658588dc9d10888350d45809f0cf7ccbf14057
MD5 f93fe6b59a3e0d612e94215a4c66c5a6
BLAKE2b-256 a763a32299fe48c36b101a8a76fd56e03b7a7fb360d4485a63dc1733b3931e44

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for apexbase-0.3.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5b94575a4b715e7b740a4760a74111d9da3ca4c4e629587b11c106a4e7b3b197
MD5 3d3759244b2c132f0170830efbfbbb04
BLAKE2b-256 e1a06f2e6bf1d7fc75b0f94ff23eed82c855ad0e93efee1e447e3e973c994354

See more details on using hashes here.

File details

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

File metadata

  • Download URL: apexbase-0.3.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 4.2 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.3.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 31eecdabc22f1369069a70324d13729349d7bc31b559d1b60edcb482ea97cebc
MD5 1b4401556252e690db8b78e712cbb8e2
BLAKE2b-256 15f0f05d6f6a285755c50416c82336f44dd332814170988ffe39f0c884e3104d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for apexbase-0.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0f14dfeb21dd6658a79271d047ce4ac946951c9d9f5745d24d3f56e368e7a391
MD5 453d04d1ab7b346def77ed857299e01c
BLAKE2b-256 75714e2ccf3e350323b341a6ca0fca656f9dd2d5a2f2ae1f4559d53919ae567b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for apexbase-0.3.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 83e76c62686d7a9bde8a66a5320ab201fe6f1871d8663acd10ab91b5ce45d09e
MD5 e9060f4a2fa8766faa9bfc6f64b6a4ef
BLAKE2b-256 40e001f6136726a09956eb7aa5ce0510039b40ec678ddf2f4702c8b7fe86d247

See more details on using hashes here.

File details

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

File metadata

  • Download URL: apexbase-0.3.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 4.2 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.3.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 06b95893bc8993c574e4d87d6463d46fe6ed9f5840951eaec109ffcae9dac703
MD5 6de043c5ffd1c9ea85f2644d14a7b12b
BLAKE2b-256 bbe88c01798177ef7179c6d50959d2ac5df13acfe04a3f9bd270af59db45d573

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for apexbase-0.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cac44faff6d52896402724c03a5058a7f4e7784b7f9c39489354572e9ddc3183
MD5 7ebf03f87ef5e923a7d44299bd83e4c2
BLAKE2b-256 6ef0fc892de893c0f34b035af68650ed69dccfcb1b93544c230397d81b846316

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for apexbase-0.3.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2da65aaa2aec79f0e734f47506a440413b91345f5959ef8ee1aa418e3e191b73
MD5 f68c7119b51f4c767eab056e0154c2db
BLAKE2b-256 d0bfc9608fa61344febcc14e205c5fcec038ef159888dc795d8561d8a73c46d3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: apexbase-0.3.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 4.3 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.3.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 fd61d103291f355ea0d7b28884f24e666d4fb45a68515848b601c731c9e9acb5
MD5 abee41c9761e9355c3bbc359e0b1dd27
BLAKE2b-256 76e784261742ec8de8eaa754b58697c094c4b601f77460a4a6cccbaba88677c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for apexbase-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 220c432de31264ce54731916373a3c4aeeaed06ce7ef44dc9bf89b3edc1b5eed
MD5 1eebc8420fb4a94eb229235b13500bda
BLAKE2b-256 0193d35fa03a31830b2df9c6d421752250072693eb6016bdfbf1266ae21f2908

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for apexbase-0.3.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 79f0544fcfbe9fc4c9cac0e0d7cd89fcf8eafc4451d240871e69fdba952903a7
MD5 487b75e4e6fcf53fde9628eaf27937f7
BLAKE2b-256 4e266ae999635878ffc6cdad12151d975b523e458eaf3dfe6b81b8de48154e48

See more details on using hashes here.

File details

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

File metadata

  • Download URL: apexbase-0.3.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 4.2 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.3.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 ef709a7afa479acb4001ff928a9f7c062959b4994b5c18ca663d7fa6d4c777d1
MD5 e16028f3ee9d9efc8c68c50d093b5a6f
BLAKE2b-256 5821d27598d04bc7aa981f8e1343a00bd44fa4aa72983661d0185c51ca0c7989

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for apexbase-0.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5a16d01e91c352b4ea388d8ce00835cd400bee1d131208bc16372060f8512116
MD5 29acbad328e7250111d1e3f7d23df2ca
BLAKE2b-256 fe7d2016da9f27188638b626aa92050060514052ca456765719700d4af309144

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for apexbase-0.3.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d47fef5c734951617dfdfcdb26a7764fb018231e97982ac0741f4bf7def845db
MD5 5fa1c09da9ce1de5ffef5f09caf546f2
BLAKE2b-256 9d7008fa4732e6d854223867beddc7a628e6f66a84f4be8db5ff63d62c41f6bd

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