From 70edfa229c8bd3d34f11fbfeaf5a7fa6bb1dfff2 Mon Sep 17 00:00:00 2001 From: Chris Withers Date: Sun, 19 May 2013 08:50:06 +0100 Subject: Basic type support for the new range types in postgres 9.2 --- lib/sqlalchemy/dialects/postgresql/ranges.py | 51 ++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 lib/sqlalchemy/dialects/postgresql/ranges.py (limited to 'lib/sqlalchemy/dialects/postgresql/ranges.py') diff --git a/lib/sqlalchemy/dialects/postgresql/ranges.py b/lib/sqlalchemy/dialects/postgresql/ranges.py new file mode 100644 index 000000000..b3a670d91 --- /dev/null +++ b/lib/sqlalchemy/dialects/postgresql/ranges.py @@ -0,0 +1,51 @@ +# Copyright (C) 2013 the SQLAlchemy authors and contributors +# +# This module is part of SQLAlchemy and is released under +# the MIT License: http://www.opensource.org/licenses/mit-license.php + +from .base import ischema_names +from ... import types as sqltypes + +__all__ = ('INT4RANGE', 'INT8RANGE', 'NUMRANGE') + +class INT4RANGE(sqltypes.TypeEngine): + "Represent the Postgresql INT4RANGE type." + + __visit_name__ = 'INT4RANGE' + +ischema_names['int4range'] = INT4RANGE + +class INT8RANGE(sqltypes.TypeEngine): + "Represent the Postgresql INT8RANGE type." + + __visit_name__ = 'INT8RANGE' + +ischema_names['int8range'] = INT8RANGE + +class NUMRANGE(sqltypes.TypeEngine): + "Represent the Postgresql NUMRANGE type." + + __visit_name__ = 'NUMRANGE' + +ischema_names['numrange'] = NUMRANGE + +class DATERANGE(sqltypes.TypeEngine): + "Represent the Postgresql DATERANGE type." + + __visit_name__ = 'DATERANGE' + +ischema_names['daterange'] = DATERANGE + +class TSRANGE(sqltypes.TypeEngine): + "Represent the Postgresql TSRANGE type." + + __visit_name__ = 'TSRANGE' + +ischema_names['tsrange'] = TSRANGE + +class TSTZRANGE(sqltypes.TypeEngine): + "Represent the Postgresql TSTZRANGE type." + + __visit_name__ = 'TSTZRANGE' + +ischema_names['tstzrange'] = TSTZRANGE -- cgit v1.2.1