Skip to content

Commit

Permalink
uow: move the module to the root
Browse files Browse the repository at this point in the history
  • Loading branch information
ntarocco committed Oct 1, 2024
1 parent bc44ec5 commit 84bdc76
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions invenio_db/services/uow.py → invenio_db/uow.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
Note, this is NOT a clean implementation of the UoW design pattern. The
main purpose of the Unit of Work in Invenio is to coordinate when the database
transaction commit is called, and ensure tasks that have to run after the
transcation are executed (such as indexing and running celery tasks).
transaction are executed (such as indexing and running celery tasks).
This ensures that we can group multiple service calls into a single database
transaction and perform the necessary indexing/task execution afterwards.
Expand All @@ -30,7 +30,7 @@
.. code-block:: python
from invenio_db.services.uow import \
from invenio_db.uow import \
ModelCommit, unit_of_work,
@unit_of_work()
Expand All @@ -55,7 +55,7 @@ def create(self, ... , uow=None):
.. code-block:: python
from invenio_db.services.uow import UnitOfWork
from invenio_db.uow import UnitOfWork
with UnitOfWork() as uow:
# Be careful to always inject "uow" to the service. If not, the
Expand All @@ -78,7 +78,7 @@ class and implementing the desired methods:
.. code-block:: python
from invenio_db.services.uow import Operation
from invenio_db.uow import Operation
class BulkIndexOp(Operation):
def on_commit(self, uow):
Expand All @@ -87,7 +87,7 @@ def on_commit(self, uow):

from functools import wraps

from ..shared import db
from .shared import db


#
Expand Down

0 comments on commit 84bdc76

Please sign in to comment.