Skip to content

Commit

Permalink
Add more explicit documentation to OpaqueTableStorage
Browse files Browse the repository at this point in the history
State that the transaction object is only needed if
a database is not going to roll back automatically.
  • Loading branch information
timj committed Dec 7, 2022
1 parent 62cb279 commit c7209c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/lsst/daf/butler/registry/interfaces/_opaque.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ def insert(self, *data: dict, transaction: DatastoreTransaction | None = None) -
Each additional positional argument is a dictionary that represents
a single row to be added.
transaction : `DatastoreTransaction`, optional
Transaction object. Can be `None` in some bridges if no rollback
is required.
Transaction object that can be used to enable an explicit rollback
of the insert to be registered. Can be ignored if rollback is
handled via a different mechanism, such as by a database. Can be
`None` if no external transaction is available.
"""
raise NotImplementedError()

Expand Down
2 changes: 2 additions & 0 deletions python/lsst/daf/butler/registry/opaque.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ def __init__(self, *, db: Database, name: str, table: sqlalchemy.schema.Table):

def insert(self, *data: dict, transaction: DatastoreTransaction | None = None) -> None:
# Docstring inherited from OpaqueTableStorage.
# The provided transaction object can be ignored since we rely on
# the database itself providing any rollback functionality.
self._db.insert(self._table, *data)

def fetch(self, **where: Any) -> Iterator[dict]:
Expand Down

0 comments on commit c7209c3

Please sign in to comment.