
H`Tc        g   @   sT  d  Z  d d l m Z d d l Z d d l m Z m Z m Z m Z d d l	 m
 Z
 m Z d d l m Z m Z m Z d d l m Z y d d	 l m Z Wn e k
 r e Z n Xd d
 l m Z m Z m Z m Z m Z m Z m Z m Z m Z m  Z  m! Z! e" d d d d d d d d d d d d d d d d d d d d d d  d! d" d# d$ d% d& d' d( d) d* d+ d, d- d. d/ d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d: d; d< d= d> d? d@ dA dB dC dD dE dF dG dH dI dJ dK dL dM dN dO dP dQ dR dS dT dU dV dW dX dY dZ d[ d\ d] d^ d_ d` da db dc dd de df dg dh di dj dk dl dm dn do dp gf  Z# dq dr f Z$ ds dt du dv f Z% dw dx dy dz d{ d| d} f Z& d~ e j' f d     YZ( d e j) f d     YZ* d e j+ f d     YZ, e, Z- d e j+ f d     YZ. e. Z/ d e j+ f d     YZ0 e0 Z1 d e j+ f d     YZ2 d e j3 f d     YZ3 d e j4 f d     YZ4 d e j+ f d     YZ5 e5 Z6 d e j+ f d     YZ7 e7 Z8 d e j+ f d     YZ e Z9 d e j+ f d     YZ: d e j; f d     YZ< d e j; f d     YZ= d e j; f d     YZ> d e j? f d     YZ@ d e jA e j+ f d     YZB eB ZC d e jD f d     YZE i e5 e jF 6eE e jD 6ZG i  e d 6e d 6e d 6e d 6e d 6e jH d 6e jH d 6e d 6e d 6e d 6e! d 6e, d 6e. d 6e d 6e7 d 6e7 d 6e0 d 6e2 d 6e* d 6e3 d 6e3 d 6e3 d 6e4 d 6e4 d 6e d 6e4 d 6e( d 6e  d 6e5 d 6e5 d 6e5 d 6e: d 6ZI d e jJ f d     YZK d e jL f d     YZM d e jN f d     YZO d e jP f d     YZQ d e jR f d     YZS d e jT f d     YZU d e jT f d     YZV d e
 jW f d     YZX d e
 jY f d     YZZ d S(   s;  
.. dialect:: postgresql
    :name: PostgreSQL


Sequences/SERIAL
----------------

PostgreSQL supports sequences, and SQLAlchemy uses these as the default means
of creating new primary key values for integer-based primary key columns. When
creating tables, SQLAlchemy will issue the ``SERIAL`` datatype for
integer-based primary key columns, which generates a sequence and server side
default corresponding to the column.

To specify a specific named sequence to be used for primary key generation,
use the :func:`~sqlalchemy.schema.Sequence` construct::

    Table('sometable', metadata,
            Column('id', Integer, Sequence('some_id_seq'), primary_key=True)
        )

When SQLAlchemy issues a single INSERT statement, to fulfill the contract of
having the "last insert identifier" available, a RETURNING clause is added to
the INSERT statement which specifies the primary key columns should be
returned after the statement completes. The RETURNING functionality only takes
place if Postgresql 8.2 or later is in use. As a fallback approach, the
sequence, whether specified explicitly or implicitly via ``SERIAL``, is
executed independently beforehand, the returned value to be used in the
subsequent insert. Note that when an
:func:`~sqlalchemy.sql.expression.insert()` construct is executed using
"executemany" semantics, the "last inserted identifier" functionality does not
apply; no RETURNING clause is emitted nor is the sequence pre-executed in this
case.

To force the usage of RETURNING by default off, specify the flag
``implicit_returning=False`` to :func:`.create_engine`.

.. _postgresql_isolation_level:

Transaction Isolation Level
---------------------------

All Postgresql dialects support setting of transaction isolation level
both via a dialect-specific parameter ``isolation_level``
accepted by :func:`.create_engine`,
as well as the ``isolation_level`` argument as passed to
:meth:`.Connection.execution_options`.  When using a non-psycopg2 dialect,
this feature works by issuing the command
``SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL <level>`` for
each new connection.

To set isolation level using :func:`.create_engine`::

    engine = create_engine(
        "postgresql+pg8000://scott:tiger@localhost/test",
        isolation_level="READ UNCOMMITTED"
    )

To set using per-connection execution options::

    connection = engine.connect()
    connection = connection.execution_options(
        isolation_level="READ COMMITTED"
    )

Valid values for ``isolation_level`` include:

* ``READ COMMITTED``
* ``READ UNCOMMITTED``
* ``REPEATABLE READ``
* ``SERIALIZABLE``

The :mod:`~sqlalchemy.dialects.postgresql.psycopg2` and
:mod:`~sqlalchemy.dialects.postgresql.pg8000` dialects also offer the
special level ``AUTOCOMMIT``.

.. seealso::

    :ref:`psycopg2_isolation_level`

    :ref:`pg8000_isolation_level`

.. _postgresql_schema_reflection:

Remote-Schema Table Introspection and Postgresql search_path
------------------------------------------------------------

The Postgresql dialect can reflect tables from any schema.  The
:paramref:`.Table.schema` argument, or alternatively the
:paramref:`.MetaData.reflect.schema` argument determines which schema will
be searched for the table or tables.   The reflected :class:`.Table` objects
will in all cases retain this ``.schema`` attribute as was specified.
However, with regards to tables which these :class:`.Table` objects refer to
via foreign key constraint, a decision must be made as to how the ``.schema``
is represented in those remote tables, in the case where that remote
schema name is also a member of the current
`Postgresql search path
<http://www.postgresql.org/docs/9.0/static/ddl-schemas.html#DDL-SCHEMAS-PATH>`_.

By default, the Postgresql dialect mimics the behavior encouraged by
Postgresql's own ``pg_get_constraintdef()`` builtin procedure.  This function
returns a sample definition for a particular foreign key constraint,
omitting the referenced schema name from that definition when the name is
also in the Postgresql schema search path.  The interaction below
illustrates this behavior::

    test=> CREATE TABLE test_schema.referred(id INTEGER PRIMARY KEY);
    CREATE TABLE
    test=> CREATE TABLE referring(
    test(>         id INTEGER PRIMARY KEY,
    test(>         referred_id INTEGER REFERENCES test_schema.referred(id));
    CREATE TABLE
    test=> SET search_path TO public, test_schema;
    test=> SELECT pg_catalog.pg_get_constraintdef(r.oid, true) FROM
    test-> pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n
    test-> ON n.oid = c.relnamespace
    test-> JOIN pg_catalog.pg_constraint r  ON c.oid = r.conrelid
    test-> WHERE c.relname='referring' AND r.contype = 'f'
    test-> ;
                   pg_get_constraintdef
    ---------------------------------------------------
     FOREIGN KEY (referred_id) REFERENCES referred(id)
    (1 row)

Above, we created a table ``referred`` as a member of the remote schema
``test_schema``, however when we added ``test_schema`` to the
PG ``search_path`` and then asked ``pg_get_constraintdef()`` for the
``FOREIGN KEY`` syntax, ``test_schema`` was not included in the output of
the function.

On the other hand, if we set the search path back to the typical default
of ``public``::

    test=> SET search_path TO public;
    SET

The same query against ``pg_get_constraintdef()`` now returns the fully
schema-qualified name for us::

    test=> SELECT pg_catalog.pg_get_constraintdef(r.oid, true) FROM
    test-> pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n
    test-> ON n.oid = c.relnamespace
    test-> JOIN pg_catalog.pg_constraint r  ON c.oid = r.conrelid
    test-> WHERE c.relname='referring' AND r.contype = 'f';
                         pg_get_constraintdef
    ---------------------------------------------------------------
     FOREIGN KEY (referred_id) REFERENCES test_schema.referred(id)
    (1 row)

SQLAlchemy will by default use the return value of ``pg_get_constraintdef()``
in order to determine the remote schema name.  That is, if our ``search_path``
were set to include ``test_schema``, and we invoked a table
reflection process as follows::

    >>> from sqlalchemy import Table, MetaData, create_engine
    >>> engine = create_engine("postgresql://scott:tiger@localhost/test")
    >>> with engine.connect() as conn:
    ...     conn.execute("SET search_path TO test_schema, public")
    ...     meta = MetaData()
    ...     referring = Table('referring', meta,
    ...                       autoload=True, autoload_with=conn)
    ...
    <sqlalchemy.engine.result.ResultProxy object at 0x101612ed0>

The above process would deliver to the :attr:`.MetaData.tables` collection
``referred`` table named **without** the schema::

    >>> meta.tables['referred'].schema is None
    True

To alter the behavior of reflection such that the referred schema is
maintained regardless of the ``search_path`` setting, use the
``postgresql_ignore_search_path`` option, which can be specified as a
dialect-specific argument to both :class:`.Table` as well as
:meth:`.MetaData.reflect`::

    >>> with engine.connect() as conn:
    ...     conn.execute("SET search_path TO test_schema, public")
    ...     meta = MetaData()
    ...     referring = Table('referring', meta, autoload=True,
    ...                       autoload_with=conn,
    ...                       postgresql_ignore_search_path=True)
    ...
    <sqlalchemy.engine.result.ResultProxy object at 0x1016126d0>

We will now have ``test_schema.referred`` stored as schema-qualified::

    >>> meta.tables['test_schema.referred'].schema
    'test_schema'

.. sidebar:: Best Practices for Postgresql Schema reflection

    The description of Postgresql schema reflection behavior is complex, and
    is the product of many years of dealing with widely varied use cases and
    user preferences. But in fact, there's no need to understand any of it if
    you just stick to the simplest use pattern: leave the ``search_path`` set
    to its default of ``public`` only, never refer to the name ``public`` as
    an explicit schema name otherwise, and refer to all other schema names
    explicitly when building up a :class:`.Table` object.  The options
    described here are only for those users who can't, or prefer not to, stay
    within these guidelines.

Note that **in all cases**, the "default" schema is always reflected as
``None``. The "default" schema on Postgresql is that which is returned by the
Postgresql ``current_schema()`` function.  On a typical Postgresql
installation, this is the name ``public``.  So a table that refers to another
which is in the ``public`` (i.e. default) schema will always have the
``.schema`` attribute set to ``None``.

.. versionadded:: 0.9.2 Added the ``postgresql_ignore_search_path``
   dialect-level option accepted by :class:`.Table` and
   :meth:`.MetaData.reflect`.


.. seealso::

        `The Schema Search Path
        <http://www.postgresql.org/docs/9.0/static/ddl-schemas.html#DDL-SCHEMAS-PATH>`_
        - on the Postgresql website.

INSERT/UPDATE...RETURNING
-------------------------

The dialect supports PG 8.2's ``INSERT..RETURNING``, ``UPDATE..RETURNING`` and
``DELETE..RETURNING`` syntaxes.   ``INSERT..RETURNING`` is used by default
for single-row INSERT statements in order to fetch newly generated
primary key identifiers.   To specify an explicit ``RETURNING`` clause,
use the :meth:`._UpdateBase.returning` method on a per-statement basis::

    # INSERT..RETURNING
    result = table.insert().returning(table.c.col1, table.c.col2).\
        values(name='foo')
    print result.fetchall()

    # UPDATE..RETURNING
    result = table.update().returning(table.c.col1, table.c.col2).\
        where(table.c.name=='foo').values(name='bar')
    print result.fetchall()

    # DELETE..RETURNING
    result = table.delete().returning(table.c.col1, table.c.col2).\
        where(table.c.name=='foo')
    print result.fetchall()

.. _postgresql_match:

Full Text Search
----------------

SQLAlchemy makes available the Postgresql ``@@`` operator via the
:meth:`.ColumnElement.match` method on any textual column expression.
On a Postgresql dialect, an expression like the following::

    select([sometable.c.text.match("search string")])

will emit to the database::

    SELECT text @@ to_tsquery('search string') FROM table

The Postgresql text search functions such as ``to_tsquery()``
and ``to_tsvector()`` are available
explicitly using the standard :attr:`.func` construct.  For example::

    select([
        func.to_tsvector('fat cats ate rats').match('cat & rat')
    ])

Emits the equivalent of::

    SELECT to_tsvector('fat cats ate rats') @@ to_tsquery('cat & rat')

The :class:`.postgresql.TSVECTOR` type can provide for explicit CAST::

    from sqlalchemy.dialects.postgresql import TSVECTOR
    from sqlalchemy import select, cast
    select([cast("some text", TSVECTOR)])

produces a statement equivalent to::

    SELECT CAST('some text' AS TSVECTOR) AS anon_1

Full Text Searches in Postgresql are influenced by a combination of: the
PostgresSQL setting of ``default_text_search_config``, the ``regconfig`` used
to build the GIN/GiST indexes, and the ``regconfig`` optionally passed in
during a query.

When performing a Full Text Search against a column that has a GIN or
GiST index that is already pre-computed (which is common on full text
searches) one may need to explicitly pass in a particular PostgresSQL
``regconfig`` value to ensure the query-planner utilizes the index and does
not re-compute the column on demand.

In order to provide for this explicit query planning, or to use different
search strategies, the ``match`` method accepts a ``postgresql_regconfig``
keyword argument.

    select([mytable.c.id]).where(
        mytable.c.title.match('somestring', postgresql_regconfig='english')
    )

Emits the equivalent of::

    SELECT mytable.id FROM mytable
    WHERE mytable.title @@ to_tsquery('english', 'somestring')

One can also specifically pass in a `'regconfig'` value to the
``to_tsvector()`` command as the initial argument.

    select([mytable.c.id]).where(
            func.to_tsvector('english', mytable.c.title )            .match('somestring', postgresql_regconfig='english')
        )

produces a statement equivalent to::

    SELECT mytable.id FROM mytable
    WHERE to_tsvector('english', mytable.title) @@
        to_tsquery('english', 'somestring')

It is recommended that you use the ``EXPLAIN ANALYZE...`` tool from
PostgresSQL to ensure that you are generating queries with SQLAlchemy that
take full advantage of any indexes you may have created for full text search.

FROM ONLY ...
------------------------

The dialect supports PostgreSQL's ONLY keyword for targeting only a particular
table in an inheritance hierarchy. This can be used to produce the
``SELECT ... FROM ONLY``, ``UPDATE ONLY ...``, and ``DELETE FROM ONLY ...``
syntaxes. It uses SQLAlchemy's hints mechanism::

    # SELECT ... FROM ONLY ...
    result = table.select().with_hint(table, 'ONLY', 'postgresql')
    print result.fetchall()

    # UPDATE ONLY ...
    table.update(values=dict(foo='bar')).with_hint('ONLY',
                                                   dialect_name='postgresql')

    # DELETE FROM ONLY ...
    table.delete().with_hint('ONLY', dialect_name='postgresql')

.. _postgresql_indexes:

Postgresql-Specific Index Options
---------------------------------

Several extensions to the :class:`.Index` construct are available, specific
to the PostgreSQL dialect.

Partial Indexes
^^^^^^^^^^^^^^^^

Partial indexes add criterion to the index definition so that the index is
applied to a subset of rows.   These can be specified on :class:`.Index`
using the ``postgresql_where`` keyword argument::

  Index('my_index', my_table.c.id, postgresql_where=tbl.c.value > 10)

Operator Classes
^^^^^^^^^^^^^^^^^

PostgreSQL allows the specification of an *operator class* for each column of
an index (see
http://www.postgresql.org/docs/8.3/interactive/indexes-opclass.html).
The :class:`.Index` construct allows these to be specified via the
``postgresql_ops`` keyword argument::

    Index('my_index', my_table.c.id, my_table.c.data,
                            postgresql_ops={
                                'data': 'text_pattern_ops',
                                'id': 'int4_ops'
                            })

.. versionadded:: 0.7.2
    ``postgresql_ops`` keyword argument to :class:`.Index` construct.

Note that the keys in the ``postgresql_ops`` dictionary are the "key" name of
the :class:`.Column`, i.e. the name used to access it from the ``.c``
collection of :class:`.Table`, which can be configured to be different than
the actual name of the column as expressed in the database.

Index Types
^^^^^^^^^^^^

PostgreSQL provides several index types: B-Tree, Hash, GiST, and GIN, as well
as the ability for users to create their own (see
http://www.postgresql.org/docs/8.3/static/indexes-types.html). These can be
specified on :class:`.Index` using the ``postgresql_using`` keyword argument::

    Index('my_index', my_table.c.data, postgresql_using='gin')

The value passed to the keyword argument will be simply passed through to the
underlying CREATE INDEX command, so it *must* be a valid index type for your
version of PostgreSQL.

i(   t   defaultdictNi   (   t   sqlt   schemat   exct   util(   t   defaultt
   reflection(   t   compilert
   expressiont	   operators(   t   types(   t   UUID(   t   INTEGERt   BIGINTt   SMALLINTt   VARCHARt   CHARt   TEXTt   FLOATt   NUMERICt   DATEt   BOOLEANt   REALt   allt   analyset   analyzet   andt   anyt   arrayt   ast   asct
   asymmetrict   botht   caset   castt   checkt   collatet   columnt
   constraintt   createt   current_catalogt   current_datet   current_rolet   current_timet   current_timestampt   current_userR   t
   deferrablet   desct   distinctt   dot   elset   endt   exceptt   falset   fetcht   fort   foreignt   fromt   grantt   groupt   havingt   int	   initiallyt	   intersectt   intot   leadingt   limitt	   localtimet   localtimestampt   newt   nott   nullt   oft   offt   offsett   oldt   ont   onlyt   ort   ordert   placingt   primaryt
   referencest	   returningt   selectt   session_usert   somet	   symmetrict   tablet   thent   tot   trailingt   truet   uniont   uniquet   usert   usingt   variadict   whent   wheret   windowt   witht   authorizationt   betweent   binaryt   crosst   current_schemat   freezet   fullt   iliket   innert   ist   isnullt   joint   leftt   liket   naturalt   notnullt   outert   overt   overlapst   rightt   similart   verbosei  i  i  i  i  i  i   i   i   i   i  i  i  t   BYTEAc           B   s   e  Z d  Z RS(   R|   (   t   __name__t
   __module__t   __visit_name__(    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR|     s   t   DOUBLE_PRECISIONc           B   s   e  Z d  Z RS(   R   (   R}   R~   R   (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s   t   INETc           B   s   e  Z d  Z RS(   R   (   R}   R~   R   (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s   t   CIDRc           B   s   e  Z d  Z RS(   R   (   R}   R~   R   (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s   t   MACADDRc           B   s   e  Z d  Z RS(   R   (   R}   R~   R   (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s   t   OIDc           B   s   e  Z d  Z d Z RS(   sC   Provide the Postgresql OID type.

    .. versionadded:: 0.9.5

    R   (   R}   R~   t   __doc__R   (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s   t	   TIMESTAMPc           B   s   e  Z e d d   Z RS(   c         C   s&   t  t |   j d |  | |  _ d  S(   Nt   timezone(   t   superR   t   __init__t	   precision(   t   selfR   R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s    N(   R}   R~   t   Falset   NoneR   (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s   t   TIMEc           B   s   e  Z e d d   Z RS(   c         C   s&   t  t |   j d |  | |  _ d  S(   NR   (   R   R   R   R   (   R   R   R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s    N(   R}   R~   R   R   R   (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s   t   INTERVALc           B   s>   e  Z d  Z d Z d d  Z e d    Z e d    Z	 RS(   s   Postgresql INTERVAL type.

    The INTERVAL type may not be supported on all DBAPIs.
    It is known to work on psycopg2 and not pg8000 or zxjdbc.

    R   c         C   s   | |  _  d  S(   N(   R   (   R   R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s    c         C   s   t  d | j  S(   NR   (   R   t   second_precision(   t   clst   interval(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   _adapt_from_generic_interval  s    c         C   s   t  j S(   N(   t   sqltypest   Interval(   R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   _type_affinity  s    N(
   R}   R~   R   R   R   R   t   classmethodR   t   propertyR   (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s
   t   BITc           B   s   e  Z d  Z d e d  Z RS(   R   c         C   s.   | s | p d |  _  n	 | |  _  | |  _ d  S(   Ni   (   t   lengtht   varying(   R   R   R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s    	N(   R}   R~   R   R   R   R   (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s   R   c           B   s2   e  Z d  Z d Z e d  Z d   Z d   Z RS(   s
  Postgresql UUID type.

    Represents the UUID column type, interpreting
    data either as natively returned by the DBAPI
    or as Python uuid objects.

    The UUID type may not be supported on all DBAPIs.
    It is known to work on psycopg2 and not pg8000.

    R   c         C   s.   | r! t  d k r! t d   n  | |  _ d S(   s   Construct a UUID type.


        :param as_uuid=False: if True, values will be interpreted
         as Python uuid objects, converting to/from string via the
         DBAPI.

         s=   This version of Python does not support the native UUID type.N(   t   _python_UUIDR   t   NotImplementedErrort   as_uuid(   R   R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR   !  s    	c         C   s   |  j  r d   } | Sd  Sd  S(   Nc         S   s"   |  d  k	 r t j |   }  n  |  S(   N(   R   R   t	   text_type(   t   value(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   process3  s    (   R   R   (   R   t   dialectR   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   bind_processor1  s    		c         C   s   |  j  r d   } | Sd  Sd  S(   Nc         S   s   |  d  k	 r t |   }  n  |  S(   N(   R   R   (   R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR   =  s    (   R   R   (   R   R   t   coltypeR   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   result_processor;  s    		(   R}   R~   R   R   R   R   R   R   (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s
   	
t   TSVECTORc           B   s   e  Z d  Z d Z RS(   s  The :class:`.postgresql.TSVECTOR` type implements the Postgresql
    text search type TSVECTOR.

    It can be used to do full text queries on natural language
    documents.

    .. versionadded:: 0.9.0

    .. seealso::

        :ref:`postgresql_match`

    R   (   R}   R~   R   R   (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR   H  s   t   _Slicec           B   s    e  Z d  Z e j Z d   Z RS(   t   slicec         C   sF   | j  | j t j | j  |  _ | j  | j t j | j  |  _ d  S(   N(   t   _check_literalt   exprR	   t   getitemt   startt   stop(   R   t   slice_t   source_comparator(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR   ^  s    (   R}   R~   R   R   t   NULLTYPEt   typeR   (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR   Z  s   	t   Anyc           B   s#   e  Z d  Z d Z e j d  Z RS(   s   Represent the clause ``left operator ANY (right)``.  ``right`` must be
    an array expression.

    .. seealso::

        :class:`.postgresql.ARRAY`

        :meth:`.postgresql.ARRAY.Comparator.any` - ARRAY-bound method

    R   c         C   s7   t  j   |  _ t j |  |  _ | |  _ | |  _ d  S(   N(   R   t   BooleanR   R   t   _literal_as_bindsRr   Ry   t   operator(   R   Rr   Ry   R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR   u  s    	(   R}   R~   R   R   R	   t   eqR   (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR   g  s   t   Allc           B   s#   e  Z d  Z d Z e j d  Z RS(   s   Represent the clause ``left operator ALL (right)``.  ``right`` must be
    an array expression.

    .. seealso::

        :class:`.postgresql.ARRAY`

        :meth:`.postgresql.ARRAY.Comparator.all` - ARRAY-bound method

    R   c         C   s7   t  j   |  _ t j |  |  _ | |  _ | |  _ d  S(   N(   R   R   R   R   R   Rr   Ry   R   (   R   Rr   Ry   R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s    	(   R}   R~   R   R   R	   R   R   (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR   |  s   c           B   s2   e  Z d  Z d Z d   Z d   Z d d  Z RS(   s  A Postgresql ARRAY literal.

    This is used to produce ARRAY literals in SQL expressions, e.g.::

        from sqlalchemy.dialects.postgresql import array
        from sqlalchemy.dialects import postgresql
        from sqlalchemy import select, func

        stmt = select([
                        array([1,2]) + array([3,4,5])
                    ])

        print stmt.compile(dialect=postgresql.dialect())

    Produces the SQL::

        SELECT ARRAY[%(param_1)s, %(param_2)s] ||
            ARRAY[%(param_3)s, %(param_4)s, %(param_5)s]) AS anon_1

    An instance of :class:`.array` will always have the datatype
    :class:`.ARRAY`.  The "inner" type of the array is inferred from
    the values present, unless the ``type_`` keyword argument is passed::

        array(['foo', 'bar'], type_=CHAR)

    .. versionadded:: 0.8 Added the :class:`~.postgresql.array` literal type.

    See also:

    :class:`.postgresql.ARRAY`

    R   c         K   s/   t  t |   j | |   t |  j  |  _ d  S(   N(   R   R   R   t   ARRAYR   (   R   t   clausest   kw(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s    c         C   s>   t  g  | D]- } t j d  | d | d |  j d t ^ q
  S(   Nt   _compared_to_operatort   _compared_to_typeR^   (   R   R   t   BindParameterR   R   t   True(   R   R   t   objt   o(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   _bind_param  s    c         C   s   |  S(   N(    (   R   t   against(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt
   self_group  s    N(   R}   R~   R   R   R   R   R   R   (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s
   !		R   c           B   s{   e  Z d  Z d Z d e j j f d     YZ e Z e d
 e d  Z
 e d    Z d   Z d   Z d   Z d	   Z RS(   s	  Postgresql ARRAY type.

    Represents values as Python lists.

    An :class:`.ARRAY` type is constructed given the "type"
    of element::

        mytable = Table("mytable", metadata,
                Column("data", ARRAY(Integer))
            )

    The above type represents an N-dimensional array,
    meaning Postgresql will interpret values with any number
    of dimensions automatically.   To produce an INSERT
    construct that passes in a 1-dimensional array of integers::

        connection.execute(
                mytable.insert(),
                data=[1,2,3]
        )

    The :class:`.ARRAY` type can be constructed given a fixed number
    of dimensions::

        mytable = Table("mytable", metadata,
                Column("data", ARRAY(Integer, dimensions=2))
            )

    This has the effect of the :class:`.ARRAY` type
    specifying that number of bracketed blocks when a :class:`.Table`
    is used in a CREATE TABLE statement, or when the type is used
    within a :func:`.expression.cast` construct; it also causes
    the bind parameter and result set processing of the type
    to optimize itself to expect exactly that number of dimensions.
    Note that Postgresql itself still allows N dimensions with such a type.

    SQL expressions of type :class:`.ARRAY` have support for "index" and
    "slice" behavior.  The Python ``[]`` operator works normally here, given
    integer indexes or slices.  Note that Postgresql arrays default
    to 1-based indexing.  The operator produces binary expression
    constructs which will produce the appropriate SQL, both for
    SELECT statements::

        select([mytable.c.data[5], mytable.c.data[2:7]])

    as well as UPDATE statements when the :meth:`.Update.values` method
    is used::

        mytable.update().values({
            mytable.c.data[5]: 7,
            mytable.c.data[2:7]: [1, 2, 3]
        })

    :class:`.ARRAY` provides special methods for containment operations,
    e.g.::

        mytable.c.data.contains([1, 2])

    For a full list of special methods see :class:`.ARRAY.Comparator`.

    .. versionadded:: 0.8 Added support for index and slice operations
       to the :class:`.ARRAY` type, including support for UPDATE
       statements, and special array containment operations.

    The :class:`.ARRAY` type may not be supported on all DBAPIs.
    It is known to work on psycopg2 and not pg8000.

    See also:

    :class:`.postgresql.array` - produce a literal array value.

    R   t
   Comparatorc           B   sY   e  Z d  Z d   Z e j d  Z e j d  Z d   Z d   Z	 d   Z
 d   Z RS(   s1   Define comparison operations for :class:`.ARRAY`.c         C   s   |  j  j j r d n d } t | t  rq | rV t | j | | j | | j  } n  t | |   } |  j } n | | 7} |  j j	 } |  j
 |  j  t j | d | S(   Ni   i    t   result_type(   R   R   t   zero_indexest
   isinstanceR   R   R   t   stepR   t	   item_typet   _binary_operateR	   R   (   R   t   indext   shift_indexest   return_type(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   __getitem__  s    


c         C   s   t  | |  j d | S(   s  Return ``other operator ANY (array)`` clause.

            Argument places are switched, because ANY requires array
            expression to be on the right hand-side.

            E.g.::

                from sqlalchemy.sql import operators

                conn.execute(
                    select([table.c.data]).where(
                            table.c.data.any(7, operator=operators.lt)
                        )
                )

            :param other: expression to be compared
            :param operator: an operator object from the
             :mod:`sqlalchemy.sql.operators`
             package, defaults to :func:`.operators.eq`.

            .. seealso::

                :class:`.postgresql.Any`

                :meth:`.postgresql.ARRAY.Comparator.all`

            R   (   R   R   (   R   t   otherR   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR   &  s    c         C   s   t  | |  j d | S(   s  Return ``other operator ALL (array)`` clause.

            Argument places are switched, because ALL requires array
            expression to be on the right hand-side.

            E.g.::

                from sqlalchemy.sql import operators

                conn.execute(
                    select([table.c.data]).where(
                            table.c.data.all(7, operator=operators.lt)
                        )
                )

            :param other: expression to be compared
            :param operator: an operator object from the
             :mod:`sqlalchemy.sql.operators`
             package, defaults to :func:`.operators.eq`.

            .. seealso::

                :class:`.postgresql.All`

                :meth:`.postgresql.ARRAY.Comparator.any`

            R   (   R   R   (   R   R   R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR   D  s    c         K   s   |  j  j d  |  S(   s   Boolean expression.  Test if elements are a superset of the
            elements of the argument array expression.
            s   @>(   R   t   op(   R   R   t   kwargs(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   containsb  s    c         C   s   |  j  j d  |  S(   s   Boolean expression.  Test if elements are a proper subset of the
            elements of the argument array expression.
            s   <@(   R   R   (   R   R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   contained_byh  s    c         C   s   |  j  j d  |  S(   su   Boolean expression.  Test if array has elements in common with
            an argument array expression.
            s   &&(   R   R   (   R   R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   overlapn  s    c         C   sJ   t  | t j  r1 | j d k r1 | t j f Sn  t j j j |  | |  S(   Ns   @>s   <@s   &&(   s   @>s   <@s   &&(	   R   R	   t	   custom_opt   opstringR   R   t   ConcatenableR   t   _adapt_expression(   R   R   t   other_comparator(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR   t  s
    (   R}   R~   R   R   R	   R   R   R   R   R   R   R   (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s   				c         C   sa   t  | t  r t d   n  t  | t  r9 |   } n  | |  _ | |  _ | |  _ | |  _ d S(   sO  Construct an ARRAY.

        E.g.::

          Column('myarray', ARRAY(Integer))

        Arguments are:

        :param item_type: The data type of items of this array. Note that
          dimensionality is irrelevant here, so multi-dimensional arrays like
          ``INTEGER[][]``, are constructed as ``ARRAY(Integer)``, not as
          ``ARRAY(ARRAY(Integer))`` or such.

        :param as_tuple=False: Specify whether return results
          should be converted to tuples from lists. DBAPIs such
          as psycopg2 return lists by default. When tuples are
          returned, the results are hashable.

        :param dimensions: if non-None, the ARRAY will assume a fixed
         number of dimensions.  This will cause the DDL emitted for this
         ARRAY to include the exact number of bracket clauses ``[]``,
         and will also optimize the performance of the type overall.
         Note that PG arrays are always implicitly "non-dimensioned",
         meaning they can store any number of dimensions no matter how
         they were declared.

        :param zero_indexes=False: when True, index values will be converted
         between Python zero-based and Postgresql one-based indexes, e.g.
         a value of one will be added to all index values before passing
         to the database.

         .. versionadded:: 0.9.5

        sU   Do not nest ARRAY types; ARRAY(basetype) handles multi-dimensional arrays of basetypeN(   R   R   t
   ValueErrorR   R   t   as_tuplet
   dimensionsR   (   R   R   R   R   R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR   }  s    $			c         C   s   t  S(   N(   t   list(   R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   python_type  s    c         C   s
   | | k S(   N(    (   R   t   xt   y(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   compare_values  s    c            s     d  k r t |  } n    d k sT   d  k r | sT t | d t t f  r  rt   f d   | D  S |  Sn#       f d   | D  Sd  S(   Ni   i    c         3   s   |  ] }   |  Vq d  S(   N(    (   t   .0R   (   t   itemproc(    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pys	   <genexpr>  s    c         3   s=   |  ]3 }  j  |    d k	 r+   d  n d   Vq d S(   i   N(   t   _proc_arrayR   (   R   R   (   t   dimR   t
   collectionR   (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pys	   <genexpr>  s   (   R   R   R   t   tuple(   R   t   arrR   R   R   (    (   R   R   R   R   si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s    !c            s1     j  j |  j |      f d   } | S(   Nc            s-   |  d  k r |  S j |     j t  Sd  S(   N(   R   R   R   R   (   R   (   t	   item_procR   (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s    (   R   t   dialect_implR   (   R   R   R   (    (   R   R   si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s
    				c            s4     j  j |  j | |      f d   } | S(   Nc            s<   |  d  k r |  S  j |     j   j r1 t n t  Sd  S(   N(   R   R   R   R   R   R   (   R   (   R   R   (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s    (   R   R   R   (   R   R   R   R   (    (   R   R   si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s
    			N(   R}   R~   R   R   R   R   R   t   comparator_factoryR   R   R   R   R   R   R   R   R   (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s   Ik-			t   ENUMc           B   sY   e  Z d  Z d   Z d e d  Z d e d  Z d   Z d   Z	 d   Z
 d   Z RS(	   s"  Postgresql ENUM type.

    This is a subclass of :class:`.types.Enum` which includes
    support for PG's ``CREATE TYPE``.

    :class:`~.postgresql.ENUM` is used automatically when
    using the :class:`.types.Enum` type on PG assuming
    the ``native_enum`` is left as ``True``.   However, the
    :class:`~.postgresql.ENUM` class can also be instantiated
    directly in order to access some additional Postgresql-specific
    options, namely finer control over whether or not
    ``CREATE TYPE`` should be emitted.

    Note that both :class:`.types.Enum` as well as
    :class:`~.postgresql.ENUM` feature create/drop
    methods; the base :class:`.types.Enum` type ultimately
    delegates to the :meth:`~.postgresql.ENUM.create` and
    :meth:`~.postgresql.ENUM.drop` methods present here.

    c         O   s2   | j  d t  |  _ t t |   j | |   d S(   s&  Construct an :class:`~.postgresql.ENUM`.

        Arguments are the same as that of
        :class:`.types.Enum`, but also including
        the following parameters.

        :param create_type: Defaults to True.
         Indicates that ``CREATE TYPE`` should be
         emitted, after optionally checking for the
         presence of the type, when the parent
         table is being created; and additionally
         that ``DROP TYPE`` is called when the table
         is dropped.    When ``False``, no check
         will be performed and no ``CREATE TYPE``
         or ``DROP TYPE`` is emitted, unless
         :meth:`~.postgresql.ENUM.create`
         or :meth:`~.postgresql.ENUM.drop`
         are called directly.
         Setting to ``False`` is helpful
         when invoking a creation scheme to a SQL file
         without access to the actual database -
         the :meth:`~.postgresql.ENUM.create` and
         :meth:`~.postgresql.ENUM.drop` methods can
         be used to emit SQL to a target bind.

         .. versionadded:: 0.7.4

        t   create_typeN(   t   popR   R   R   R   R   (   R   t   enumsR   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s    c         C   sS   | j  j s d S| s9 | j  j | |  j d |  j rO | j t |    n  d S(   s  Emit ``CREATE TYPE`` for this
        :class:`~.postgresql.ENUM`.

        If the underlying dialect does not support
        Postgresql CREATE TYPE, no action is taken.

        :param bind: a connectable :class:`.Engine`,
         :class:`.Connection`, or similar object to emit
         SQL.
        :param checkfirst: if ``True``, a query against
         the PG catalog will be first performed to see
         if the type does not exist already before
         creating.

        NR   (   R   t   supports_native_enumt   has_typet   nameR   t   executet   CreateEnumType(   R   t   bindt
   checkfirst(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR'   !  s    	c         C   sR   | j  j s d S| s8 | j  j | |  j d |  j rN | j t |    n  d S(   s  Emit ``DROP TYPE`` for this
        :class:`~.postgresql.ENUM`.

        If the underlying dialect does not support
        Postgresql DROP TYPE, no action is taken.

        :param bind: a connectable :class:`.Engine`,
         :class:`.Connection`, or similar object to emit
         SQL.
        :param checkfirst: if ``True``, a query against
         the PG catalog will be first performed to see
         if the type actually exists before dropping.

        NR   (   R   R   R   R   R   R   t   DropEnumType(   R   R   R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   drop9  s
    !c         C   s   |  j  s t Sd | k ry | d } d | j k rB | j d } n t   } | j d <|  j | k } | j |  j  | St Sd S(   s  Look in the 'ddl runner' for 'memos', then
        note our name in that collection.

        This to ensure a particular named enum is operated
        upon only once within any kind of create/drop
        sequence without relying upon "checkfirst".

        t   _ddl_runnert	   _pg_enumsN(   R   R   t   memot   setR   t   addR   (   R   R   R   t
   ddl_runnert   pg_enumst   present(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   _check_for_name_in_memosO  s    		
c         K   s/   |  j  | |  s+ |  j d | d |  n  d  S(   NR   R   (   R  R'   (   R   t   targetR   R   R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   _on_table_createf  s    c         K   s/   |  j  | |  s+ |  j d | d |  n  d  S(   NR   R   (   R  R'   (   R   R  R   R   R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   _on_metadata_createj  s    c         K   s/   |  j  | |  s+ |  j d | d |  n  d  S(   NR   R   (   R  R   (   R   R  R   R   R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   _on_metadata_dropn  s    N(   R}   R~   R   R   R   R   R'   R   R  R  R  R  (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s   	 			t   integert   bigintt   smallints   character varyingt	   characters   "char"R   t   textt   numerict   floatt   realt   inett   cidrt   uuidt   bits   bit varyingt   macaddrt   oids   double precisiont	   timestamps   timestamp with time zones   timestamp without time zones   time with time zones   time without time zonet   datet   timet   byteat   booleanR   s   interval year to months   interval day to secondt   tsvectort
   PGCompilerc           B   s   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z RS(   c         K   s   d |  j  | |  S(   Ns	   ARRAY[%s](   t   visit_clauselist(   R   t   elementR   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_array  s    c         K   s,   d |  j  | j |  |  j  | j |  f S(   Ns   %s:%s(   R   R   R   (   R   R  R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_slice  s    c         K   s9   d |  j  | j |  t j | j |  j  | j |  f S(   Ns   %s%sANY (%s)(   R   Rr   R   t	   OPERATORSR   Ry   (   R   R  R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt	   visit_any  s    c         K   s9   d |  j  | j |  t j | j |  j  | j |  f S(   Ns   %s%sALL (%s)(   R   Rr   R   R  R   Ry   (   R   R  R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt	   visit_all  s    c         K   s,   d |  j  | j |  |  j  | j |  f S(   Ns   %s[%s](   R   Rr   Ry   (   R   Rh   R   R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_getitem_binary  s    c         K   s   d | j  k rc |  j | j  d t j  } | rc d |  j | j |  | |  j | j |  f Sn  d |  j | j |  |  j | j |  f S(   Nt   postgresql_regconfigs   %s @@ to_tsquery(%s, %s)s   %s @@ to_tsquery(%s)(   t	   modifierst   render_literal_valueR   t
   STRINGTYPER   Rr   Ry   (   R   Rh   R   R   t	   regconfig(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_match_op_binary  s    
c         K   sd   | j  j d d   } d |  j | j |  |  j | j |  f | r_ d |  j | t j  n d S(   Nt   escapes   %s ILIKE %ss    ESCAPE t    (	   R$  t   getR   R   Rr   Ry   R%  R   R&  (   R   Rh   R   R   R)  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_ilike_op_binary  s
    c         K   sd   | j  j d d   } d |  j | j |  |  j | j |  f | r_ d |  j | t j  n d S(   NR)  s   %s NOT ILIKE %ss    ESCAPE R*  (	   R$  R+  R   R   Rr   Ry   R%  R   R&  (   R   Rh   R   R   R)  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_notilike_op_binary  s
    c         C   s@   t  t |   j | |  } |  j j r< | j d d  } n  | S(   Ns   \s   \\(   R   R  R%  R   t   _backslash_escapest   replace(   R   R   t   type_(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR%    s    c         C   s   d |  j  j |  S(   Ns   nextval('%s')(   t   preparert   format_sequence(   R   t   seq(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_sequence  s    c         C   s   d } | j  d  k	 r; | d |  j t j | j    7} n  | j d  k	 r | j  d  k rf | d 7} n  | d |  j t j | j   7} n  | S(   NR*  s	    
 LIMIT s    
 LIMIT ALLs    OFFSET (   t   _limitR   R   R   t   literalt   _offset(   R   RT   R
  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   limit_clause  s    &&c         C   s0   | j    d k r( t j d |   n  d | S(   Nt   ONLYs   Unrecognized hint: %rs   ONLY (   t   upperR   t   CompileError(   R   t   sqltextRX   t   hintt   iscrud(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   format_from_hint_text  s    c         C   s   | j  t k	 r | j  t k r" d St | j  t t f  rn d d j g  | j  D] } |  j |  ^ qM  d Sd |  j | j   d Sn d Sd  S(   Ns	   DISTINCT s   DISTINCT ON (s   , s   ) R*  (   t	   _distinctR   R   R   R   R   Rq   R   (   R   RT   t   col(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   get_select_precolumns  s    4c            s   | j  j r d } n d } | j  j rp t j d   | j  j D  } | d d j   f d   | D  7} n  | j  j r | d 7} n  | S(   Ns
    FOR SHAREs    FOR UPDATEc         s   s0   |  ]& } t  | t j  r$ | j n | Vq d  S(   N(   R   R   t   ColumnClauseRX   (   R   t   c(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pys	   <genexpr>  s   s    OF s   , c         3   s$   |  ] }   j  | d  t Vq d S(   t   ashintN(   R   R   (   R   RX   (   R   (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pys	   <genexpr>  s   s    NOWAIT(   t   _for_update_argt   readRH   R   t
   OrderedSetRq   t   nowait(   R   RT   t   tmpt   tables(    (   R   si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   for_update_clause  s    	c         C   sH   g  t  j |  D]! } |  j d  | t t i   ^ q } d d j |  S(   Ns
   RETURNING s   , (   R   t   _select_iterablest   _label_select_columnR   R   R   Rq   (   R   t   stmtt   returning_colsRD  t   columns(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   returning_clause  s    4c         K   s   |  j  | j j d |  } |  j  | j j d |  } t | j j  d k r} |  j  | j j d |  } d | | | f Sd | | f Sd  S(   Ni    i   i   s   SUBSTRING(%s FROM %s FOR %s)s   SUBSTRING(%s FROM %s)(   R   R   t   len(   R   t   funcR   t   sR   R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_substring_func%  s    (   R}   R~   R  R  R   R!  R"  R(  R,  R-  R%  R4  R8  R?  RB  RL  RR  RV  (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR    s    											
					t   PGDDLCompilerc           B   s5   e  Z d    Z d   Z d   Z d   Z d   Z RS(   c      
   K   sB  |  j  j |  } | j j |  j  } | j r | | j j k r |  j j sa t	 | t
 j  r | j d  k s t	 | j t j  r | j j r t	 | t
 j  r | d 7} q(t	 | t
 j  r | d 7} q(| d 7} nL | d |  j j j | j  7} |  j |  } | d  k	 r(| d | 7} n  | j s>| d 7} n  | S(   Ns
    BIGSERIALs    SMALLSERIALs    SERIALt    s	    DEFAULT s	    NOT NULL(   R1  t   format_columnR   R   R   t   primary_keyRX   t   _autoincrement_columnt   supports_smallserialR   R   t   SmallIntegerR   R   R   t   Sequencet   optionalt
   BigIntegert   type_compilerR   t   get_column_default_stringt   nullable(   R   R%   R   t   colspect	   impl_typeR   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   get_column_specification1  s*    	 	c            s?   | j  } d   j j |  d j   f d   | j D  f S(   Ns   CREATE TYPE %s AS ENUM (%s)s   , c         3   s0   |  ]& }   j  j t j |  d  t Vq d S(   t   literal_bindsN(   t   sql_compilerR   R   R6  R   (   R   t   e(   R   (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pys	   <genexpr>V  s   (   R  R1  t   format_typeRq   R   (   R   R'   R0  (    (   R   si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_create_enum_typeP  s    	c         C   s   | j  } d |  j j |  S(   Ns   DROP TYPE %s(   R  R1  Rj  (   R   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_drop_enum_typeZ  s    	c         C   s  |  j  } | j } |  j |  d } | j r; | d 7} n  | d |  j | d t | j | j  f 7} | j d d } | r | d | j	 |  7} n  | j d d } | d	 d
 j
 g  t | j | j  D]l \ } } |  j j t | t j  s| j   n | d t d t | j | k r3d | | j p6d ^ q  7} | j d d }	 |	 d  k	 r|  j j |	 d t d t }
 | d |
 7} n  | S(   Ns   CREATE s   UNIQUE s   INDEX %s ON %s t   include_schemat
   postgresqlR`   s	   USING %s t   opss   (%s)s   , t   include_tableRg  RX  R*  Rc   s    WHERE (   R1  R  t   _verify_index_tableR^   t   _prepared_index_nameR   t   format_tableRX   t   dialect_optionst   quoteRq   t   zipt   expressionsRQ  Rh  R   R   R   RC  R   R   t   keyR   (   R   R'   R1  R   R
  R`   Ro  R   RD  t   whereclauset   where_compiled(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_create_indexa  s2    					c         C   s   d } | j  d  k	 r2 | d |  j j |  7} n  g  } xE | j D]: } | j | j  } | j |  j j | j   d |  qB W| d | j d j	 |  f 7} | j
 d  k	 r | d |  j j | j
 d t 7} n  | |  j |  7} | S(   NR*  s   CONSTRAINT %s s    WITH s   EXCLUDE USING %s (%s)s   , s    WHERE (%s)Rg  (   R   R   R1  t   format_constraintRQ  R	   t   appendRu  R`   Rq   Rc   Rh  R   R   t   define_constraint_deferrability(   R   R&   R
  t   elementsRD  R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_exclude_constraint  s     (	(   R}   R~   Rf  Rk  Rl  R{  R  (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyRW  /  s
   		
		't   PGTypeCompilerc           B   s  e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   c         C   s   d S(   NR   (    (   R   R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_TSVECTOR  s    c         C   s   d S(   NR   (    (   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt
   visit_INET  s    c         C   s   d S(   NR   (    (   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt
   visit_CIDR  s    c         C   s   d S(   NR   (    (   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_MACADDR  s    c         C   s   d S(   NR   (    (   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt	   visit_OID  s    c         C   s#   | j  s d Sd i | j  d 6Sd  S(   NR   s   FLOAT(%(precision)s)R   (   R   (   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_FLOAT  s    	c         C   s   d S(   Ns   DOUBLE PRECISION(    (   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_DOUBLE_PRECISION  s    c         C   s   d S(   NR   (    (   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_BIGINT  s    c         C   s   d S(   Nt   HSTORE(    (   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_HSTORE  s    c         C   s   d S(   Nt   JSON(    (   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt
   visit_JSON  s    c         C   s   d S(   Nt   JSONB(    (   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_JSONB  s    c         C   s   d S(   Nt	   INT4RANGE(    (   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_INT4RANGE  s    c         C   s   d S(   Nt	   INT8RANGE(    (   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_INT8RANGE  s    c         C   s   d S(   Nt   NUMRANGE(    (   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_NUMRANGE  s    c         C   s   d S(   Nt	   DATERANGE(    (   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_DATERANGE  s    c         C   s   d S(   Nt   TSRANGE(    (   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_TSRANGE  s    c         C   s   d S(   Nt	   TSTZRANGE(    (   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_TSTZRANGE  s    c         C   s   |  j  |  S(   N(   t   visit_TIMESTAMP(   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_datetime  s    c         C   s>   | j  s |  j j r- t t |   j |  S|  j |  Sd  S(   N(   t   native_enumR   R   R   R  t
   visit_enumt
   visit_ENUM(   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR    s    c         C   s   |  j  j j |  S(   N(   R   t   identifier_preparerRj  (   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR    s    c         C   s@   d t  | d d   r" d | j p% d | j r4 d p7 d d f S(   Ns   TIMESTAMP%s %sR   s   (%d)R*  t   WITHt   WITHOUTs
    TIME ZONE(   t   getattrR   R   R   (   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR    s    c         C   s@   d t  | d d   r" d | j p% d | j r4 d p7 d d f S(   Ns	   TIME%s %sR   s   (%d)R*  R  R  s
    TIME ZONE(   R  R   R   R   (   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt
   visit_TIME  s    c         C   s"   | j  d  k	 r d | j  Sd Sd  S(   Ns   INTERVAL(%d)R   (   R   R   (   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_INTERVAL  s    c         C   sF   | j  r5 d } | j d  k	 rB | d | j 7} qB n d | j } | S(   Ns   BIT VARYINGs   (%d)s   BIT(%d)(   R   R   R   (   R   R0  t   compiled(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt	   visit_BIT  s    	c         C   s   d S(   NR   (    (   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt
   visit_UUID  s    c         C   s   |  j  |  S(   N(   t   visit_BYTEA(   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_large_binary  s    c         C   s   d S(   NR|   (    (   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR    s    c         C   s0   |  j  | j  d | j d  k	 r* | j n d S(   Ns   []i   (   R   R   R   R   (   R   R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   visit_ARRAY  s    (   R}   R~   R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR    s8   																												t   PGIdentifierPreparerc           B   s#   e  Z e Z d    Z e d  Z RS(   c         C   s9   | d |  j  k r5 | d d !j |  j |  j  } n  | S(   Ni    i   i(   t   initial_quoteR/  t   escape_to_quotet   escape_quote(   R   R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   _unquote_identifier  s    c         C   sm   | j  s t j d   n  |  j | j   } |  j ri | ri | j d  k	 ri |  j | j  d | } n  | S(   Ns%   Postgresql ENUM type requires a name.t   .(   R   R   R;  Ru  t   omit_schemaR   R   t   quote_schema(   R   R0  t
   use_schemaR   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyRj    s    	(   R}   R~   t   RESERVED_WORDSt   reserved_wordsR  R   Rj  (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR    s   	t   PGInspectorc           B   s   e  Z d    Z d d  Z RS(   c         C   s   t  j j |  |  d  S(   N(   R   t	   InspectorR   (   R   t   conn(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR   !  s    c         C   s"   |  j  j |  j | | d |  j S(   s.   Return the oid from `table_name` and `schema`.t
   info_cache(   R   t   get_table_oidR   R  (   R   t
   table_nameR   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR  $  s    N(   R}   R~   R   R   R  (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR    s   	R   c           B   s   e  Z d  Z RS(   t   create_enum_type(   R}   R~   R   (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR   +  s   R   c           B   s   e  Z d  Z RS(   t   drop_enum_type(   R}   R~   R   (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR   /  s   t   PGExecutionContextc           B   s   e  Z d    Z d   Z RS(   c         C   s#   |  j  d |  j j j |  |  S(   Ns   select nextval('%s')(   t   _execute_scalarR   R  R2  (   R   R3  R0  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   fire_sequence5  s    c         C   ss  | j  r]| | j j k r]| j rM | j j rM |  j d | j j | j  S| j d  k st | j j
 r]| j j r]y | j } Wn t k
 r| j j } | j } | d d t d d t |   !} | d d t d d t |   !} d | | f } | | _ } n X| j j } | d  k	 r:d | | f } n d | f } |  j | | j  Sn  t t |   j |  S(   Ns	   select %si    i   s	   %s_%s_seqs   select nextval('"%s"."%s"')s   select nextval('"%s"')(   RZ  RX   R[  t   server_defaultt   has_argumentR  t   argR   R   R   t   is_sequenceR_  t   _postgresql_seq_namet   AttributeErrorR   t   maxRS  R   R   R  t   get_insert_default(   R   R%   t   seq_namet   tabRA  R   t   schR   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR  :  s4    		

	$$
(   R}   R~   R  R  (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR  3  s   	t	   PGDialectc           B   s  e  Z d  Z e Z d Z e Z e Z e Z e Z	 e Z
 e Z e Z e Z e Z e Z e Z d Z e Z e Z e Z e Z e Z e Z e Z e Z  d* Z" e# j$ i e d 6d* d 6i  d 6f e# j% i e d 6f g Z& d+ Z' e Z( d* d* d* d  Z) d	   Z* d
   Z+ e, d d d d g  Z- d   Z. d   Z/ d   Z0 d   Z1 e e d  Z2 e e d  Z3 d   Z4 d   Z5 d   Z6 d* d  Z7 d* d  Z8 d* d  Z9 d   Z: e; j< d* d   Z= e; j< d    Z> e; j< d* d   Z? e; j< d* d   Z@ e; j< d* d    ZA e; j< d* d!   ZB d"   ZC e; j< d* d#   ZD e; j< d* e d$   ZE d%   ZF e; j< d&    ZG e; j< d* d'   ZH d(   ZI d)   ZJ RS(,   Rn  i?   t   pyformatR`   Rc   Ro  t   ignore_search_patht   postgresql_ignore_search_pathc         K   s2   t  j j |  |  | |  _ | |  _ | |  _ d  S(   N(   R   t   DefaultDialectR   t   isolation_levelt   _json_deserializert   _json_serializer(   R   R  t   json_serializert   json_deserializerR   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR     s    		c         C   s   t  t |   j |  |  j d k o7 |  j j d t  |  _ |  j d	 k |  _ |  j s |  j	 j
   |  _	 |  j	 j t j d   |  j	 j t d   n  |  j d
 k |  _ |  j d k  p | j d  d k |  _ d  S(   Ni   i   t   implicit_returningi   i	   s    show standard_conforming_stringsRI   (   i   i   (   i   i   (   i	   i   (   i   i   (   R   R  t
   initializet   server_version_infot   __dict__R+  R   R  R   t   colspecst   copyR   R   t   EnumR   R   R\  t   scalarR.  (   R   t
   connection(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR    s    	c            s*     j  d  k	 r"   f d   } | Sd  Sd  S(   Nc            s     j  |    j  d  S(   N(   t   set_isolation_levelR  (   R  (   R   (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   connect  s    (   R  R   (   R   R  (    (   R   si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt
   on_connect  s    t   SERIALIZABLEs   READ UNCOMMITTEDs   READ COMMITTEDs   REPEATABLE READc         C   s   | j  d d  } | |  j k rO t j d | |  j d j |  j  f   n  | j   } | j d |  | j d  | j   d  S(   Nt   _RX  sL   Invalid value '%s' for isolation_level. Valid isolation levels for %s are %ss   , s=   SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL %st   COMMIT(	   R/  t   _isolation_lookupR   t   ArgumentErrorR   Rq   t   cursorR   t   close(   R   R  t   levelR  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR    s    %c         C   s=   | j    } | j d  | j   d } | j   | j   S(   Ns    show transaction isolation leveli    (   R  R   t   fetchoneR  R:  (   R   R  R  t   val(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   get_isolation_level  s
    
c         C   s   |  j  | j  d  S(   N(   t   do_beginR  (   R   R  t   xid(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   do_begin_twophase  s    c         C   s   | j  d |  d  S(   Ns   PREPARE TRANSACTION '%s'(   R   (   R   R  R  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   do_prepare_twophase  s    c         C   sa   | rM | r | j  d  n  | j  d |  | j  d  |  j | j  n |  j | j  d  S(   Nt   ROLLBACKs   ROLLBACK PREPARED '%s't   BEGIN(   R   t   do_rollbackR  (   R   R  R  t   is_preparedt   recover(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   do_rollback_twophase  s    c         C   sa   | rM | r | j  d  n  | j  d |  | j  d  |  j | j  n |  j | j  d  S(   NR  s   COMMIT PREPARED '%s'R  (   R   R  R  t	   do_commit(   R   R  R  R  R  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   do_commit_twophase  s    c         C   s3   | j  t j d   } g  | D] } | d ^ q S(   Ns!   SELECT gid FROM pg_prepared_xactsi    (   R   R   R
  (   R   R  t	   resultsett   row(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   do_recover_twophase  s    c         C   s   | j  d  S(   Ns   select current_schema()(   R  (   R   R  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   _get_default_schema_name  s    c      	   C   s[   d } | j  t j | d t j d t j | j    d t j g  } t	 | j
    S(   Ns=   select nspname from pg_namespace where lower(nspname)=:schemat
   bindparamsR   R0  (   R   R   R
  t	   bindparamR   R   t   lowerR   t   Unicodet   boolt   first(   R   R  R   t   queryR  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt
   has_schema  s    c      
   C   s   | d  k rN | j t j d d t j d t j |  d t j g  } n` | j t j d d t j d t j |  d t j t j d t j |  d t j g  } t	 | j
    S(   Ns}   select relname from pg_class c join pg_namespace n on n.oid=c.relnamespace where n.nspname=current_schema() and relname=:nameR  R   R0  st   select relname from pg_class c join pg_namespace n on n.oid=c.relnamespace where n.nspname=:schema and relname=:nameR   (   R   R   R   R
  R   R   R   R   R  R  R  (   R   R  R  R   R  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt	   has_table  s     			c      
   C   s   | d  k rN | j t j d d t j d t j |  d t j g  } n` | j t j d d t j d t j |  d t j t j d t j |  d t j g  } t	 | j
    S(   Ns   SELECT relname FROM pg_class c join pg_namespace n on n.oid=c.relnamespace where relkind='S' and n.nspname=current_schema() and relname=:nameR  R   R0  s   SELECT relname FROM pg_class c join pg_namespace n on n.oid=c.relnamespace where relkind='S' and n.nspname=:schema and relname=:nameR   (   R   R   R   R
  R   R   R   R   R  R  R  (   R   R  t   sequence_nameR   R  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   has_sequence!  s    		c         C   s   | d  k	 r$ d } t j |  } n d } t j |  } | j t j d t j |  d t j  } | d  k	 r | j t j d t j |  d t j  } n  | j	 |  } t
 | j    S(   Ns  
            SELECT EXISTS (
                SELECT * FROM pg_catalog.pg_type t, pg_catalog.pg_namespace n
                WHERE t.typnamespace = n.oid
                AND t.typname = :typname
                AND n.nspname = :nspname
                )
                s   
            SELECT EXISTS (
                SELECT * FROM pg_catalog.pg_type t
                WHERE t.typname = :typname
                AND pg_type_is_visible(t.oid)
                )
                t   typnameR0  t   nspname(   R   R   R
  R  R   R   R   R   R  R   R  R  (   R   R  t	   type_nameR   R  R  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR   A  s    		!c         C   s~   | j  d  j   } t j d |  } | s@ t d |   n  t g  | j d d d  D] } | d  k	 rY t |  ^ qY  S(   Ns   select version()sJ   .*(?:PostgreSQL|EnterpriseDB) (\d+)\.(\d+)(?:\.(\d+))?(?:\.\d+)?(?:devel)?s,   Could not determine version from string '%s'i   i   i   (	   R   R  t   ret   matcht   AssertionErrorR   R;   R   t   int(   R   R  t   vt   mR   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   _get_server_version_infoa  s    	c   
      K   s   d } | d k	 r d } n d } d | } t j |  } | d k	 rX t j |  } n  t j |  j d t j  } | j d t j	  } | r | j t j
 d d t j  } n  | j | d | d | }	 |	 j   } | d k r t j |   n  | S(	   s   Fetch the oid for schema.table_name.

        Several reflection methods require the table oid.  The idea for using
        this method is that it can be fetched one time and cached for
        subsequent calls.

        s   n.nspname = :schemas%   pg_catalog.pg_table_is_visible(c.oid)s   
            SELECT c.oid
            FROM pg_catalog.pg_class c
            LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
            WHERE (%s)
            AND c.relname = :table_name AND c.relkind in ('r','v')
        R  R  R   R0  N(   R   R   R   R   R
  R  R   R  RQ  t   IntegerR   R   R  R   t   NoSuchTableError(
   R   R  R  R   R   t	   table_oidt   schema_where_clauseR  RU  RD  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR  l  s"    		
$c         K   s   d } | j  |  } t j r] g  | D]/ } | d j d  s% | d j |  j  ^ q% } n0 g  | D]# } | d j d  sd | d ^ qd } | S(   NsS   
        SELECT nspname
        FROM pg_namespace
        ORDER BY nspname
        i    t   pg_(   R   R   t   py2kt
   startswitht   decodet   encoding(   R   R  R   RU  t   rpR  t   schema_names(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   get_schema_names  s    	2#c         K   se   | d  k	 r | } n	 |  j } | j t j d | d i t j d 6 } g  | D] } | d ^ qQ S(   Ns   SELECT relname FROM pg_class c WHERE relkind = 'r' AND '%s' = (select nspname from pg_namespace n where n.oid = c.relnamespace) t   typemapt   relnamei    (   R   t   default_schema_nameR   R   R
  R   R  (   R   R  R   R   Rj   t   resultR  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   get_table_names  s    			c         K   s   | d  k	 r | } n	 |  j } d t d |  } t j ro g  | j |  D] } | d j |  j  ^ qJ } n& g  | j |  D] } | d ^ q } | S(   Ns   
        SELECT relname
        FROM pg_class c
        WHERE relkind = 'v'
          AND '%(schema)s' = (select nspname from pg_namespace n
          where n.oid = c.relnamespace)
        R   i    (   R   R"  t   dictR   R  R   R  R  (   R   R  R   R   Rj   RU  R  t
   view_names(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   get_view_names  s    			2&c   	      K   s   | d  k	 r | } n	 |  j } d } | j t j |  d | d | } | r t j rr | j   j |  j	  } n | j   } | Sd  S(   Nsv   
        SELECT definition FROM pg_views
        WHERE schemaname = :schema
        AND viewname = :view_name
        t	   view_nameR   (
   R   R"  R   R   R
  R   R  R  R  R  (	   R   R  R(  R   R   Rj   RU  R  t   view_def(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   get_view_definition  s    			c      	   K   s  |  j  | | | d | j d  } d } t j | d t j d d t j g d i t j d 6t j d 6} | j | d | } | j	   }	 |  j
 |  }
 |  j |  } g  } xN |	 D]F \ } } } } } } |  j | | | | |
 | |  } | j |  q W| S(	   NR  s6  
            SELECT a.attname,
              pg_catalog.format_type(a.atttypid, a.atttypmod),
              (SELECT pg_catalog.pg_get_expr(d.adbin, d.adrelid)
                FROM pg_catalog.pg_attrdef d
               WHERE d.adrelid = a.attrelid AND d.adnum = a.attnum
               AND a.atthasdef)
              AS DEFAULT,
              a.attnotnull, a.attnum, a.attrelid as table_oid
            FROM pg_catalog.pg_attribute a
            WHERE a.attrelid = :table_oid
            AND a.attnum > 0 AND NOT a.attisdropped
            ORDER BY a.attnum
        R  R  R0  R   t   attnameR   (   R  R+  R   R
  R   R   R  R  R   t   fetchallt   _load_domainst   _load_enumst   _get_column_infoR}  (   R   R  R  R   R   R  t   SQL_COLSRU  RD  t   rowst   domainsR   RQ  R   Rj  R   Ru   t   attnumt   column_info(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   get_columns  s$    
c         C   s  t  j d d |  } t  j d d |  } | }	 | j d  }
 t  j d |  } | rj | j d  } n  t  j d |  } | r | j d  r t t  j d | j d    } n d( } i  } | d	 k r| r| j d
  \ } } t |  t |  f } q#d) } n| d k r!d* } n| d k r6d+ } n | d, k rnt | d <| ret |  | d <n  d- } n | d. k rt	 | d <| rt |  | d <n  d/ } n} | d k rt | d <| rt |  f } q#d0 } nF | d1 k r| rt |  | d <n  d2 } n | r#t |  f } n  x t r
| |  j
 k rL|  j
 | } Pq&| | k r| | } t } d | k r| j d  \ | d <| d <n
 | | d <t | d  } Pq&| | k r | | } | d } | d }	 | d  r&| r&| d  } q&q&q&d  } Pq&W| r8| | |   } |
 rXt |  } qXn  t j d! | | f  t j } t	 } | d  k	 rt  j d" |  } | d  k	 rt } | } d | j d#  k r| d  k	 r| j d  d$ | d | j d#  | j d%  } qqn  t d | d& | d |	 d  | d' |  } | S(3   Ns   \(.*\)R*  s   \[\]s   []s   \(([\d,]+)\)i   s   \((.*)\)s   \s*,\s*R  t   ,s   double precisioni5   R  s   timestamp with time zones   time with time zoneR   R   s   timestamp without time zones   time without time zoneR  s   bit varyingR   R   s   interval year to months   interval day to secondR  R   R   t   labelst   attypeRc  R   s*   Did not recognize type '%s' of column '%s's   (nextval\(')([^']+)('.*$)i   s   "%s"i   R   t   autoincrement(    (    (   i5   (    (   s   timestamp with time zones   time with time zone(    (   s   timestamp without time zones   time without time zones   time(    (    (   s   intervals   interval year to months   interval day to second(    (   R  t   subt   endswitht   searchR;   R   t   splitR  R   R   t   ischema_namesR   R   R   R   t   warnR   R   R%  (   R   R   Rj  R   Ru   R2  R   R   R8  Rc  t   is_arrayt   charlent   argsR   t   prect   scaleR   t   enumt   domainR9  R  R  R4  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR/    s    $				
		
	
				
 



		!>c         K   s  |  j  | | | d | j d  } |  j d k  rL d |  j d d  } n d } t j | d i t j d	 6} | j | d
 | } g  | j	   D] }	 |	 d ^ q }
 d } t j | d i t j d 6} | j | d
 | } | j
   } i |
 d 6| d 6S(   NR  i   i   sq  
                SELECT a.attname
                FROM
                    pg_class t
                    join pg_index ix on t.oid = ix.indrelid
                    join pg_attribute a
                        on t.oid=a.attrelid AND %s
                 WHERE
                  t.oid = :table_oid and ix.indisprimary = 't'
                ORDER BY a.attnum
            s   a.attnums	   ix.indkeys  
                SELECT a.attname
                FROM pg_attribute a JOIN (
                    SELECT unnest(ix.indkey) attnum,
                           generate_subscripts(ix.indkey, 1) ord
                    FROM pg_index ix
                    WHERE ix.indrelid = :table_oid AND ix.indisprimary
                    ) k ON a.attnum=k.attnum
                WHERE a.attrelid = :table_oid
                ORDER BY k.ord
            R   R+  R  i    s   
        SELECT conname
           FROM  pg_catalog.pg_constraint r
           WHERE r.conrelid = :table_oid AND r.contype = 'p'
           ORDER BY 1
        t   connamet   constrained_columnsR   (   i   i   (   R  R+  R  t   _pg_index_anyR   R
  R   R  R   R,  R  (   R   R  R  R   R   R  t   PK_SQLt   tRD  t   rt   colst   PK_CONS_SQLR   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   get_pk_constraintt  s    #c         K   sA  |  j  } |  j | | | d | j d  } d } t j d  }	 t j | d i t j d 6t j d 6}
 | j	 |
 d | } g  } x| j
   D]\ } } } t j |	 |  j   } | \ } } } } } } } } } } } } } | d  k	 r| d k rt n t } n  g  t j d	 |  D] } | j |  ^ q!} | rc| |  j k rZ| } q| } n9 | r{| j |  } n! | d  k	 r| | k r| } n  | j |  } g  t j d
 |  D] } | j |  ^ q} i | d 6| d 6| d 6| d 6| d 6i | d 6| d 6| d 6| d 6| d 6d 6} | j |  q W| S(   NR  s  
          SELECT r.conname,
                pg_catalog.pg_get_constraintdef(r.oid, true) as condef,
                n.nspname as conschema
          FROM  pg_catalog.pg_constraint r,
                pg_namespace n,
                pg_class c

          WHERE r.conrelid = :table AND
                r.contype = 'f' AND
                c.oid = confrelid AND
                n.oid = c.relnamespace
          ORDER BY 1
        s/  FOREIGN KEY \((.*?)\) REFERENCES (?:(.*?)\.)?(.*?)\((.*?)\)[\s]?(MATCH (FULL|PARTIAL|SIMPLE)+)?[\s]?(ON UPDATE (CASCADE|RESTRICT|NO ACTION|SET NULL|SET DEFAULT)+)?[\s]?(ON DELETE (CASCADE|RESTRICT|NO ACTION|SET NULL|SET DEFAULT)+)?[\s]?(DEFERRABLE|NOT DEFERRABLE)?[\s]?(INITIALLY (DEFERRED|IMMEDIATE)+)?R   RG  t   condefRX   t
   DEFERRABLEs   \s*,\s*s   \s*,\sR   RH  t   referred_schemat   referred_tablet   referred_columnst   onupdatet   ondeleteR.   R>   R  t   options(   R  R  R+  R  t   compileR   R
  R   R  R   R,  R<  t   groupsR   R   R   R=  R  R"  R}  (   R   R  R  R   R  R   R1  R  t   FK_SQLt   FK_REGEXRK  RD  t   fkeysRG  RP  t	   conschemaR  RH  RR  RS  RT  R  R  RU  RV  R.   R>   R   t   fkey_d(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   get_foreign_keys  sX    		

-%			+c            sN   |  j  d	 k  r< d d j    f d   t d d  D  Sd    f Sd  S(
   Ni   i   s   (%s)s    OR c         3   s"   |  ] } d   |   f Vq d S(   s   %s[%d] = %sN(    (   R   t   ind(   RA  t
   compare_to(    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pys	   <genexpr>	  s   i    i
   s   %s = ANY(%s)(   i   i   (   R  Rq   t   range(   R   RA  Ra  (    (   Ra  RA  si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyRI    s
    	c         K   s  |  j  | | | d | j d  } d |  j d k r< d n d |  j d d  f } t j | d	 i t j d
 6} | j | d | } t	 d    }	 d  }
 x | j   D] } | \ } } } } } } } | r | |
 k r t j d |  n  | }
 q n  | r+| |
 k r+t j d |  | }
 n  |	 | } | d  k	 rR| | d | <n  g  | j   D] } t | j    ^ q_| d <| | d <q Wg  |	 j   D]J \ } } i | d 6| d d 6g  | d D] } | d | ^ qd 6^ qS(   NR  s  
          SELECT
              i.relname as relname,
              ix.indisunique, ix.indexprs, ix.indpred,
              a.attname, a.attnum, ix.indkey%s
          FROM
              pg_class t
                    join pg_index ix on t.oid = ix.indrelid
                    join pg_class i on i.oid=ix.indexrelid
                    left outer join
                        pg_attribute a
                        on t.oid=a.attrelid and %s
          WHERE
              t.relkind = 'r'
              and t.oid = :table_oid
              and ix.indisprimary = 'f'
          ORDER BY
              t.relname,
              i.relname
        i   i   s	   ::varcharR*  s   a.attnums	   ix.indkeyR   R+  R  c           S   s
   t  t  S(   N(   R    R%  (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   <lambda>4	  s    s;   Skipped unsupported reflection of expression-based index %ss7   Predicate of partial index %s ignored during reflectionRM  Rx  R^   R   t   column_names(   i   i   (   R  R+  R  RI  R   R
  R   R  R   R    R   R,  R   R?  R=  R  t   stript   items(   R   R  R  R   R   R  t   IDX_SQLRK  RD  t   indexest   sv_idx_nameR  t   idx_nameR^   R   t   prdRA  t   col_numt   idx_keyR   t   kR   t   idxt   i(    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   get_indexes	  s<    	
/c         K   s  |  j  | | | d | j d  } d } t j | d i t j d 6} | j | d | } t d    }	 xB | j   D]4 }
 |	 |
 j	 } |
 j
 | d <|
 j | d |
 j <qz Wg  |	 j   D]? \ } } i | d	 6g  | d D] } | d | ^ q d
 6^ q S(   NR  s  
            SELECT
                cons.conname as name,
                cons.conkey as key,
                a.attnum as col_num,
                a.attname as col_name
            FROM
                pg_catalog.pg_constraint cons
                join pg_attribute a
                  on cons.conrelid = a.attrelid AND
                    a.attnum = ANY(cons.conkey)
            WHERE
                cons.conrelid = :table_oid AND
                cons.contype = 'u'
        R   t   col_nameR  c           S   s
   t  t  S(   N(   R    R%  (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyRc  o	  s    Rx  RM  R   Rd  (   R  R+  R   R
  R   R  R   R    R,  R   Rx  Rr  Rl  Rf  (   R   R  R  R   R   R  t
   UNIQUE_SQLRK  RD  t   uniquesR  t   ucR   Rp  (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   get_unique_constraintsV	  s    c         C   s   |  j  s i  Sd } t j | d i t j d 6t j d 6} | j |  } i  } x | j   D]u } | d r{ | d } n d | d | d f } | | k r | | d	 j | d  q^ i | d g d	 6| | <q^ W| S(
   Ns>  
            SELECT t.typname as "name",
               -- no enum defaults in 8.4 at least
               -- t.typdefault as "default",
               pg_catalog.pg_type_is_visible(t.oid) as "visible",
               n.nspname as "schema",
               e.enumlabel as "label"
            FROM pg_catalog.pg_type t
                 LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace
                 LEFT JOIN pg_catalog.pg_enum e ON t.oid = e.enumtypid
            WHERE t.typtype = 'e'
            ORDER BY "name", e.oid -- e.oid gives us label order
        R   R+  t   labelt   visibleR   s   %s.%sR   R7  (   R   R   R
  R   R  R   R,  R}  (   R   R  t	   SQL_ENUMSRU  RD  R   RE  R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR.  {	  s"    	

c   	      C   s   d } t  j | d i t j d 6} | j |  } i  } x | j   D]{ } t j d | d  j d  } | d r | d } n d	 | d
 | d f } i | d 6| d d 6| d d 6| | <qG W| S(   Ns  
            SELECT t.typname as "name",
               pg_catalog.format_type(t.typbasetype, t.typtypmod) as "attype",
               not t.typnotnull as "nullable",
               t.typdefault as "default",
               pg_catalog.pg_type_is_visible(t.oid) as "visible",
               n.nspname as "schema"
            FROM pg_catalog.pg_type t
               LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace
            WHERE t.typtype = 'd'
        R   R+  s   ([^\(]+)R8  i   Rx  R   s   %s.%sR   Rc  R   (	   R   R
  R   R  R   R,  R  R<  R;   (	   R   R  t   SQL_DOMAINSRU  RD  R2  RF  R8  R   (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR-  	  s    
N(   s   postgresql_ignore_search_path(K   R}   R~   R   R   t   supports_altert   max_identifier_lengtht   supports_sane_rowcountR   t   supports_native_booleanR\  t   supports_sequencest   sequences_optionalt"   preexecute_autoincrement_sequencesR   t   postfetch_lastrowidt   supports_default_valuest   supports_empty_insertt   supports_multivalues_insertt   default_paramstyleR>  R  R  t   statement_compilerRW  t   ddl_compilerR  Ra  R  R1  R  t   execution_ctx_clsR  t	   inspectorR   R  R   t   Indext   Tablet   construct_argumentst   reflection_optionsR.  R   R  R  R   R  R  R  R  R  R  R  R  R  R  R  R	  R   R  R   t   cacheR  R  R$  R'  R*  R5  R/  RO  R_  RI  Rq  Rv  R.  R-  (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyR  c  s   	
								
			  	#&	p/Y	H#	,([   R   t   collectionsR    R  R*  R   R   R   R   t   engineR   R   R   R   R	   R
   R   R  R   R   t   ImportErrorR   t   sqlalchemy.typesR   R   R   R   R   R   R   R   R   R   R   R   R  t   _DECIMAL_TYPESt   _FLOAT_TYPESt
   _INT_TYPESt   LargeBinaryR|   t   FloatR   t
   TypeEngineR   t   PGInetR   t   PGCidrR   t	   PGMacAddrR   R   R   R   t
   PGIntervalR   t   PGBitt   PGUuidR   t   ColumnElementR   R   R   t   TupleR   R   R   t   PGArrayR  R   R   R  t   StringR>  t   SQLCompilerR  t   DDLCompilerRW  t   GenericTypeCompilerR  t   IdentifierPreparerR  R  R  t   _CreateDropBaseR   R   t   DefaultExecutionContextR  R  R  (    (    (    si   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.pyt   <module>  s   "
L
23 $



lp0