After much thought and playing around I think I may have over-complicated the problem and found an easier way to do what I wanted:

s.query(Foo).update({"timcode_column": func.concat(func.left(Foo.timcode_column, 11), ":", "24") },False)

Thanks for the help anyway :)


On 08/28/2013 08:08 PM, Michael Bayer wrote:
On Aug 28, 2013, at 9:59 AM, Sebastian Elsner <[email protected]> wrote:

Now I would like to be able to do the following:

s.query(Foo).update({"some_timecode": Foo.some_timecode.add_hours(5)}) # Adds 5 
hours to every Foo's timecode

I have seen this should be possible with a Comparator factory in 0.8 but I am 
stuck with 0.7 for now. How can I do this with 0.7?
just move out your function:


update({"sometimecode": add_hours(Foo.some_timecode, 5)})

Something like this would also be OK for me:

s.query(Foo).update({"some_timecode": Foo.some_timecode + TC("01:00:00:00:00")})

I have tried implementing the __add__ for both the TC and Timecode class and read the 
"Augmenting Existing Types" help, but failed to put the puzzle together.

Thank you for helping!

Sebastian

--
check out www.pointcloud9.com

Sebastian Elsner - Pipeline Technical Director - RISE

t: +49 30 20180300 [email protected]
f: +49 30 61651074 www.risefx.com

RISE FX GmbH
Schlesische Strasse 28, Aufgang B, 10997 Berlin
c/o action concept, An der Hasenkaule 1-7, 50354 Hürth
Geschaeftsfuehrer: Sven Pannicke, Robert Pinnow
Handelsregister Berlin HRB 106667 B

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.


--
check out www.pointcloud9.com

Sebastian Elsner - Pipeline Technical Director - RISE

t: +49 30 20180300 [email protected]
f: +49 30 61651074 www.risefx.com

RISE FX GmbH
Schlesische Strasse 28, Aufgang B, 10997 Berlin
c/o action concept, An der Hasenkaule 1-7, 50354 Hürth
Geschaeftsfuehrer: Sven Pannicke, Robert Pinnow
Handelsregister Berlin HRB 106667 B

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to