Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
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)