Re: [sqlalchemy] Re: Order by in select doesn't seem to work

2011-12-27 Thread Michael Bayer
On Dec 27, 2011, at 10:37 AM, VDK wrote: Michael, I simplified my code just for test purposes. I'm now working with only two columns, without order_by clause, commented a few other lines with order by. I'm sure there is no order_by left in my code. I run the script with echo set to debug.

[sqlalchemy] Re: Order by in select doesn't seem to work

2011-12-27 Thread VDK
Michael, I simplified my code just for test purposes. I'm now working with only two columns, without order_by clause, commented a few other lines with order by. I'm sure there is no order_by left in my code. I run the script with echo set to debug. The result:

Re: [sqlalchemy] Pickle/beaker error with InstrumentedList

2011-12-27 Thread Arturo Sevilla
Thanks for the code, your example runs without a problem. I've managed to locate the error. In reality it doesn't have to do with InstrumentedList. The problem occurs when beaker pickle.load()s from its cache file (a pickled object in a file). I get the following exception (which makes beaker

Re: [sqlalchemy] Pickle/beaker error with InstrumentedList

2011-12-27 Thread Michael Bayer
On Dec 27, 2011, at 4:54 AM, Arturo Sevilla wrote: Thanks for the code, your example runs without a problem. I've managed to locate the error. In reality it doesn't have to do with InstrumentedList. The problem occurs when beaker pickle.load()s from its cache file (a pickled object in a

[sqlalchemy] Re: 0.7 event migration

2011-12-27 Thread Kent
On Dec 26, 5:12 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Dec 26, 2011, at 1:50 PM, Kent wrote: Yes, a nice simplification. I'm using it to lazyload attributes for objects that aren't in a session.  I'm not sure if you pointed me there, I think I found it myself, but you

Re: [sqlalchemy] Re: 0.7 event migration

2011-12-27 Thread Michael Bayer
On Dec 27, 2011, at 8:10 AM, Kent wrote: Sounds good, I'll look into that. But I'm curious why this approach is preferable over the one I've currently got (callable_ seems more public than _state_session). callable_ does not accept the session as an argument, and while I looked into

Re: [sqlalchemy] declarative and late reflection?

2011-12-27 Thread peter sabaini
Cool -- works nicely, thanks again! On Fri, Dec 23, 2011 at 2:56 AM, Michael Bayer mike...@zzzcomputing.comwrote: On Dec 22, 2011, at 7:28 PM, Michael Bayer wrote: this could work really nicely with extend_existing, which has been enhanced in 0.7.4, but there seem to be some glitches

[sqlalchemy] SAWarning: Object of type Discount not in session, add operation along 'OrderDetailDiscount.discount' won't proceed

2011-12-27 Thread Kent
In http://www.sqlalchemy.org/trac/changeset/7025%3A0a6576abea5b#file1 you added a warning that I'm hitting now. 'when save-update cascade is disabled, or the target object is otherwise not present in the session, and collection/scalar changes have taken place. A warning is emitted describing the

Re: [sqlalchemy] SAWarning: Object of type Discount not in session, add operation along 'OrderDetailDiscount.discount' won't proceed

2011-12-27 Thread Michael Bayer
On Dec 27, 2011, at 1:51 PM, Kent wrote: In http://www.sqlalchemy.org/trac/changeset/7025%3A0a6576abea5b#file1 you added a warning that I'm hitting now. 'when save-update cascade is disabled, or the target object is otherwise not present in the session, and collection/scalar changes have

[sqlalchemy] money type for Postgresql

2011-12-27 Thread dgardner
Quick hack, figured I would share since there seemed to be other people asking about it. I couldn't get it to work with autoload=True for table reflection. --- from sqlalchemy import types from decimal import Decimal class Money(types.UserDefinedType): def get_col_spec(self):

Re: [sqlalchemy] SAWarning: Object of type Discount not in session, add operation along 'OrderDetailDiscount.discount' won't proceed

2011-12-27 Thread Kent
On 12/27/2011 2:34 PM, Michael Bayer wrote: On Dec 27, 2011, at 1:51 PM, Kent wrote: In http://www.sqlalchemy.org/trac/changeset/7025%3A0a6576abea5b#file1 you added a warning that I'm hitting now. 'when save-update cascade is disabled, or the target object is otherwise not present in the

Re: [sqlalchemy] money type for Postgresql

2011-12-27 Thread Julien Cigar
don't use the MONEY type in PostgreSQL, use NUMERIC instead. On 12/27/2011 20:39, dgardner wrote: Quick hack, figured I would share since there seemed to be other people asking about it. I couldn't get it to work with autoload=True for table reflection. --- from sqlalchemy import types from

Re: [sqlalchemy] SAWarning: Object of type Discount not in session, add operation along 'OrderDetailDiscount.discount' won't proceed

2011-12-27 Thread Michael Bayer
On Dec 27, 2011, at 3:33 PM, Kent wrote: Haha! I sense you're getting irritated, Mike! oops...that should never show... There are certain objects that aren't placed in the session because they aren't in the merge cascade (purposefully). These are transient objects I think that's

[sqlalchemy] Re: 0.7 event migration

2011-12-27 Thread Kent
So see what happens if you, for the moment, just monkeypatch over orm.session._state_session to do a lookup in a global context if state.session_id isn't set.  If that solves the problem of I want detached objects to load stuff, for you and everyone else who wants this feature, then

Re: [sqlalchemy] Re: 0.7 event migration

2011-12-27 Thread Michael Bayer
On Dec 27, 2011, at 5:21 PM, Kent wrote: So see what happens if you, for the moment, just monkeypatch over orm.session._state_session to do a lookup in a global context if state.session_id isn't set. If that solves the problem of I want detached objects to load stuff, for you and

[sqlalchemy] Order by the sequence in_ ?

2011-12-27 Thread Vlad K.
Hi all. I need to select some rows where pkey is in a sequence. How do I order by that very sequence? images_all = session.query(AdImage).filter(AdImage.image_id.in_(images)).order_by( ? ).all() Postgresql backend. Thanks! -- .oO V Oo. -- You received this message because you

[sqlalchemy] Re: money type for Postgresql

2011-12-27 Thread dgardner
While there may be legitimate reasons to choose the numeric type instead of the money type. This might not always be an option for people, especially when working with existing database. If a type is supported by a database back end there is no reason why it couldn't and shouldn't be supported by