DetaORM
An async ORM for DetaBase.
Support | PyPI | Documentation
Example Usage
from __future__ import annotations
import asyncio
from detaorm import Client, Base, Field
class User(Base, name="users"):
username: Field[str] = Field()
nicknames: Field[list[str]] = Field(default=[])
async def main() -> None:
client = Client("<project key>", bases=[User])
await client.open()
new_user = User(username="CircuitSacul")
print(new_user) # > User({"username": "CircuitSacul"})
inserted_user = await new_user.insert()
print(inserted_user) # > User({"username": "CircuitSacul", "nicknames": []})
updated_user = await inserted_user.update(User.nicknames.append(["Circuit", "Sacul"]))
print(updated_user) # > User({"username": "CircuitSacul", "nicknames": ["Circuit", "Sacul"]})
page = await User.where(User.nicknames.contains("Sacul"), limit=1)
print(page.items[0]) # > User({"username": "CircuitSacul", "nicknames": ["Circuit", "Sacul"]})
if __name__ == "__main__":
asyncio.run(main())
Metadata
Release files for detaorm 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| detaorm-0.4.1.tar.gz | 8.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| detaorm-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.5 kB
Release files / detaorm-0.4.1.tar.gz
| Download URL | detaorm-0.4.1.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c4424b62b6564453c0019e015bd449384f5573df7cd883abaf808bbbe7e8b67d
|
|
BLAKE2b-256 checksum How to use checksums |
f82b79e17f77a059d61e3031d7014506721a55357cae6667e25d0f50baa96033
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.8.17 Linux/5.15.0-1042-azure
|
Release files / detaorm-0.4.1-py3-none-any.whl
| Download URL | detaorm-0.4.1-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4410e9b386062c6a5c0941e7d3e438937af3b6103debfc1719632efb1b3fe5b9
|
|
BLAKE2b-256 checksum How to use checksums |
6af57850642e4becca9e738d1dde77d33df514e6af2ac7e2ea00ace1609f9a7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.8.17 Linux/5.15.0-1042-azure
|