odim
Simple Python ORM/ODM specifically designed to be used with Pydantic and FastAPI
Simple syntax
In order to nicely work with databases you just create your Pydantic models. Odim does not care if it is MongoDB or SQL.
from pydantic import BaseModel
class MyModel(BaseModel):
id : int
field : str
class Config:
db_uri = "mongodb://user:pwd@10.0.0.1/db1"
collection_name = "mymodel"
Then you can easily perform CRUD operations.
obj = MyModel(id=1, field="asdf 213")
await Odim(obj).save()
obj2 = await Odim(MyModel).get(123)
for x in await Odim(MyModel).find({"field" : "asdf 213"}):
print(x)
await Odim(MyModel).count({"field" : 1})
In case you are using amazin FastAPI. We have our extended router, that gives you CRUD API endpoint
from odim.router import OdimRouter
router = OdimRouter()
router.mount_crud("/api/mymodel/", model=MyModel, tags=["mymodel"])
Or you can generate these API stubs with
router.generate("/api/mymodel/", model=MyModel, tags=["mymodel"])
Metadata
Release files for odim 0.1.33
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| odim-0.1.33.tar.gz | 16.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| odim-0.1.33-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.0 kB
Release files / odim-0.1.33.tar.gz
| Download URL | odim-0.1.33.tar.gz |
|---|---|
| Size | 16.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
949a507aaf8422cffedc2f87b87fba8a930cefce2b6f85b215bcfcb931543b0c
|
|
BLAKE2b-256 checksum How to use checksums |
186afa0a2cf1b0597286701c0b9022a6982d8ee0c5787bdf675ecf746130b9c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5
|
Release files / odim-0.1.33-py3-none-any.whl
| Download URL | odim-0.1.33-py3-none-any.whl |
|---|---|
| Size | 19.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2565c9039a0a56e96ae9272cb1fe9555cfd16865af810a5c639af70f6b08b7c7
|
|
BLAKE2b-256 checksum How to use checksums |
c4d1c05574a143463672ad88552f67d93134e9af6132da7e720680ceaa2e0a7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5
|