Skip to main content

ultraminimalistic Python library for simple object-document mappint for asyncronous mongodb

Project description

uodm: Ultraminimalistic Object-Document Mapper for async mongodb

Welcome to uodm, the fun-sized, feature-packed async MongoDB Object-Document Mapper that will have your documents dancing around faster than you can say "NoSQL nirvana"! 🕺💾

Features

  • 🐍 Pythonic to the core: Designed with the grace and grit of modern Python.
  • 📚 Asynchronous bliss: Leveraging asyncio for non-blocking database adventures.
  • 🎳 Simple and expressive models: Define your models and let uodm handle the rest.
  • 🛠️ Auto-index management: Because you've got better things to do than managing indexes manually.
  • 🌍 Global database access: Connect once, use everywhere (kinda like your Netflix subscription but for databases).

Quick Start

Here's how you can jump into the action:

import uodm

class Books(uodm.Collection):
    title: str
    author: str
    year: int = uodm.Field(default=2021)

    __collection__ = "mybooks"
    __indexes__ = [
        uodm.Idx("title", unique=True),
        uodm.Idx(["title", "author"], sparse=True),
    ]

async def main():
    db = uodm.UODM("mongodb://localhost:27017/test")
    await db.setup()
    w = Books(title="War and Peace", author="Tolstoy", year=1869)
    try:
        await w.save()
    except uodm.DuplicateKeyError as e:
        print("this book is already exists")

    res = await Books.get(title="War and Peace")
    print(res)
    for book in await Books.find(year={"$gt": 1900}):
        print(book)

if __name__ == "__main__":
    import asyncio
    asyncio.run(main())

Installation

Grab the latest release with a simple pip command:

pip install git+https://github.com/bobuk/uodm.git#egg=uodm

or just pip install uodm if you're ok to use the latest release. Don't forget to wear your seatbelt, this thing is fast! 🚗💨

Contributing

Pull requests? Issues? Existential queries about your database? All are welcome!

  1. Fork it (like stealing your neighbor's wifi but legal).
  2. Create your feature branch (git checkout -b my-new-feature).
  3. Commit your changes (git commit -am 'Add some feature').
  4. Push to the branch (git push origin my-new-feature).
  5. Create a new Pull Request.
  6. ...
  7. PROFIT

License

This project is under "The Unlicense". Yes, it's really unlicensed. Like a fisherman without a fishing license. 🎣


Feel free to connect with me or just stop by to say "Hi, MongoDB!" 👋

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

uodm-0.1.8.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

uodm-0.1.8-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file uodm-0.1.8.tar.gz.

File metadata

  • Download URL: uodm-0.1.8.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.19.2 CPython/3.12.7 Darwin/24.0.0

File hashes

Hashes for uodm-0.1.8.tar.gz
Algorithm Hash digest
SHA256 1a6b180113ff7c880eb7b3d7adcbb0afe6d87b72a00f1b7c2a07ac8ef6d46ae1
MD5 240e2ed3205cac13da0fc9a348b378fe
BLAKE2b-256 68be16c642e2337262f3ff346e9b1540ccb6a6137a6798493f4d868769ff33db

See more details on using hashes here.

File details

Details for the file uodm-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: uodm-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.19.2 CPython/3.12.7 Darwin/24.0.0

File hashes

Hashes for uodm-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 6953b9cb28696a72fe63e35077d04dee7ece1b9f8a1d702fdfb254b2968b20d2
MD5 9bc1abc380555b82d492e4a4ac80ae74
BLAKE2b-256 e3661d6d325a6477da9bf17d9a4a8b3f9d5112bfa226fe6ff4b0c6d0e69d5d6e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page