Hi,

I'm trying to get into SQLAlchemy and it has been really great so far,
but there are two things I can't figure out how to do:

(both are outside of ORM)

a) How do I do:

UPDATE sometable SET value = value * 0.9 + 1    [ + optional WHERE
clause ] ?

I've tried experimenting with .update(values=..) or stuff
like .execute(value=sometable.c.value*0.9+1) but it just tries to do
strange things. (SET value=sometable.value * %(sometable_value)s + %
(literal)s ??)

b) I have an array (or tuple) with values that I'd just like to fire
off to insert() which is compiled to work on one column (the other
columns have defaults or pre-set values)... To me, this one ought to
be obvious and intuitive, and maybe I'm just stupid or blind, but I
can't find a way.

(Alternatively, if I have an array such as [(1, 'hi', 'text'), (2,
'hello', 'tuxt'), ...] where the columns match up to the columns in
the table (or a given insert())...)

.execute(*[dict(name=x) for x in array]) # to me, this is inelegant
and horribly roundabout

I'm not raising concern about any speed penalty for having to make a
dict() for every param (100% negligible), it's just that it seems so
unnecessary! (Given Python's good polymorphism and introspection.)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to