- changed status to resolved
server-side defaults needed for relations can't fire off within flush()
Issue #954
resolved
default_table = Table('default_test', metadata,
Column('id', Integer, Sequence("dt_seq", optional=True), primary_key=True),
Column('hoho', hohotype, PassiveDefault(str(hohoval))),
)
secondary_table = Table('secondary_table', metadata,
Column('id', Integer, primary_key=True),
Column('hoho', hohotype, ForeignKey('default_test.hoho')), # foreign key to a passive default
Column('data', String(50))
)
class Hoho(fixtures.Base):
pass
class Secondary(fixtures.Base):
pass
mapper(Hoho, default_table, properties={
'secondaries':relation(Secondary)
})
mapper(Secondary, secondary_table)
h1 = Hoho()
s1 = Secondary(data='s1')
h1.secondaries.append(s1)
Session.commit()
Session.clear()
self.assertEquals(Session.query(Hoho).get(h1.id), Hoho(hoho=hohoval, secondaries=[hoho=hohoval)](Secondary(data='s1',)))
Comments (2)
-
reporter -
reporter - removed milestone
Removing milestone: 0.4.3 (automated comment)
- Log in to comment
da7fef941c44749dd3c999124e883670978f5252