15
15
from sqlalchemy.dialects.postgresql import \
16
16
ARRAY, BIGINT, BIT, BOOLEAN, BYTEA, CHAR, CIDR, DATE, \
17
DOUBLE_PRECISION, ENUM, FLOAT, INET, INTEGER, INTERVAL, \
18
MACADDR, NUMERIC, REAL, SMALLINT, TEXT, TIME, TIMESTAMP, \
17
DOUBLE_PRECISION, ENUM, FLOAT, HSTORE, INET, INTEGER, \
18
INTERVAL, MACADDR, NUMERIC, REAL, SMALLINT, TEXT, TIME, \
19
TIMESTAMP, UUID, VARCHAR, INT4RANGE, INT8RANGE, NUMRANGE, \
20
DATERANGE, TSRANGE, TSTZRANGE
21
22
Types which are specific to PostgreSQL, or have PostgreSQL-specific
22
23
construction arguments, are as follows:
24
25
.. currentmodule:: sqlalchemy.dialects.postgresql
26
29
.. autoclass:: ARRAY
30
:members: __init__, Comparator
88
The new range column types founds in PostgreSQL 9.2 onwards are
89
catered for by the following types:
91
.. autoclass:: INT4RANGE
94
.. autoclass:: INT8RANGE
97
.. autoclass:: NUMRANGE
100
.. autoclass:: DATERANGE
103
.. autoclass:: TSRANGE
106
.. autoclass:: TSTZRANGE
109
The types above get most of their functionality from the following
112
.. autoclass:: sqlalchemy.dialects.postgresql.ranges.RangeOperators
117
The range type DDL support should work with any Postgres DBAPI
118
driver, however the data types returned may vary. If you are using
119
``psycopg2``, it's recommended to upgrade to version 2.5 or later
120
before using these column types.
123
PostgreSQL Constraint Types
124
---------------------------
126
SQLAlchemy supports Postgresql EXCLUDE constraints via the
127
:class:`ExcludeConstraint` class:
129
.. autoclass:: ExcludeConstraint
135
from sqlalchemy.dialects.postgresql import ExcludeConstraint, TSRANGE
137
class RoomBookings(Base):
139
room = Column(Integer(), primary_key=True)
140
during = Column(TSRANGE())
143
ExcludeConstraint(('room', '='), ('during', '&&')),
74
149
.. automodule:: sqlalchemy.dialects.postgresql.psycopg2
78
152
--------------------
80
154
.. automodule:: sqlalchemy.dialects.postgresql.pypostgresql
85
159
.. automodule:: sqlalchemy.dialects.postgresql.pg8000
90
164
.. automodule:: sqlalchemy.dialects.postgresql.zxjdbc