Note: This package is in the dangerous land of
0.x.yversions and may be subject to breaking changes with minor version increments.
nr.utils.ponyorm
Utilities for Pony ORM.
Composable databases
Applications with plugin interfaces may choose to allow the use of a common
database, accessed via the same Pony ORM database object. The
nr.utils.ponyorm.appdb provides classes to allow just that.
Example:
from nr.utils.ponyorm.appdb import AppDatabase, Optional, Required
appdb = AppDatabase(__name__)
class Person(appdb.Entity):
name = Required(str)
# etc. etc.
Then from the application startup logic:
from pony.orm import Database
db = Database()
for appdb in load_all_application_databases(): # ominous functions
appdb.bind_to(db)
db.generate_mapping(create_tables=True)
Common converters
Provides common converter implementations that are not built into Pony ORM.
All converters can be registered via AppDatabase.register_converter(converter_cls)
or with nr.utils.ponyorm.converters.register_converter(db, converter_cls).
Available converters are
EnumConverter
Utility functions
get_db(entity)get_one(entity_cls, kwargs)get_or_create(entity_cls, get, set=None)upsert(entity_cls, get, set=None, mutate=True)
Copyright © 2020 Niklas Rosenstein
Metadata
Release files for nr.utils.ponyorm 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nr.utils.ponyorm-0.0.2.tar.gz | 7.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nr.utils.ponyorm-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.4 kB
Release files / nr.utils.ponyorm-0.0.2.tar.gz
| Download URL | nr.utils.ponyorm-0.0.2.tar.gz |
|---|---|
| Size | 7.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37e847c0d144c698e59bb37ad5b1683414a913f7cc7365cebbca1797a6067482
|
|
BLAKE2b-256 checksum How to use checksums |
f293a1c172e3f16d3d8a9ae5b7926ea239606d01eb6d4737df63d051e3ba372e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.3
|
Release files / nr.utils.ponyorm-0.0.2-py3-none-any.whl
| Download URL | nr.utils.ponyorm-0.0.2-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
766c966192d118b7a59aa70fcb64c252a6c74355fb55b4489acc5c028def596e
|
|
BLAKE2b-256 checksum How to use checksums |
a5bc5006dfa21c4530e7881386903ef9637664eeef80ab071a2afaa61bd75de4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.3
|