Skip to main content

FastCarto database bindings

Project description

fastdb (WIP)

PyPI version Run Tests

Wait and hope for the best...

A C++ local database library with cross language bindings. Aiming to be a fast, lightweight, and easy-to-use data communication solution for RPC and coupled modeling in scientific computing.

What's new

  • 2026-03-04 (Memory Overflow Improvement): Enhanced the MemoryStream implementation to handle large data sizes exceeding 4GB without causing size overflow in chunk_data_t.size (u32). This improvement allows for more robust handling of large datasets in memory. (PR #22)
  • 2026-02-28 (Release Improvement): Fix bugs related to build process in Windows. (PR #20)
  • 2025-12-31(Bug Fix): Fixed an issue where shared memory segments were not being properly unregistered from the resource tracker upon closing, which could lead to resource leaks. (PR #17)
  • 2025-12-15 (Release Improvement): Enabled distribution of pre-compiled binary wheels for macOS (Intel/Apple Silicon) and Linux (x86_64/aarch64), eliminating the need for local compilation tools during installation. (PR #15)
  • 2025-12-10 (Bug Fix): Fixed the data type mapping for U32 fields in Python bindings to ensure correct representation as unsigned 32-bit integers in NumPy arrays. (PR #13)
  • 2025-12-10 (Bug Fix): Fixed an out-of-bounds access issue in FastVectorDbLayer::Impl::getFieldOffset() when the field index is equal to the field count. (PR #12)
  • 2025-12-10 (Performance Improvement): Modified ORM.truncate() to support directly allocating features without initializing them for performance consideration. Note that this change may have side effects; please test thoroughly. (PR #11)

Installation

You can install the Python package of fastdb via pip:

pip install fastdb4py

Note: Pre-compiled binary wheels are provided for major platforms (macOS-Intel/macOS-Apple Silicon, Linux-Ubuntu, Windows-AMD64). For other systems, the package will build from source, requiring a C++ compiler and CMake.

Usage

1. Define a Feature (Schema)

To use fastdb, you first need to define your data schema by subclassing fastdb4py.Feature. Use type hints to define the fields of your feature.

import fastdb4py

class Point(fastdb4py.Feature):
    x: fastdb4py.F64
    y: fastdb4py.F64

2. Create and Initialize a Database

You can create a new database or truncate an existing one using fastdb4py.ORM.truncate. This function takes a list of TableDefn objects, specifying the feature class and the initial capacity (number of rows).

from pathlib import Path

# specific the path for the database
DB_PATH = "my_fastdb_data"

# Create a new database with a table for 'Point' features, capacity 1000
# The name parameter is optional; if not provided, a default name will be generated based on the feature class name.
# In this example, we explicitly set the table name to 'points'.
db = fastdb4py.ORM.truncate([
    fastdb4py.TableDefn(Point, 1000, name='points'),
])

3. Write Data

You can access the table using the feature class as a key. Features can be accessed by index or iterated over.

# Access the table 'points' with schema defined by the Point feature class
points_table = db[Point]['points']
# If you did not specify the table name when creating the database, you can access it using the default name:
# points_table = db[Point][Point]
# or
# points_table = db[Point]['Point']

# Ensure we are in write mode (if loaded from file later)
# For a newly created DB in memory, we are already good to go.

for i in range(10):
    # Access the feature at index i
    p = points_table[i]
    
    # Set field values
    p.x = i * 1.5
    p.y = i * 2.5
    p.label = f"point_{i}"

# Save the database to disk
db.save(DB_PATH)

4. Read and Modify Data (Columnar Access)

fastdb supports high-performance columnar access using NumPy arrays. This allows for vectorized operations on your data.

# Load the database from disk
db = fastdb4py.ORM.load(DB_PATH, from_file=True)
points_table = db[Point]['points']

# The length of the table (number of rows) can be obtained using len()
print(f"Number of points: {len(points_table)}")

# Access fields as numpy arrays via the `.column` property
xs = points_table.column.x
ys = points_table.column.y

print(f"First 5 X values: {xs[:5]}")

# Modify data in bulk using numpy operations
# This modifies the data in memory directly!
xs += 10.0 

# Verify the change via object access
print(f"Point 0 x: {points_table[0].x}")  # Should be 0 * 1.5 + 10.0 = 10.0

Development Environment

This project uses DevContainer for development environment. Please refer to the .devcontainer/devcontainer.example.json file for configuration details.

For setting up the development environment, ensure you have Docker / Podman and VSCode DevContainer extension installed. Open the project in VSCode and create the .devcontainer/devcontainer.json file based on the example provided.

After connecting to the DevContainer, you can develop and test the project within the containerized environment.

Python-Related Development

The py_utils.sh script is provided to facilitate common development tasks related to the Python bindings of fastdb. When first launching the DevContainer, py_utils.sh will automatically set up a Python virtual environment and install the necessary dependencies.

Cleaning Builds

# This operation will remove C++ build artifacts and the core Python bindings (fastdb.core, auto-generated by SWIG) within the Python package.
./py_utils.sh --clean

Building

# This operation will build the C++ core library and the Python bindings.
./py_utils.sh --build

Testing

# This operation will run the Python unit tests for the fastdb package.
./py_utils.sh --test

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

fastdb4py-0.1.11.tar.gz (598.2 kB view details)

Uploaded Source

Built Distributions

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

fastdb4py-0.1.11-cp313-cp313-win_amd64.whl (184.3 kB view details)

Uploaded CPython 3.13Windows x86-64

fastdb4py-0.1.11-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (607.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

fastdb4py-0.1.11-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (577.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

fastdb4py-0.1.11-cp313-cp313-macosx_11_0_arm64.whl (474.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

fastdb4py-0.1.11-cp313-cp313-macosx_10_13_x86_64.whl (526.9 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

fastdb4py-0.1.11-cp312-cp312-win_amd64.whl (184.5 kB view details)

Uploaded CPython 3.12Windows x86-64

fastdb4py-0.1.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (607.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

fastdb4py-0.1.11-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (578.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

fastdb4py-0.1.11-cp312-cp312-macosx_11_0_arm64.whl (475.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

fastdb4py-0.1.11-cp312-cp312-macosx_10_13_x86_64.whl (527.4 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

fastdb4py-0.1.11-cp311-cp311-win_amd64.whl (183.5 kB view details)

Uploaded CPython 3.11Windows x86-64

fastdb4py-0.1.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (606.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

fastdb4py-0.1.11-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (577.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

fastdb4py-0.1.11-cp311-cp311-macosx_11_0_arm64.whl (474.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

fastdb4py-0.1.11-cp311-cp311-macosx_10_9_x86_64.whl (528.3 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

fastdb4py-0.1.11-cp310-cp310-win_amd64.whl (183.4 kB view details)

Uploaded CPython 3.10Windows x86-64

fastdb4py-0.1.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (606.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

fastdb4py-0.1.11-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (577.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

fastdb4py-0.1.11-cp310-cp310-macosx_11_0_arm64.whl (474.6 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

fastdb4py-0.1.11-cp310-cp310-macosx_10_9_x86_64.whl (528.3 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file fastdb4py-0.1.11.tar.gz.

File metadata

  • Download URL: fastdb4py-0.1.11.tar.gz
  • Upload date:
  • Size: 598.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fastdb4py-0.1.11.tar.gz
Algorithm Hash digest
SHA256 45d5cfdf085d272caac9b8e6ae0c1c52b4bf9b1c9f6cf5461aa074f7d7bede2b
MD5 fc588f5c4bf07c82d0974519364e6fa6
BLAKE2b-256 fd4af2f420d699982a1b746e54d5a7e1a87248d662eed108e8e4d4bf944c85ba

See more details on using hashes here.

File details

Details for the file fastdb4py-0.1.11-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: fastdb4py-0.1.11-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 184.3 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fastdb4py-0.1.11-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 acdc27ebb7d1adc0ca524715102614723184ac78af15b15c3f38fee9b5e05c74
MD5 9de3a1287b6d190afbb28d078264a7c3
BLAKE2b-256 4c9ea5efe3964b241ab5884c61aee326883b06bf50e89cd90b765ded214a961b

See more details on using hashes here.

File details

Details for the file fastdb4py-0.1.11-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fastdb4py-0.1.11-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2f75e8f8fe876bb6f9a8c7c10456597e37c095450ee3413a6f2df156a6a0a883
MD5 7c92c011a6203e879b27ead52260bf89
BLAKE2b-256 728ce2efcc819a4fc262d5a6beea6bc124150aa412cb1e957fa748a47b768495

See more details on using hashes here.

File details

Details for the file fastdb4py-0.1.11-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for fastdb4py-0.1.11-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2e6598eaa5769b9ab1d1508d3b1e7a2953a146805c2bdf498d9c9e4a9955acac
MD5 a3347530bdaac34c6d27d91ad6475cf4
BLAKE2b-256 93b54d2cfb8ba5806b97ca3520bb9c399c4e6aababa23f81b156f3062b1a1acf

See more details on using hashes here.

File details

Details for the file fastdb4py-0.1.11-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fastdb4py-0.1.11-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7f77dd8b0b200d167bde73f6a31cf76d10d1b23ebeeb2e59afe45a36d991b8e9
MD5 bf866805afbd41d2988f28f421148cea
BLAKE2b-256 c6b0b5c150f586ef82ded7d5a691fbf061be56106b25db3f19a2031f91736e82

See more details on using hashes here.

File details

Details for the file fastdb4py-0.1.11-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for fastdb4py-0.1.11-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 6c114977fa3c356c7dbf15e6ef6a634638194c0357ec85c9931d6a2ea86f05b5
MD5 e66b65488bba6336bf83188bf0b4f903
BLAKE2b-256 ee7fadc0e1cc52e6ece9441c9ab84429f3b820245a745b59bf7ff0ee504abcb5

See more details on using hashes here.

File details

Details for the file fastdb4py-0.1.11-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: fastdb4py-0.1.11-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 184.5 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fastdb4py-0.1.11-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2fa2825e99e1ab750132ee9e6e18c3e060f212a4cdb309bb3c0554b1c8d5960b
MD5 61bda1139b6d2765b378895f26a06919
BLAKE2b-256 af95553dac959987164c1405fd7e9b41420606ff3cad967504abd73659211ef9

See more details on using hashes here.

File details

Details for the file fastdb4py-0.1.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fastdb4py-0.1.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3eab6cf2c826ccf35c48621c59f732608aee47918e0519720f150387027abb0c
MD5 b993f37309607bf7adaab0ff8b2f6624
BLAKE2b-256 3e6b36a81f246df55e61ecdb00526df137ebf9b92168dce745c7aabbf38785ea

See more details on using hashes here.

File details

Details for the file fastdb4py-0.1.11-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for fastdb4py-0.1.11-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 40cb482740a32b0ba30e29ef36542e938e3dccef594f15c9bfb39b81ffa27edc
MD5 9c94d9527cfc56edb27c4a547a1e9131
BLAKE2b-256 cdfb84c4a8f00e2d368ba5d3dd03a7796e6c3ebc7a4024f80cd5d53c90ea37f8

See more details on using hashes here.

File details

Details for the file fastdb4py-0.1.11-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fastdb4py-0.1.11-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 14c178b04c0d101e85ed2eb815b838fe7664d1bb6bdbe3c677852c7dd7d4cdbd
MD5 4a0c4dc0bdac90a67dd40196bc2045eb
BLAKE2b-256 6d6f40e2b104b952b49a71aad841e742a490c9f5934a04fb8b851d4a2dea754a

See more details on using hashes here.

File details

Details for the file fastdb4py-0.1.11-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for fastdb4py-0.1.11-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 d7ffd915a595314f780e40912c653a6573fccd8a264f52ca94ece05be670007c
MD5 32822578c4d683c2324adfc9bef8afd8
BLAKE2b-256 3d65a2f2ff59b364e6efbc4e8e969ebf4f44ab68067b14a0fe9886b6555a2ddc

See more details on using hashes here.

File details

Details for the file fastdb4py-0.1.11-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: fastdb4py-0.1.11-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 183.5 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fastdb4py-0.1.11-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f68eb3ab9944a386d3412dac37f29d5a2b39eb3a03e9dae07bf782fa78174bb1
MD5 1ae25bb77e97b77d31e69255b9e9c2d8
BLAKE2b-256 d271b4983e350a7d596b2bcf7d7b5dd3f5c6a0e1ce19263706be7a3309de1849

See more details on using hashes here.

File details

Details for the file fastdb4py-0.1.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fastdb4py-0.1.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 03c73a6aaa4bd8a32d408ca153bda3acc76b7b3452ad9ed87c521cab77c68e84
MD5 d3f21608b512d1c98e7bda4e06db5da0
BLAKE2b-256 066924e2294c0db9530565c8210155b0cbcdb24e489674b9f9ecfdd71dc83e04

See more details on using hashes here.

File details

Details for the file fastdb4py-0.1.11-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for fastdb4py-0.1.11-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8beef950478a967093d23179bef5c24b3eb46736f3c55ec842570b9afc4288da
MD5 56a7797cfa93872de3ffaf9ba068d0d5
BLAKE2b-256 a0a61596c528661e6561f8cca1385f0dbc50eb6c4584afb4e499b477c3fe9969

See more details on using hashes here.

File details

Details for the file fastdb4py-0.1.11-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fastdb4py-0.1.11-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7f9682f561076a21fb1d36e884b1809fb5793dc09768673c71962af6a82e2ef9
MD5 d501d0ae3abedb9be72a6eabd8617cd4
BLAKE2b-256 103059698e2c27e5f579dba3a159161b82b4defc604b9bb3acc6cec384f91c4a

See more details on using hashes here.

File details

Details for the file fastdb4py-0.1.11-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for fastdb4py-0.1.11-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 af6f750b2777432d727502921d50ffc96382afe6fd093ca37e4ebc7da18db2d0
MD5 d46604ef4328da2914439420f4f94d8f
BLAKE2b-256 c26d2638ae625890f3dc07d210f52f26c92edc033527397aab59414cc3b20704

See more details on using hashes here.

File details

Details for the file fastdb4py-0.1.11-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: fastdb4py-0.1.11-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 183.4 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fastdb4py-0.1.11-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a666450b9a175610b38f833cbce56e089e66e9ef8741ed5874b51b21597d3dd6
MD5 c91852836ff8c133eea0fa66898f56f3
BLAKE2b-256 afe7b8180d825dd21645ce1eed6afdb7738d62dfc3ef4a32871dc85a68ade940

See more details on using hashes here.

File details

Details for the file fastdb4py-0.1.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fastdb4py-0.1.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4319853ad886822c5cb7bbd488ae437a967294672d203c6746485d8b839258f8
MD5 3c9b4aa63718843d153db732c4e46546
BLAKE2b-256 05e60d3fca47bcbc3c782e93ce062f8679e7c28392034a78de46a4a8ef2ecbde

See more details on using hashes here.

File details

Details for the file fastdb4py-0.1.11-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for fastdb4py-0.1.11-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f7d72a3baf003d3873775560a1f4604327fd38bde74e1aa7e94e1b3463597582
MD5 d0e024ab4dd733e6899a4bfaf4de1f2b
BLAKE2b-256 d94dd9f388f66bf63e9ddeef538fffa4f5644cadceed8c8afd71aed9a4b91773

See more details on using hashes here.

File details

Details for the file fastdb4py-0.1.11-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fastdb4py-0.1.11-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e384836e03486f7c26510481dcafdd4252fffbc3249c0d0fb2839c7f6559061e
MD5 15346b5e84e8dad94de283d03f8ae6eb
BLAKE2b-256 a7d5e5678a33ffaab5a3886267a69a908dd31010aac0c170f863156117200175

See more details on using hashes here.

File details

Details for the file fastdb4py-0.1.11-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for fastdb4py-0.1.11-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7b0101ddaa48067d887acde2f7b59bb2cb5ff4423094037f6f66abe7a9e12b14
MD5 17ab492c91ff16ed536d5315282f27c5
BLAKE2b-256 e8cc30d3726dcf8c2d90883bd78c059c88d98b074adad5cff1519cdcb4741009

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