What do you think about that (simplified) code? An instance of this class would be added to any gui-class (e.g. a dialog) which handle data over SQLAlchemy.
The session would be destroyed/closed correct when the Controller instance is destroyed, too. Correct? [code] import sqlalchemy as sa import sqlalchemy.orm as sao _engine = sa.create_engine('postgres://...') class BasicController(): """ """ def __init__(self): self._session = None def CreateSession(self): if self._session is not None: raise AttributeError('...') self._session = sao.sessionmaker(bind=_engine)() @property def session(self): """ """ if not self._session: self.CreateSession() return self._session -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.