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("featured.conf")

# 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("featured.conf")
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.

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.13.tar.gz (14.5 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.13-cp312-cp312-win_amd64.whl (191.6 kB view details)

Uploaded CPython 3.12Windows x86-64

mxdb-0.1.13-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.13-cp312-cp312-macosx_11_0_arm64.whl (333.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

mxdb-0.1.13-cp311-cp311-win_amd64.whl (191.6 kB view details)

Uploaded CPython 3.11Windows x86-64

mxdb-0.1.13-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.13-cp311-cp311-macosx_11_0_arm64.whl (333.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

mxdb-0.1.13-cp310-cp310-win_amd64.whl (191.6 kB view details)

Uploaded CPython 3.10Windows x86-64

mxdb-0.1.13-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.13-cp310-cp310-macosx_11_0_arm64.whl (333.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: mxdb-0.1.13.tar.gz
  • Upload date:
  • Size: 14.5 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.13.tar.gz
Algorithm Hash digest
SHA256 e8dfca26238aae3f9ad430e0d0a5f38ead092c1db0a0bcf86b4dcf8ae860d046
MD5 fa5941bb7fef971d2e400e0a8e51a9f2
BLAKE2b-256 d977688a3150b15cf1964ebd3e26cf20395b4d8ac247e329d712bc3d7c0af0a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxdb-0.1.13.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.13-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: mxdb-0.1.13-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 191.6 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.13-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8fab358a33178c803f923e20000f6895c249fd5393b1079e1fa96419493fc95b
MD5 7251c64884b734dcc8c1a441e112296f
BLAKE2b-256 07b5b0de15c36d81274e366448eb1062027a39e220530a90d75eba482157f177

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxdb-0.1.13-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.13-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mxdb-0.1.13-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9455b55f3316c68cbe26afddcc12426f21a11f4316a6feec5311650b37c2d115
MD5 3a6fd73a980d6da0db7c40934a191bd7
BLAKE2b-256 e47d7433d0de422d2f09b6b9472d23a18826a2632819143c369ea15139e3b2d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxdb-0.1.13-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.13-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mxdb-0.1.13-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b824bc4a572bd535471453ee0eece176ffe623fd16434cc88f1c1d43b41d14d3
MD5 2119649a56107b4745aafa8b75616041
BLAKE2b-256 a26b553f2fa219cb5a92b77ec06fd2f253fec5e037517d4134c37595d3aafe31

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxdb-0.1.13-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.13-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: mxdb-0.1.13-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 191.6 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.13-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c0bd77f6498d325e9756e1e554663339c0ffdfa365ff93e62dd9a9c14438b6fe
MD5 3e17d3e1581cedc96fd426bc65aefd08
BLAKE2b-256 aeec7a4c94cba3911a3dbc68d9e1fbba81067c30044b89f16c2eddbf2ab932d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxdb-0.1.13-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.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mxdb-0.1.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a24ba1b2e36337a59b68f6502363fe16dbfffd51d97a6129ceaf9575f06675c9
MD5 a3c5fec70dcf3330273e433cfce2c016
BLAKE2b-256 14374d4272cd1ba4432bd1f6b184b8abd1437efcd63c2f72ed84e5a192e84777

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxdb-0.1.13-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.13-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mxdb-0.1.13-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c2c915c3f3d4a0ad2edc6aa92fb6cc1ad4f4012221479429b74fec88923adf00
MD5 8fdfd1c71b647fd16f9d83f75b3534fb
BLAKE2b-256 83ce65117d75ddb2ebea11a9387cd8ee794109ad72078eec7ebf981adf569ab3

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxdb-0.1.13-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.13-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: mxdb-0.1.13-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 191.6 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.13-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d9f5f4dd0616a38b9ae2a8f1c6c20ef3522d2f6b1ef4199aa5ab2a451b6a68b7
MD5 1e89825fc637df177d7b61c57768ebdb
BLAKE2b-256 127f720c6d6a3a6603b381cb4009b243c03ccd794bbb7334a36f901b93644709

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxdb-0.1.13-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.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mxdb-0.1.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f739a20b73d83aecdba348f2e4948ca663a00ae9d5cbd4b8175c9f0b88597d6e
MD5 34b743c2c3502f449bb72e68a77557ce
BLAKE2b-256 42b0547477c15c0a3e44ac8d7ad936139be05ddb36121151e49adc7130cb60ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxdb-0.1.13-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.13-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mxdb-0.1.13-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 04690d381671948acfa225fcf6580c0598329b6a3731ee7a7cae3717ac607630
MD5 6d76c86090f821e5adc06d12176a1fe9
BLAKE2b-256 8011a7e108ebf0cfab0e7ea19aec765b897dbf204db1ff1b6307f5c85ec3a4a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for mxdb-0.1.13-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