HumbleDB - MongoDB Object-Document Mapper
HumbleDB solves the age-old MongoDB dilemma: write readable, maintainable code or optimize for storage efficiency. With HumbleDB, you get both. This lightweight ODM lets you use clear, descriptive attribute names in your Python code while automatically mapping them to ultra-short database keys, dramatically reducing document size and memory usage without sacrificing code clarity.
[!WARNING] Version 7.0.0 Breaking Changes This release updates to Pymongo 4.x, which introduces breaking changes. While we've maintained all older 3.x and 2.x Pymongo methods with identical signatures where possible, there may be other breaking changes not covered by our test suite. If you encounter any issues during upgrade, please open an issue.
Features
Efficient Storage: Map readable attribute names to ultra-short database keys, reducing document size and memory usage while maintaining code clarity.
Full Pymongo Compatibility: Maintains backwards-compatible methods for
Pymongo 4.x including insert, find_and_modify, save, and other familiar
operations.
Maximum Flexibility: Documents are also dictionaries - no schema restrictions, maximum adaptability to changing requirements.
Thread & Greenlet Safe: Built for concurrent applications with safe connection handling and resource management.
Context-Managed Connections: Connection paradigm minimizes socket usage from the connection pool through explicit context managers.
Lightweight Design: Thin wrapper around Pymongo that exposes the full power of the underlying driver without performance overhead.
Quick Start
Define Your Document Schema
Create a Document
subclass with readable attribute names mapped to short database keys:
from humbledb import Mongo, Document
class TestDoc(Document):
config_database = 'test' # Target database
config_collection = 'testdoc' # Target collection
test_key = 't' # Maps 'test_key' attribute to 't' in MongoDB
other_key = 'o' # Maps 'other_key' attribute to 'o' in MongoDB
Create and Populate Documents
Documents work like regular Python objects with attribute access, while storing data efficiently:
doc = TestDoc()
doc.test_key = 'Hello'
doc.other_key = 'World'
# View the actual MongoDB document structure
print(doc)
# TestDoc({'t': 'Hello', 'o': 'World'})
Flexible Data Access
Access your data through mapped attributes or direct dictionary keys:
# Via mapped attributes (recommended)
print(doc.test_key) # 'Hello'
# Via dictionary access
print(doc['t']) # 'Hello'
print(doc['o']) # 'World'
Database Operations
Use the Mongo
context manager for safe database operations:
# Insert document
with Mongo:
TestDoc.insert(doc)
# Query documents
with Mongo:
found = TestDoc.find_one()
print(found)
# TestDoc({'_id': ObjectId('50ad81586112797f89b99606'), 't': 'Hello', 'o': 'World'})
See the documentation for more examples and detailed explanations.
Documentation
The complete documentation can be found on http://humbledb.readthedocs.org.
License
See LICENSE.rst.
Contributors
Metadata
Release files for humbledb 7.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| humbledb-7.0.0.tar.gz | 32.0 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| humbledb-7.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 67.1 kB
Release files / humbledb-7.0.0.tar.gz
| Download URL | humbledb-7.0.0.tar.gz |
|---|---|
| Size | 32.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
859179df7e65e5a6fad61ef8c05934ae3892b48647d92b6672bda6925ef0ac7c
|
|
BLAKE2b-256 checksum How to use checksums |
b57fb2f82d5e18fe9d91e8eff52677e191ca92fc832220f67c0f240c60dd30a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 22, 2025.
Transparency logRelease files / humbledb-7.0.0-py3-none-any.whl
| Download URL | humbledb-7.0.0-py3-none-any.whl |
|---|---|
| Size | 35.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b5755dc1a68e4f3ae37fa4525af99e9983334df4bfa99db290edda121171fa97
|
|
BLAKE2b-256 checksum How to use checksums |
228b76f68a2dafb0f47b951bb6f689bae27ed208711105c07af6442c1f4e3a49
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 22, 2025.
Transparency logSecurity for humbledb 7.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for humbledb-7.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 22, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.