On Mar 31, 2011, at 6:26 AM, Nick Leaton wrote:

> OK, still one problem. It's not saving the association object.
> 
> Here is the code
> 
> ===================================
> from sqlalchemy import create_engine
> from sqlalchemy import Table, Integer, Column, Boolean, String, MetaData, 
> ForeignKey
> from sqlalchemy.orm import mapper, sessionmaker, relationship
> 
> from Entities.Calendar import Calendar
> from Entities.SimpleCalendar import SimpleCalendar
> from Entities.UnionCalendar import UnionCalendar
> from Entities.Holiday import Holiday
> from Entities.SimpleHoliday import SimpleHoliday
> from Entities.RepeatingHoliday import RepeatingHoliday
> 
> 
> ny = SimpleCalendar(code='NY',name='New York',holidays=[SimpleHoliday("New 
> Year", 2011,1,1)])
> lon = SimpleCalendar(code='LON',name='London',holidays=[SimpleHoliday("New 
> Year", 2011,1,1),RepeatingHoliday('MayDay',5,1)])
> session.add (ny)
> session.add (lon)
> session.commit()
> uc = UnionCalendar ([ny, lon])
> print uc
> print 'add'
> session.add (uc)
> session.flush()


So I'd need to see where you are populating "children".   I don't see that in 
the example here (if it is happening, I assume the constructor of UnionCalendar 
is doing it somehow) so that would be why nothing gets put into 
calendar_children.

if you inline the classes themselves into the test then you'd have an example 
others can reproduce.


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to