Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

Bilu

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Bilu

Asynchronous ODM (Object Document Mapper) for MongoDB

  • 0.0.3
  • PyPI
  • Socket score

Maintainers
1

bilu

Asynchronous ODM (Object Document Mapper) for MongoDB

Requirements

Python: 3.6 and later (tested against 3.6, 3.7, 3.8 and 3.9)

MongoDB: 4.0 and later

pydantic: 1.8.2 and later

Two direct dependencies:

  • pydantic: makes data validation and schema definition both handy and elegant.

  • motor: an asyncio MongoDB driver officially developed by the MongoDB team.

Installation

pip install Bilu

Environments

export MONGODB_URI='mongodb://localhost:27017'
export MONGODB_USERNAME=''
export MONGODB_PASSWORD=''
export MONGODB_DATABASE='test'
export MONGODB_MIN_POOL_SIZE=0
export MONGODB_MAX_POOL_SIZE=100

Example

Connecting to mongodb

from bilu.database import db_manager
db_manager.connect()

Define model

from bilu.model import BaseModel

class TesteModel(BaseModel):
    attr_str: str
    attr_int: int

    class Meta:
        name = 'testemodel'

Creating a document

data = {
    'attr_str': 'bla',
    'attr_int': 123
}
model = TesteModel(**data)
await model.save()

Listing documents

await model.documents.list(attr_int=123)

Getting a document

item = await model.documents.get(attr_int=123)

Removing a document

await item.delete()

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc