[sqlalchemy] Re: Dynamic where-statement with OR

2006-11-10 Thread Lee McFadden
On 11/7/06, DNeumann [EMAIL PROTECTED] wrote: Hello list, To build a dynamic where-statement in my script, i looked here for more info: http://www.sqlalchemy.org/docs/sqlconstruction.myt#sql_building statement = my_table.select() if id: statement.append_whereclause(my_table.c.id==id)

[sqlalchemy] Design question: option mechanism

2006-11-10 Thread Alexandre CONRAD
Hello, this might be a little off topic and is more related to database design. I have 2 tables, clients and sites with a one-to-many relation (1 client has many sites). I'd like to design an option mechanism where I could create options (bool or multivalues strings, ie. checkbox or dropdown

[sqlalchemy] readonly attributes

2006-11-10 Thread qvx
I have an ActiveMapper class which looks like this: class OraJob(ActiveMapper): class mapping: id = column(Integer, primary_key = True) job_type = column(Unicode(30)) source_type = column(Unicode(30)) ... Attributes are used / should be used in readonly

[sqlalchemy] Re: Constructing where-clauses dynamically

2006-11-10 Thread Michael Bayer
On Nov 9, 2006, at 10:20 PM, Daniel Miller wrote: Can you give an example of the SQL (including the joins) that would be generated by your statement above? (user.user_id=orders.user_id AND orders.order_id=items.order_id AND items.item_name='item #4') OR (user.user_id=orders.user_id AND

[sqlalchemy] Re: Constructing where-clauses dynamically

2006-11-10 Thread Michael Bayer
On Nov 10, 2006, at 12:13 AM, Daniel Miller wrote: This query: q.select(or_( c.orders.items.item_name == 'item#4', c.orders.items.item_name == 'item #5' )) Should generate something similar to this SQL: SELECT ... FROM users u INNER JOIN orders o ON u.user_id =