I have several classes that map to tables with SQLAlchemy (not declaratively if that matters). Since I want the application to be tested per unit, all SQLAlchemy session interactions are isolated in the same class. Using the application looks something like this:
m = Model("mysql://localhost/mydb")
s1 = Service("somename")
m.session.add(s1)
s1 is m.get_service("somename")
This is actually more optimized, but work with me here.
Is it possible to skip the session.add () step? In other words, if I create an instance of the mapped class, is it possible that this will be automatically added to the active SQLAlchemy session (if any)?
source
share