On Jun 26, 2006, at 7:47 PM, Mike Bernson wrote:
> I must be missing something.
>
> I have a dict of keys and values that I want to build a select
> statement
> from.
>
>
> The dict is of the form
>
> dict['key1'] = value1
> dict['key2'] = value2
> dict['key3'] = value3
>
> I want to build a select statement that has a where clause
>
> where key1 = value1 and key2 = value2 and key3 = value3
>
s = table.select(and_(*[table.c[k]==v for k, v in dict.iteritems()]))
>
> The other thing I would like to be able to do is build a select
> statement for the primary key. I would like to be able to pass
> some method a list of values for the primary key and have it build
> the select statement. In some cases this is easy as the primary key
> is just column. In other cases the primary key is a number of columns.
>
def pkselect(values):
return table.select(and_(*[col==v for col, v in zip
(table.primary_key, values)]))
> If I can do the first things I can then do the second one but it is a
> common enough case that it be easy to do (method)
A specific method for either of these within the SA core would start
feeling like a HumaneInterface to me (i.e. huge lists of functions,
each one suiting a particular developers whim). better for people to
master a smaller set of functions and build what they need.
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users