diff options
| author | Chris Withers <chris@simplistix.co.uk> | 2013-06-10 13:24:02 +0100 |
|---|---|---|
| committer | Chris Withers <chris@simplistix.co.uk> | 2013-06-10 13:24:02 +0100 |
| commit | b2da12e070e9d83bea5284dae11b8e6d4d509818 (patch) | |
| tree | 2feac282d4b53875b0ddcc95b0b26768a7c668da /doc/build/dialects/postgresql.rst | |
| parent | b2ea2eef5db160183cd4f812b0ce1636d8799b91 (diff) | |
| download | sqlalchemy-pr/5.tar.gz | |
Documentation for the new range type support.pr/5
Diffstat (limited to 'doc/build/dialects/postgresql.rst')
| -rw-r--r-- | doc/build/dialects/postgresql.rst | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/doc/build/dialects/postgresql.rst b/doc/build/dialects/postgresql.rst index df141cce0..f2b401e9a 100644 --- a/doc/build/dialects/postgresql.rst +++ b/doc/build/dialects/postgresql.rst @@ -16,7 +16,8 @@ they originate from :mod:`sqlalchemy.types` or from the local dialect:: ARRAY, BIGINT, BIT, BOOLEAN, BYTEA, CHAR, CIDR, DATE, \ DOUBLE_PRECISION, ENUM, FLOAT, HSTORE, INET, INTEGER, \ INTERVAL, MACADDR, NUMERIC, REAL, SMALLINT, TEXT, TIME, \ - TIMESTAMP, UUID, VARCHAR + TIMESTAMP, UUID, VARCHAR, INT4RANGE, INT8RANGE, NUMRANGE, \ + DATERANGE, TSRANGE, TSTZRANGE Types which are specific to PostgreSQL, or have PostgreSQL-specific construction arguments, are as follows: @@ -81,6 +82,54 @@ construction arguments, are as follows: :members: __init__ :show-inheritance: +.. autoclass:: sqlalchemy.dialects.postgresql.ranges.RangeOperators + :members: + +.. autoclass:: INT4RANGE + :show-inheritance: + +.. autoclass:: INT8RANGE + :show-inheritance: + +.. autoclass:: NUMRANGE + :show-inheritance: + +.. autoclass:: DATERANGE + :show-inheritance: + +.. autoclass:: TSRANGE + :show-inheritance: + +.. autoclass:: TSTZRANGE + :show-inheritance: + + +PostgreSQL Constraint Types +--------------------------- + +SQLAlchemy supports Postgresql EXCLUDE constraints via the +:class:`ExcludeConstraint` class: + +.. autoclass:: ExcludeConstraint + :show-inheritance: + :members: __init__ + +For example:: + + from sqlalchemy.dialects.postgresql import ( + ExcludeConstraint, + TSRANGE as Range, + ) + + class RoomBookings(Base): + + room = Column(Integer(), primary_key=True) + during = Column(TSRANGE()) + + __table_args__ = ( + ExcludeConstraint(('room', '='), ('during', '&&')), + ) + psycopg2 -------------- |
