[storm] setting a database timestamp

James Henstridge james at jamesh.id.au
Wed Apr 22 02:14:17 BST 2009


On Wed, Apr 22, 2009 at 8:43 AM, Martin DeMello <martindemello at gmail.com> wrote:
> How do I access postgresql's CURRENT_TIMESTAMP function from storm?
> That is, I want a table with a datetime column updated with the
> server's current time, not datetime.now() on the client.

Try the following:

from storm.expr import SQL

CURRENT_TIMESTAMP = SQL("CURRENT_TIMESTAMP")

Now you can assign that value and it'll be evaluated on the server.
It is treated as a lazy value, so accessing the field you assign it to
should result in a UPDATE and SELECT to get the new value.

James.



More information about the storm mailing list