Skip to main content

Package description here.

Project description

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)

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

nr.utils.ponyorm-0.0.1.tar.gz (6.5 kB view details)

Uploaded Source

File details

Details for the file nr.utils.ponyorm-0.0.1.tar.gz.

File metadata

  • Download URL: nr.utils.ponyorm-0.0.1.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5

File hashes

Hashes for nr.utils.ponyorm-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b66577f016d2cfb713d758f9bf23e5ca98922962e37a6eb67bb6298564ef4e63
MD5 237bbdb4fcc30ae0096a6490b4ccc249
BLAKE2b-256 5bade1e8cde1601b9feb6ec605bc73dacd8e9428a33fab4b35436a2fea499070

See more details on using hashes here.

Provenance

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