FastCarto database bindings
Project description
fastdb (WIP)
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 (Release 0.1.12): Fixed a critical issue where loading large database files (> 2GB) on Linux/Unix systems would fail to read the complete file, leading to missing tables or data corruption. The file reading logic has been improved to correctly handle partial reads for large files. (PR #23)
- 2026-03-04 (Memory Overflow Improvement): Enhanced the
MemoryStreamimplementation to handle large data sizes exceeding 4GB without causing size overflow inchunk_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
U32fields 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastdb4py-0.1.12.tar.gz.
File metadata
- Download URL: fastdb4py-0.1.12.tar.gz
- Upload date:
- Size: 598.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
760617fca4e2964869631bdea9674977661da595113f68494da9396c73d00053
|
|
| MD5 |
9e018196c274c06949f344e5caa2f957
|
|
| BLAKE2b-256 |
bc7a26edd78b10a43b1e54257e729c7e5e0fd7793135d810c330deb2387408fd
|
File details
Details for the file fastdb4py-0.1.12-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: fastdb4py-0.1.12-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 184.5 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1dbfeb62d99f1d14c8a8c82b950184ab542265ae06c30eb62493c2018982013c
|
|
| MD5 |
f10a11b6c6b8795b0e725ea68efc3510
|
|
| BLAKE2b-256 |
919921068ece51cbee638d5aa5b29d9a758a79e26b9b2b8ebe07ed4f19a0eebc
|
File details
Details for the file fastdb4py-0.1.12-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: fastdb4py-0.1.12-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 608.0 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79af26d65fc143edb23edcd2d0ac2a3371685f144b1a813bd799b17aa07648c9
|
|
| MD5 |
2b13889096689cc9fc2f387cecbea59e
|
|
| BLAKE2b-256 |
f51005095cf402fc7e558bedb0beff5971bf406062f485071bf6aaedf2c2c8b6
|
File details
Details for the file fastdb4py-0.1.12-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: fastdb4py-0.1.12-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 578.0 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6852097f52343cef22b8e6552ee14ac3e98a5cfc73fed70bcd8a12db9361bf71
|
|
| MD5 |
1a3d8229b91e9842609a5b7a69d13984
|
|
| BLAKE2b-256 |
70d0df107057f86011c1b7cc874dfd88526d9da83aa9f6c5ae6ed2a65c5e279e
|
File details
Details for the file fastdb4py-0.1.12-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: fastdb4py-0.1.12-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 474.8 kB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
909c6b0a32b218b89a0733b9ccb99673df5936819722dbddab71ec2619bbb450
|
|
| MD5 |
3542f09e72d4e5c82da799c919604c93
|
|
| BLAKE2b-256 |
f7229f9e61a1dd9b77c8b6a73d4e64f4f86339b10a69065cc05b093ca311fcc4
|
File details
Details for the file fastdb4py-0.1.12-cp313-cp313-macosx_10_13_x86_64.whl.
File metadata
- Download URL: fastdb4py-0.1.12-cp313-cp313-macosx_10_13_x86_64.whl
- Upload date:
- Size: 527.3 kB
- Tags: CPython 3.13, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20f8c5d03206927a0d0780650e7089e3037651fb7f4fd6df3e6e2e785b635b7e
|
|
| MD5 |
24192235852c732beab1532cd108d859
|
|
| BLAKE2b-256 |
39142f64bd7b355de677b9dc01f4946f53f4aa476e78adf9effb4b9ca646caba
|
File details
Details for the file fastdb4py-0.1.12-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: fastdb4py-0.1.12-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 184.6 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e648a6d805003f52b176a262ce3c9c88dc39c2effe77e0c93a568fe9d3b8ca92
|
|
| MD5 |
ada649754c26e102adb3c0f4a6831e0a
|
|
| BLAKE2b-256 |
9866e4b584c27fb6be7de46d00af6c6fbc537aeaf95abb087d9caf6305f332c0
|
File details
Details for the file fastdb4py-0.1.12-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: fastdb4py-0.1.12-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 608.0 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee5d387ec8fe43ba3c92bf2aa46769aed928f22c333ff98999a88edda053f77f
|
|
| MD5 |
8f1b3e315a366a0ada660bff0dd56cbb
|
|
| BLAKE2b-256 |
820c7a1dff2c389fe1ef207c722d076476ae8ca35d4fafe7f09390ea91ce74b6
|
File details
Details for the file fastdb4py-0.1.12-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: fastdb4py-0.1.12-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 578.2 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e9a1177540da16b24888b0986d12894da630c88af3196041d02842f2f779da9
|
|
| MD5 |
62f63a03c1841e2138add167bb22db56
|
|
| BLAKE2b-256 |
51cffcc4339129b00ce8dc5cf5aa9c8b6097d0c29b45ffb7cc2ed1f02b1da7cf
|
File details
Details for the file fastdb4py-0.1.12-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: fastdb4py-0.1.12-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 475.2 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fc75e88d06d669d5a7c042a7181aacc4f2a2430b702ca8791615d583de6abd6
|
|
| MD5 |
4ea92e98d581f4ed4f4756d6f59c7305
|
|
| BLAKE2b-256 |
d7d23f7455d0e2084ce28f4162387dca8f5bbb6b6815b436b2f8d0cc0639c8c2
|
File details
Details for the file fastdb4py-0.1.12-cp312-cp312-macosx_10_13_x86_64.whl.
File metadata
- Download URL: fastdb4py-0.1.12-cp312-cp312-macosx_10_13_x86_64.whl
- Upload date:
- Size: 527.8 kB
- Tags: CPython 3.12, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f814400f68e617ff9449a7391e8f449f3877cf8cfce9465cc1379908a998769
|
|
| MD5 |
7a546df9c67b5da574ab86c77e086877
|
|
| BLAKE2b-256 |
3f0bcd23457086df8704513d55d65137bf4d6a775174d923f80d520e46c269e2
|
File details
Details for the file fastdb4py-0.1.12-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: fastdb4py-0.1.12-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 183.6 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
871e30be93352e2fccf263ac1fec8f10c55874aa325258cdf1bfa711fdd8826b
|
|
| MD5 |
58e5880d7553d989c363517d52d64932
|
|
| BLAKE2b-256 |
77bb471d17c5de0907f1a40f047bbc6b58498ec0bd6d5e372dd42569b97f36bf
|
File details
Details for the file fastdb4py-0.1.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: fastdb4py-0.1.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 607.1 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11dcf251c95bd301f0a58c67b18e614737ceaec727f0fa068008b15a2aad7a94
|
|
| MD5 |
277bccbaadef33b68f87ae287c8a8938
|
|
| BLAKE2b-256 |
689a980d5dab07bcaf817d30627c47244042a44e6047133da76f76e2f421bf19
|
File details
Details for the file fastdb4py-0.1.12-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: fastdb4py-0.1.12-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 577.7 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8becd08c31dd933ede493c8d3d3bd128ff87ef07a2851c8260fe135673b021f
|
|
| MD5 |
72e84eb34c056797bdaf3c3cba9bb952
|
|
| BLAKE2b-256 |
118327af4116b2c12ef6801cd5bf17736b724246fc2dd6f44476b127b6554882
|
File details
Details for the file fastdb4py-0.1.12-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: fastdb4py-0.1.12-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 474.9 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14ee4df803f3e10980a469290ff7482ff150b3c43082c637bd6e1036127f026f
|
|
| MD5 |
f9bac323f3c914de2da841106dafaf50
|
|
| BLAKE2b-256 |
c2f6cd33a14d128cbfef3ac2db4f704f2ada81c420b453a0d239e05df718ae53
|
File details
Details for the file fastdb4py-0.1.12-cp311-cp311-macosx_10_9_x86_64.whl.
File metadata
- Download URL: fastdb4py-0.1.12-cp311-cp311-macosx_10_9_x86_64.whl
- Upload date:
- Size: 528.6 kB
- Tags: CPython 3.11, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d66ac6ee19fd019159009f08b78e98e8028005500333cbfc99a4ce05880b314
|
|
| MD5 |
f2487eae59c38b28d5b2d81e3ed57905
|
|
| BLAKE2b-256 |
00cdaf145ea379ac17a304a124567b1df18ee56648ead0f6256045affe63b375
|
File details
Details for the file fastdb4py-0.1.12-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: fastdb4py-0.1.12-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 183.6 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e4388c077da1a8b8e68b50d35521d16d7249ba9d065f897f9e4d8e9375458f6
|
|
| MD5 |
6de92765c2a0af6867fde3ad3d9cb8bf
|
|
| BLAKE2b-256 |
bf7c03e7c7268e2699e3b584f910d578e76aa578bf1f2bd0395bb6e2ee8bfc08
|
File details
Details for the file fastdb4py-0.1.12-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: fastdb4py-0.1.12-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 607.0 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
711a28ed5a374ee968a19e981ba72c639532d8f99fa6cc4e4f268c4bdf1c13be
|
|
| MD5 |
243e3c1e99b6b3e5c625b6e9d620bfb8
|
|
| BLAKE2b-256 |
55b442feb89308a6c823c451aa4ec68c8ae8668fdc2bcc42f16b15aec7ba81e1
|
File details
Details for the file fastdb4py-0.1.12-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: fastdb4py-0.1.12-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 577.7 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca6551775e770b0517c1cb375c530e4244c5c65e683635f5e18244939d73ba0a
|
|
| MD5 |
a6176db135753df2641d6c826a45fa25
|
|
| BLAKE2b-256 |
5c8cbddcc8e6d635146f31dd3a2bc8773ebe790183b7344b7444d94671e1a6e9
|
File details
Details for the file fastdb4py-0.1.12-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: fastdb4py-0.1.12-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 474.9 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb8ceaa3d9c775e01011a01471adcf20901355aa57591d51ce15ca19aa031fc0
|
|
| MD5 |
36edddd208efdf87ecd70c4442a9f2ae
|
|
| BLAKE2b-256 |
d98a0182d864821cf30881a15a3382c7d078c5bb37b035f49070b4a74d615667
|
File details
Details for the file fastdb4py-0.1.12-cp310-cp310-macosx_10_9_x86_64.whl.
File metadata
- Download URL: fastdb4py-0.1.12-cp310-cp310-macosx_10_9_x86_64.whl
- Upload date:
- Size: 528.6 kB
- Tags: CPython 3.10, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bbfe0bdd0e64a9979dec04c121c5943f796ab43fa47c4c7a9e4fa5d0149b1a3
|
|
| MD5 |
4fa142ca4f5d7f6d2344a5db23540599
|
|
| BLAKE2b-256 |
442682165f610fb8b0865e5bbabd879f5f9705fd233340e6b88fc460cdf69400
|