Skip to content

Init events on Aggregate in-memory #5

Description

@filipelobo

Use the orm.reconstructor decorator on the events attribute for the Aggregate model to init and load it only on memory, according to the example on the Constructors and Object Initialization section of SQLAlchemy docs:

from sqlalchemy import orm


class MyMappedClass:
    def __init__(self, data):
        self.data = data
        # we need stuff on all instances, but not in the database.
        self.stuff = []

    @orm.reconstructor
    def init_on_load(self):
        self.stuff = []

Activity

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions