File: //opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/dml.pyc
�
��4]c @ s� d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d l
m Z d d l m
Z
d d l m Z d Z d
e f d � � YZ e e d
� Z d e f d � � YZ d e f d � � YZ d e f d � � YZ d S( i ( t exti ( t util( t schema( t _generative( t Insert( t
ClauseElement( t alias( t public_factoryR t insertc B sV e Z d Z e j d � � Z e d d d d d d � � Z e d d d d � � Z RS( s� PostgreSQL-specific implementation of INSERT.
Adds methods for PG-specific syntaxes such as ON CONFLICT.
.. versionadded:: 1.1
c C s t | j d d �j S( s� Provide the ``excluded`` namespace for an ON CONFLICT statement
PG's ON CONFLICT clause allows reference to the row that would
be inserted, known as ``excluded``. This attribute provides
all columns in this row to be referenceable.
.. seealso::
:ref:`postgresql_insert_on_conflict` - example of how
to use :attr:`.Insert.excluded`
t namet excluded( R t tablet columns( t self( ( sU /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/dml.pyR
s c C s t | | | | | � | _ | S( s
Specifies a DO UPDATE SET action for ON CONFLICT clause.
Either the ``constraint`` or ``index_elements`` argument is
required, but only one of these can be specified.
:param constraint:
The name of a unique or exclusion constraint on the table,
or the constraint object itself if it has a .name attribute.
:param index_elements:
A sequence consisting of string column names, :class:`.Column`
objects, or other column expression objects that will be used
to infer a target index.
:param index_where:
Additional WHERE criterion that can be used to infer a
conditional target index.
:param set\_:
Required argument. A dictionary or other mapping object
with column names as keys and expressions or literals as values,
specifying the ``SET`` actions to take.
If the target :class:`.Column` specifies a ".key" attribute distinct
from the column name, that key should be used.
.. warning:: This dictionary does **not** take into account
Python-specified default UPDATE values or generation functions,
e.g. those specified using :paramref:`.Column.onupdate`.
These values will not be exercised for an ON CONFLICT style of
UPDATE, unless they are manually specified in the
:paramref:`.Insert.on_conflict_do_update.set_` dictionary.
:param where:
Optional argument. If present, can be a literal SQL
string or an acceptable expression for a ``WHERE`` clause
that restricts the rows affected by ``DO UPDATE SET``. Rows
not meeting the ``WHERE`` condition will not be updated
(effectively a ``DO NOTHING`` for those rows).
.. versionadded:: 1.1
.. seealso::
:ref:`postgresql_insert_on_conflict`
( t OnConflictDoUpdatet _post_values_clause( R
t
constraintt index_elementst index_wheret set_t where( ( sU /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/dml.pyt on_conflict_do_update. s 9c C s t | | | � | _ | S( s"
Specifies a DO NOTHING action for ON CONFLICT clause.
The ``constraint`` and ``index_elements`` arguments
are optional, but only one of these can be specified.
:param constraint:
The name of a unique or exclusion constraint on the table,
or the constraint object itself if it has a .name attribute.
:param index_elements:
A sequence consisting of string column names, :class:`.Column`
objects, or other column expression objects that will be used
to infer a target index.
:param index_where:
Additional WHERE criterion that can be used to infer a
conditional target index.
.. versionadded:: 1.1
.. seealso::
:ref:`postgresql_insert_on_conflict`
( t OnConflictDoNothingR ( R
R R R ( ( sU /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/dml.pyt on_conflict_do_nothingl s N(
t __name__t
__module__t __doc__R t memoized_propertyR
R t NoneR R ( ( ( sU /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/dml.pyR s 7s .dialects.postgresql.insertt OnConflictClausec B s e Z d d d d � Z RS( c C s� | d k r[ t | t j � r[ t | t j t j t j f � r[ t | d � pR | } q[ n | d k r/| d k r� t
d � � n t | t j � r� | | _ d | _ d | _
q/t | t j � r� | j } | j d j d � } q/t | t j � r
| j } | j } q/| j } | j d j d � } n | d k rYd | _ | | _ | | _
n&