Skip to main content

HumbleDB is an extremely lightweight ODM that works with pymongo to provide a convenient and easy to use interface. It enforces strict explictness when a connection to a MongoDB cluster or replica set is being used, by disallowing any read or write interaction outside of a context manager’s context block.

Quick Example

>>> from humbledb import Mongo, Document
>>> # config_database and config_collection are required attributes
>>> class TestDoc(Document):
...     config_database = 'test'
...     config_collection = 'testdoc'
...     test_key = 't'
...     other_key = 'o'
...
>>> # When you create a Document instance, you can set its keys via any
>>> # mapped attributes you create
>>> doc = TestDoc()
>>> doc.test_key = 'Hello'
>>> doc.other_key = 'World'
>>> # The __repr__ for the instance shows the actual doc
>>> doc
TestDoc({'t': 'Hello', 'o': 'World'})
>>> # A Document instance is also a dict, but you have to access the key
>>> # names directly
>>> doc['o']
u'World'
>>> # Or use the mapped attribute
>>> doc[TestDoc.test_key]
u'Hello'
>>> # The Mongo class manages database connection and is a context manager
>>> with Mongo:
...     TestDoc.insert(doc)
...
>>> with Mongo:
...     found = TestDoc.find_one()
...
>>> found
TestDoc({u'_id': ObjectId('50ad81586112797f89b99606'), u't': u'Hello', u'o': u'World'})
>>> doc
TestDoc({'_id': ObjectId('50ad81586112797f89b99606'), 't': 'Hello', 'o': 'World'})
>>> found['_id']
ObjectId('50ad81586112797f89b99606')
>>> found['t']
u'Hello'
>>> found.test_key
u'Hello'

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.

Release files for humbledb 3.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for humbledb 3.3.0
File Size Uploaded
humbledb-3.3.0.tar.gz 22.5 kB Details

Release files / humbledb-3.3.0.tar.gz

Download URL humbledb-3.3.0.tar.gz
Size 22.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a3f1b668bb52bbed407beb41c98698b66f88e8feaccaa4d72b1f3cc79c630390
BLAKE2b-256 checksum
How to use checksums
25e328893eab68bf40978a8299c255fe9ad216509642991671970161c61775c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

7.0.0

2 release files

6.0.0

2 release files

5.6.1

1 release file

5.6.0

1 release file

5.5.1

1 release file

5.5.0

1 release file

5.4.1

1 release file

5.4.0

1 release file

5.3.0

1 release file

5.2.0

1 release file

5.1.4

1 release file

5.1.2

1 release file

5.1.1

1 release file

5.1.0

1 release file

5.0.2

1 release file

5.0.1

1 release file

5.0.0

1 release file

4.0.1

1 release file

4.0.0

1 release file

3.3.1

1 release file

This release

3.3.0 This release

1 release file

3.2.0

1 release file

3.1.0

1 release file

3.0.3

1 release file

3.0.2

1 release file

3.0.1

1 release file

3.0.0

1 release file

2.3.1

1 release file

2.3.0

1 release file

2.2.1

1 release file

2.2.0

1 release file

2.1.1

1 release file

2.1.0

1 release file

2.0.3

1 release file

2.0.2

1 release file

2.0.1

1 release file

2.0.0

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page