Skip to main content

Thin Python SDK for the mxDB bitemporal feature engine

Project description

mxDB Python SDK

mxdb is a thin Python SDK that shells out to featurectl.

For published wheels, featurectl is bundled inside the wheel and resolved automatically by MXDBClient.

Install

pip install mxdb

API Shape

The public API is namespace + entity-centric:

  • client.register_feature(namespace, feature_name, value_type)
  • row = client.entity(namespace, entity_name)
  • row.upsert(feature_id, event_time, value, write_id=None)
  • row.delete(feature_id, event_time, write_id=None)
  • row.latest(feature_id, count=...)
  • row.get()
  • row.get_range(feature_id, date_range, disk=True)

system_time is intentionally hidden in Python. write_id is auto-generated by default, but you can pass one explicitly for idempotent retries.

Equivalent featurectl commands used under the hood:

  • register <namespace> <feature_name> <value_type>
  • upsert <namespace> <entity_name> <feature_id> <event_us> <value> [write_id]
  • delete <namespace> <entity_name> <feature_id> <event_us> [write_id]
  • get <namespace> <entity_name>
  • latest <namespace> <entity_name> <feature_id> [count]
  • range <namespace> <entity_name> <feature_id> <furthest> [latest] [disk|memory]

get_range Semantics

row.get_range(feature_id, date_range, disk=True) returns a newest-first list of typed values for one feature.

  • date_range=(latest, furthest): returns values with event_time in [furthest, latest]
  • date_range=furthest: returns everything after furthest (inclusive)
  • disk=True: include values from memory + immutable segments
  • disk=False: include only values currently in memory

date_range accepts epoch micros, epoch seconds (float), datetime, YYYY:MM:DD:HH:MM:SS[.ffffff], and ISO-8601 strings.

Full Example

from datetime import datetime, timezone, timedelta

from mxdb import MXDBClient

client = MXDBClient()

# 1) Register schema in namespace "quant"
client.register_feature("quant", "f_price", "double")
client.register_feature("quant", "f_flag", "bool")
client.register_feature("quant", "f_note", "string")
client.register_feature("quant", "f_vec", "double_vector")
client.register_feature("quant", "f_size", "int64")

# 2) Bind one entity key (row/index)
aapl = client.entity("quant", "AAPL")

# 3) Write values
base = datetime(2026, 3, 9, 12, 0, 0, tzinfo=timezone.utc)
aapl.upsert("f_price", base, 101.5)
aapl.upsert("f_price", base + timedelta(seconds=5), 102.0)
aapl.upsert("f_flag", base + timedelta(seconds=1), True)
aapl.upsert("f_note", base + timedelta(seconds=2), 'quote " ok')
aapl.upsert("f_vec", base + timedelta(seconds=3), [1.0, 2.5, 3.25])
aapl.upsert("f_size", base + timedelta(seconds=4), 1_500_000)
# optional stable write_id for retry-safe idempotency
aapl.upsert("f_price", base + timedelta(seconds=5), 102.0, write_id="price-102-v1")

# 4) Latest reads
latest_price = aapl.latest("f_price")
latest_price_history = aapl.latest("f_price", count=5)
latest_price_typed = aapl.latest_double("f_price")

# 5) Get all registered features for this entity
snapshot = aapl.get()

# 6) Range reads (latest->furthest)
bounded = aapl.get_range(
    "f_price",
    ("2026:03:09:12:00:05.000", "2026:03:09:12:00:00.000"),
)
# latest omitted => everything after furthest
open_ended = aapl.get_range("f_price", "2026:03:09:12:00:00")
# memory-only view
memory_only = aapl.get_range("f_price", (base + timedelta(seconds=10), base), disk=False)
# ISO-8601 timestamps are also supported
iso_range = aapl.get_range("f_price", ("2026-03-09T12:00:05Z", base))

# 7) Delete latest value (tombstone)
aapl.delete("f_price", base + timedelta(seconds=10))
after_delete_latest = aapl.latest("f_price")         # found=False
after_delete_history = aapl.latest("f_price", 5)     # []

print(latest_price)
print(latest_price_history)
print(latest_price_typed)
print(snapshot)
print(bounded)
print(open_ended)
print(memory_only)
print(iso_range)
print(after_delete_latest)
print(after_delete_history)

Additional Example: Multi-Entity Reads

from mxdb import MXDBClient

client = MXDBClient()
client.register_feature("quant", "f_price", "double")

for symbol, px in [("AAPL", 101.5), ("MSFT", 402.25), ("NVDA", 950.0)]:
    row = client.entity("quant", symbol)
    row.upsert("f_price", 1_700_000_000_000_000, px)

snapshots = {
    symbol: client.entity("quant", symbol).get()["f_price"].value
    for symbol in ("AAPL", "MSFT", "NVDA")
}
print(snapshots)

Value Types

row.upsert(...) accepts:

  • bool -> bool
  • int -> int64
  • float -> double
  • str -> string
  • list[float] -> float_vector / double_vector (based on feature metadata)

Return Types

row.latest(..., count=1) returns TypedFeatureResult. row.latest(..., count>1) and row.get_range(...) return list[TypedFeatureResult] in newest-first order. row.get() returns dict[str, TypedFeatureResult].

TypedFeatureResult fields:

  • found: bool
  • value_type: str | None
  • value: Any | None
  • event_time_us: int | None
  • system_time_us: int | None
  • lsn: int | None

Client Methods

MXDBClient also exposes:

  • checkpoint()
  • compact()
  • set_read_only(enabled: bool)
  • backup(destination_dir: str)

Binary Resolution Order

MXDBClient resolves featurectl in this order:

  1. explicit featurectl_bin= argument
  2. MXDB_FEATURECTL_BIN environment variable
  3. bundled wheel binary payload (mxdb/bin/featurectl or mxdb/bin/featurectl.exe)
  4. featurectl on PATH

If none are found, construction fails with a clear error.

Config Resolution

MXDBClient config path behavior:

  1. MXDBClient(config_path="..."): use explicit config file.
  2. MXDBClient(): auto-create/use featured.conf under:
    • MXDB_HOME/featured.conf if MXDB_HOME is set
    • otherwise ~/.mxdb/featured.conf

This default keeps Python local-first with zero setup, while still allowing explicit config files for shared CLI/Python workflows.

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

mxdb-0.1.14.tar.gz (15.4 kB view details)

Uploaded Source

Built Distributions

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

mxdb-0.1.14-cp312-cp312-win_amd64.whl (192.3 kB view details)

Uploaded CPython 3.12Windows x86-64

mxdb-0.1.14-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

mxdb-0.1.14-cp312-cp312-macosx_11_0_arm64.whl (333.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

mxdb-0.1.14-cp311-cp311-win_amd64.whl (192.3 kB view details)

Uploaded CPython 3.11Windows x86-64

mxdb-0.1.14-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

mxdb-0.1.14-cp311-cp311-macosx_11_0_arm64.whl (333.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

mxdb-0.1.14-cp310-cp310-win_amd64.whl (192.3 kB view details)

Uploaded CPython 3.10Windows x86-64

mxdb-0.1.14-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

mxdb-0.1.14-cp310-cp310-macosx_11_0_arm64.whl (333.8 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file mxdb-0.1.14.tar.gz.

File metadata

  • Download URL: mxdb-0.1.14.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mxdb-0.1.14.tar.gz
Algorithm Hash digest
SHA256 d5e332e4a822627e3f984407868bb2374a97087997c1a66061c882f2af70b471
MD5 5d152f9f9287069f59cb65ee3d7a3290
BLAKE2b-256 073829ea3b77c9c1807462294b810f7a57495d62ec9a1948916959664e0fca2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxdb-0.1.14.tar.gz:

Publisher: python-wheels.yml on JasonCodesC/mxDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mxdb-0.1.14-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: mxdb-0.1.14-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 192.3 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mxdb-0.1.14-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 85c511dde8b18e2c13599bfbf5a68f18e2eea93b7259c608c40104047e0996ea
MD5 b8a44da7c4fcdd46d2fbe983e92035c9
BLAKE2b-256 c4cde920423b04eeb708f1edd4da2a8c7664a86fccddce8d6e24c5c800be62fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxdb-0.1.14-cp312-cp312-win_amd64.whl:

Publisher: python-wheels.yml on JasonCodesC/mxDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mxdb-0.1.14-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mxdb-0.1.14-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 46d17ce16e74bc63f9b447bfe4cb8245acf83e3d45b947d5f49b0689ddc09e32
MD5 403dee354a562a64bd89e1325e374d82
BLAKE2b-256 882b656dec5e3a3b06fe82bbf25f1bc3d1a098cae6011c15975dc74c4eaf24ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxdb-0.1.14-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python-wheels.yml on JasonCodesC/mxDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mxdb-0.1.14-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mxdb-0.1.14-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 222e00b5ee7edb3fb980d611294455fa10c73a72a3fa83983fe28b6326576145
MD5 bae5abf78843f0596ee3a5bc2727b9ed
BLAKE2b-256 586dc8026bfdcf4bc67e9806a91845f22b42e09c0959f0c1a83d18d181beccf9

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxdb-0.1.14-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: python-wheels.yml on JasonCodesC/mxDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mxdb-0.1.14-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: mxdb-0.1.14-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 192.3 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mxdb-0.1.14-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7bd974c527cef753227b309e850d4e4f269922bb6df49cf6a72b481f2e78a5ca
MD5 3a023eb8efe54cfa681f8646c0f1db5b
BLAKE2b-256 652c25431f59939a5c5784ebb28b62a9063443fa4e4b169eaef94d756d412125

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxdb-0.1.14-cp311-cp311-win_amd64.whl:

Publisher: python-wheels.yml on JasonCodesC/mxDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mxdb-0.1.14-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mxdb-0.1.14-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1b0aebbeff455f0c22190ed0be8d7743b01fef52d83c08c5cef1ca8e59d11a6c
MD5 d9110e8ea08fae47a2dae811ad27eb93
BLAKE2b-256 8e203ec3da2a1ff411cb2f04191ca33aeac8117938eda4dc0684cbf5c029d829

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxdb-0.1.14-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python-wheels.yml on JasonCodesC/mxDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mxdb-0.1.14-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mxdb-0.1.14-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dc3864606cf837972584b223435044650e0eb496103a83cb9d0c4b6bbee668ab
MD5 fee49cfbbeebf802286cb8afc1ea1480
BLAKE2b-256 755e95d402b3fbeb65959384285a34c88e8ee324a4820f71edbcfb88672ed293

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxdb-0.1.14-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: python-wheels.yml on JasonCodesC/mxDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mxdb-0.1.14-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: mxdb-0.1.14-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 192.3 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mxdb-0.1.14-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1a14e81bbb3cc4320aea08ef8b5ac8f1684afb7aba3403f854fd43f928ef4ec3
MD5 e031f7bf02d5066b13c8db094d8636c3
BLAKE2b-256 ceba1e5b398fbdd893263dd57a9b94bbcae4d3cd8fb258f5037a6769beefd74e

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxdb-0.1.14-cp310-cp310-win_amd64.whl:

Publisher: python-wheels.yml on JasonCodesC/mxDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mxdb-0.1.14-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mxdb-0.1.14-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a44163c7fba963797bc0fcd46f0761b1059716cdda787a37713d1660381e0e4e
MD5 73ba9fdbc16866433916629af0a12c29
BLAKE2b-256 ceb3b3ccc35b3c6eb63b34a367d49ecb2780b6f132a72b59c4a858c92429d9dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxdb-0.1.14-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python-wheels.yml on JasonCodesC/mxDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mxdb-0.1.14-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mxdb-0.1.14-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 678037b93db77ddc7e918d54ddcb50f1c6b1c176b4dc9aab1d734f1652cee133
MD5 09321e2013d217dcfc4f12ec7655b8fa
BLAKE2b-256 b48eff8315c1f8b377eae501b30d04e099cf00046dcaa14ed601d27bffda8833

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxdb-0.1.14-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: python-wheels.yml on JasonCodesC/mxDB

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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