[sqlalchemy] Re: Dynamic or-Statement

2006-11-08 Thread Michael Bayer
build the OR clause separately: list = [] list.append(users.c.user_id==id) list.append(users.c.user_name==name) statement = user.select(or_(*list)) or statement.append_whereclause(or_(*list)) alternate method: critrerion = users.c.user_id==id criterion =

[sqlalchemy] Re: polymorphic_identity determination

2006-11-08 Thread Michael Bayer
On Nov 8, 2006, at 12:04 AM, Randall Smith wrote: That leads to the part I'm stuck on; mapper inheritance. When finished, session.query(Employee).select() should list all employee as instances of their specific classes and session.query(Engineer).select() should list all engineers ...

[sqlalchemy] Clases with __slots__ attribute

2006-11-08 Thread juanvalino
Hi, I've detected that when a class has __slots__ attribute, a mapper cannot be build because the sqlalchemy tries to create a magic attribute and fails: File build/bdist.linux-x86_64/egg/sqlalchemy/orm/attributes.py, line 672, in init_attr AttributeError: 'MyClass' object has no attribute

[sqlalchemy] Re: Column __repr__ with sqlalchemy types instead of db-specific object instances?

2006-11-08 Thread jeffk
Michael Bayer wrote: __repr__() really annoys me because no matter what i do with it, people tell me im using it incorrectly. technically, __repr__() is supposed to return a string that when eval'ed would return the object instance. which is not realistic for an object like Table since its

[sqlalchemy] Re: Constructing where-clauses dynamically

2006-11-08 Thread Daniel Miller
Michael Bayer wrote: ok let me rephrase that... i have concerns. i think the concerns could be addressed, and we might be able to add this kind of feature...but i dont want to rush into it singlehandedly. I won't blame you for that. I'll help out as much as possible given my busy

[sqlalchemy] Re: Constructing where-clauses dynamically

2006-11-08 Thread Michael Bayer
On Nov 8, 2006, at 10:00 PM, Daniel Miller wrote: q = session.query(User) c = getcols(User) q.select( (c.addresses.street == 'some address') (c.orders.items.item_name == 'item #4') ) ohh, wow. heh. i had this discomfort with adding relationships to c, but then you just

[sqlalchemy] Re: Column __repr__ with sqlalchemy types instead of db-specific object instances?

2006-11-08 Thread Michael Bayer
when you reflect a table from the DB, and you get back PGString, that is the actual type instance. In some cases, table reflection could be mapped to a type instance that is specific to that DB (such as MySQL's enum). i dont think changing the __repr__ of all the db- specific types to