[sqlalchemy] Executing query results in ProgrammingError: can't adapt type 'InstrumentedAttribute'

2011-08-26 Thread OlduvaiHand
Hi all, I'm having a little bit of trouble with the boundary between the ORM and SQL expression language. Perhaps someone can set me aright. I'm building up a query on a model with a hybrid_property using the ORM. The hybrid_property.expression is a func.case statement. Because 1) I only need

Re: [sqlalchemy] Executing query results in ProgrammingError: can't adapt type 'InstrumentedAttribute'

2011-08-26 Thread Michael Bayer
On Aug 26, 2011, at 1:09 PM, OlduvaiHand wrote: Hi all, I'm having a little bit of trouble with the boundary between the ORM and SQL expression language. Perhaps someone can set me aright. I'm building up a query on a model with a hybrid_property using the ORM. The

[sqlalchemy] Re: Executing query results in ProgrammingError: can't adapt type 'InstrumentedAttribute'

2011-08-26 Thread OlduvaiHand
Indeed. I did mean to be using the case() function. Thanks, zzzeek. Incidentally, this particular case is supposed to return EnumSymbols of the variety you describe in your EnumRecipe on techspot. Now that the correct case function is being used, I'm still getting a ProgrammingError: can't

Re: [sqlalchemy] Re: Executing query results in ProgrammingError: can't adapt type 'InstrumentedAttribute'

2011-08-26 Thread Michael Bayer
On Aug 26, 2011, at 1:34 PM, OlduvaiHand wrote: Indeed. I did mean to be using the case() function. Thanks, zzzeek. Incidentally, this particular case is supposed to return EnumSymbols of the variety you describe in your EnumRecipe on techspot. Now that the correct case function is being

[sqlalchemy] Re: Executing query results in ProgrammingError: can't adapt type 'InstrumentedAttribute'

2011-08-26 Thread OlduvaiHand
That makes perfect sense. I really appreciate the help. Everything is working as expected now. On Aug 26, 12:42 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Aug 26, 2011, at 1:34 PM, OlduvaiHand wrote: Indeed.  I did mean to be using the case() function.  Thanks, zzzeek.

[sqlalchemy] Bug? Declarative syntax for double self-referential constructs with association object

2011-08-26 Thread Thomas Jacob
Hello List I'd like to define a many-to-many relationship using the declarative syntax between a table to itself, but employing an association object (since I require the association to have attributes also). Here's what I tried:

[sqlalchemy] Re: Bug? Declarative syntax for double self-referential constructs with association object

2011-08-26 Thread Michael Bayer
the error message here isn't fantastic but I think you mean to say: oa = ObjectAssociation() o2.relate_down.append(oa) o.relate_up.append(oa) as relate_up/relate_down accept ObjectAssociation objects, not Object objects, as members. On Aug 26, 2:53 pm, Thomas Jacob ja...@internet24.de wrote:

Re: [sqlalchemy] Bug? Declarative syntax for double self-referential constructs with association object

2011-08-26 Thread Thomas Jacob
On Aug 26, 2011, at 9:36 PM, Michael Bayer wrote: the error message here isn't fantastic but I think you mean to say: oa = ObjectAssociation() o2.relate_down.append(oa) o.relate_up.append(oa) as relate_up/relate_down accept ObjectAssociation objects, not Object objects, as members.

Re: [sqlalchemy] Bug? Declarative syntax for double self-referential constructs with association object

2011-08-26 Thread Michael Bayer
On Aug 26, 2011, at 4:06 PM, Thomas Jacob wrote: On Aug 26, 2011, at 9:36 PM, Michael Bayer wrote: the error message here isn't fantastic but I think you mean to say: oa = ObjectAssociation() o2.relate_down.append(oa) o.relate_up.append(oa) as relate_up/relate_down accept

Re: [sqlalchemy] Inserting new records table with serial primary key in Postgresql using ORM

2011-08-26 Thread Michael Bayer
Theres no apparent issue with your code, a completed version working correctly is attached - I only needed to create Entry. Start with the attached script, using a new, blank database since it drops the tables, and work backwards towards the identical situation as your failing code to

Re: [sqlalchemy] Inserting new records table with serial primary key in Postgresql using ORM

2011-08-26 Thread Michael Bayer
Sorry, once more, using the SERIAL value in an autoincrementing fashion instead of the 0. Also works without issue. On Aug 26, 2011, at 11:20 PM, Michael Bayer wrote: Theres no apparent issue with your code, a completed version working correctly is attached - I only needed to create