- marked as critical
support partial cascade rules
Issue #199
resolved
the cascading is not really complete, in the sense that its expecting "all" as the default, and wont really work if its not since the cascade rules arent fully accounted for in dependency.py
. also, the entryways into Session
and UnitOfWork
are not shored up yet, as the flush()
process sneaks plenty of things into the UOW that arent in the session.
for example:
from sqlalchemy import *
meta = BoundMetaData('sqlite://', echo=True)
t1 = Table('users', meta,
Column('id', Integer, primary_key=True),
Column('name', String(20))
)
t2 = Table('addresses', meta, Column('id', Integer, primary_key=True),
Column('user_id', Integer, ForeignKey(t1.c.id)),
Column('address', String(20))
)
meta.create_all()
class User(object):
pass
class Address(object):
pass
mapper(User, t1, properties={
'addresses':relation(mapper(Address, t2), cascade="none")
})
sess = create_session()
u = User()
a = Address()
u.addresses.append(a)
sess.save(u)
assert u in sess
assert a not in sess # ok so far
sess.flush() # a gets added to UnitOfWork via dependency processing, but not the session
sess.clear() # crashes due to partially associated object
Comments (4)
-
reporter -
reporter - changed milestone to 0.4.0
-
reporter - changed status to resolved
this ticket is out of date and has long been addressed by a check in
UOWTransaction.register_object()
to ignore registers for instances that are not already in the session. tested by the unit testtest.orm.session.SessionTest.test_no_save_cascade
. -
reporter - removed milestone
Removing milestone: 0.4.0 (automated comment)
- Log in to comment