Skip to content

Question - Global transaction management #83

Open

Description

@sunjoong85

Global transaction management is essential to surpass Spring.

Are there any plans to develop or integrate features like this?

I'm new to Python but have a strong background in Java and NodeJS (especially NestJS). I’ve been exploring Python web frameworks that offer a modular system based on dependency injection (DI), and PyNest seems to be on the right track—it's readable, maintainable, and scalable.

One thing, which is crucial: not every early-stage startup builds their backend using microservices architecture (MSA). Monolithic architecture is much simpler and faster for building an MVP. In this context, global transaction control through annotation-driven mechanisms can eliminate redundant boilerplate code. - begin transaction, end transaction and rollback.

Additionally, it enhances the reusability of services across domains. While this may not be recommended in MSA, it remains useful in certain cases. It is not only beneficial for monolithic applications but also for MSA.

Thanks!

Activity

  1. itay-dar-lmnd commented on Dec 24, 2024

    @itay-dar-lmnd
    Contributor

    @sunjoong85 Hi! Thank you for the kind words.

    Regard the Global transaction management, are we talking about transaction in the context of Databases? If so, then there are a few ORM packages that are highly recommended to use in order to achieve this behaviour. One of them is SQLALCHEMY, that can manage all the transactions to the database.

  2. ItayTheDar commented on Oct 5, 2026

    @ItayTheDar
    Contributor

    Clarifying the current state for the annotation-driven case you described: PyNest does not currently provide a @Transactional decorator or automatic transaction propagation across service calls. The ORM providers expose SQLAlchemy sessions; transactions are controlled by your application code. For a single transaction spanning multiple services, pass the same session to those operations and use SQLAlchemy's with session.begin(): (or async with session.begin(): for an async session), rather than letting each service create/commit its own session.

    On current main, the synchronous OrmProvider.get_session() rolls back on an exception and closes the session, but callers still explicitly commit; the async get_session() closes the session and does not implement decorator-style transaction management. So the earlier SQLAlchemy suggestion is a workaround, not the Spring-style feature requested here. Leaving this open as a feature request; no delivery date is committed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions