How to use the relstorage.storage function in RelStorage

To help you get started, we’ve selected a few RelStorage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github newtdb / db / src / newt / db / _db.py View on Github external
def storage(dsn, keep_history=False, transform=None, auxiliary_tables=(), **kw):
    """Create a RelStorage storage using the newt PostgresQL adapter.

    Keyword options can be used to provide either `ZODB.DB
    `_
    options or `RelStorage
    `_
    options.
    """
    options = relstorage.options.Options(keep_history=keep_history, **kw)
    options.transform = transform
    options.auxiliary_tables = auxiliary_tables
    return relstorage.storage.RelStorage(Adapter(dsn, options), options=options)
github newtdb / db / src / newt / db / component.py View on Github external
def open(self, databases=None):
        db = self.config.db
        db.name = db.name or self.name
        db = db.open(databases)
        assert (
            isinstance(db.storage,
                       relstorage.storage.RelStorage)
            and
            isinstance(db.storage._adapter,
                       relstorage.adapters.postgresql.PostgreSQLAdapter)
            ), "Invalid storage"
        from ._db import NewtDB
        return NewtDB(db)