[sqlalchemy] Re: Allowing orphaned children

2009-02-07 Thread Michael Bayer
cascade=all includes delete cascade. any Hat objects attached to User will be deleted when the User is deleted.To resolve, leave the cascade argument out. it defaults to save-update, merge which is enough for most use cases. On Feb 6, 2009, at 11:05 PM, James wrote: Hi, I'm

[sqlalchemy] Re: Allowing orphaned children

2009-02-07 Thread James
Oh, of course - thanks Michael! On Feb 7, 1:51 pm, Michael Bayer mike...@zzzcomputing.com wrote: cascade=all includes delete cascade.   any Hat objects attached to   User will be deleted when the User is deleted.    To resolve, leave   the cascade argument out.  it defaults to save-update,

[sqlalchemy] Multi tread operation and max query in sqlalchemy

2009-02-07 Thread reetesh nigam
Hi All, i am not able to use max query in sqlalchemy? currently i am using this: r= model.session.query(model.RadReport).max (model.t_reports.c.reportid) 2009-02-06 20:52:07,453 INFO *Main Thread* [sqlalchemy.engine.base.Engine.0x..b0:_cursor_execute] SELECT max (t_reports.reportid) AS

[sqlalchemy] Declarative with Enthoughts Traits framework.

2009-02-07 Thread cputter
Hi guys and girls, I've recently discovered the joys of using sqlalchemy and would love to using it together with Traits. A few months back there was an attempt to integrate sqlalchemy into traits, though it wasn't really comprehensive in exploiting all of sqlalchemy's potential. So I'm trying

[sqlalchemy] Re: Declarative with Enthoughts Traits framework.

2009-02-07 Thread Christiaan Putter
Hi Michael, Thanks for your swift reply. I wasn't really sure which way to go with combining Traits and SA. From reading through the source it seemed that I had to use InstrumentationManager, I think it said somewhere it was the stable public interface. I had a look at the Trellis source as

[sqlalchemy] Re: Declarative with Enthoughts Traits framework.

2009-02-07 Thread Michael Bayer
On Feb 7, 2009, at 8:27 PM, Christiaan Putter wrote: Hi Michael, Thanks for your swift reply. I wasn't really sure which way to go with combining Traits and SA. From reading through the source it seemed that I had to use InstrumentationManager, I think it said somewhere it was the

[sqlalchemy] Re: Declarative with Enthoughts Traits framework.

2009-02-07 Thread Christiaan Putter
Hi, uh thats a little weird since the InstrumentationManager is designed to be the thing you subclass. you're not supposed to subclass ClassManager. There should be no difference in behavior subclassing one or the other. It behaves a little weird to when I tried it myself. I'll stick

[sqlalchemy] Re: Declarative with Enthoughts Traits framework.

2009-02-07 Thread Michael Bayer
On Feb 7, 2009, at 8:57 PM, Christiaan Putter wrote: yeah thats all true but the point of InstrumentationManager is that its all OK - you send SQLA the events it needs. The question is what events does it need? there's a demo here:

[sqlalchemy] Re: Declarative with Enthoughts Traits framework.

2009-02-07 Thread Christiaan Putter
Thanks for the link. That's where I figured out most of what I'm trying to do. Now that I've stepped through the code I noticed that 'install_state' is only being called on the first 2 iterations of the loop. Haven't found out yet why that is. What exactly is supposed to be in the state? Is

[sqlalchemy] Re: Declarative with Enthoughts Traits framework.

2009-02-07 Thread Michael Bayer
install_state is normally called during __init__ of your object. the attributes package decorates __init__ for this purpose. so you have to get __init__, or __new__, or whatever, to ensure that attributes.instance_state(obj) will return an InstanceState at all times. On Feb 7, 2009,