diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-11-19 15:10:46 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-11-19 15:11:37 -0500 |
commit | 9ed36c2eed34b23560abe3cdf373c720b24d3b30 (patch) | |
tree | e387738957531c49c24745158884847ee837ee83 /lib/sqlalchemy/dialects/postgresql/base.py | |
parent | c7f9aa281857eeeaf7963c370bda43d2eb4746f5 (diff) | |
download | sqlalchemy-9ed36c2eed34b23560abe3cdf373c720b24d3b30.tar.gz |
- Fixed the ``.python_type`` attribute of :class:`.postgresql.INTERVAL`
to return ``datetime.timedelta`` in the same way as that of
:obj:`.types.Interval.python_type`, rather than raising
``NotImplementedError``.
fixes #3571
(cherry picked from commit 29d6f6e19b014bb5ce79032bd8803e32b4da0e5e)
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/base.py')
-rw-r--r-- | lib/sqlalchemy/dialects/postgresql/base.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index ef870a177..8de5bede7 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -603,6 +603,8 @@ a new version. """ from collections import defaultdict import re +import datetime as dt + from ... import sql, schema, exc, util from ...engine import default, reflection @@ -709,6 +711,10 @@ class INTERVAL(sqltypes.TypeEngine): def _type_affinity(self): return sqltypes.Interval + @property + def python_type(self): + return dt.timedelta + PGInterval = INTERVAL |