Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init events on Aggregate in-memory #5

Open
filipelobo opened this issue Jun 16, 2022 · 0 comments
Open

Init events on Aggregate in-memory #5

filipelobo opened this issue Jun 16, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@filipelobo
Copy link

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 = []
@filipelobo filipelobo added the enhancement New feature or request label Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant