From: Gaƫtan de Menten Date: Thu, 29 Oct 2009 21:24:33 +0000 (+0000) Subject: large speed improvement of the Interval type on non-native dialects X-Git-Tag: rel_0_6beta1~212 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8195ec35adf7d99c94dc87d7d3eb2c32c2be7252;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git large speed improvement of the Interval type on non-native dialects --- diff --git a/lib/sqlalchemy/types.py b/lib/sqlalchemy/types.py index 63a339baf8..92ff274f88 100644 --- a/lib/sqlalchemy/types.py +++ b/lib/sqlalchemy/types.py @@ -1072,16 +1072,17 @@ class Interval(TypeDecorator): """ impl = DateTime + epoch = dt.datetime.utcfromtimestamp(0) def process_bind_param(self, value, dialect): if value is None: return None - return dt.datetime.utcfromtimestamp(0) + value + return self.epoch + value def process_result_value(self, value, dialect): if value is None: return None - return value - dt.datetime.utcfromtimestamp(0) + return value - self.epoch class FLOAT(Float): """The SQL FLOAT type."""