
H`Tc           @@  s\  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 d d	 l m Z d d
 l	 m Z m Z d d l m Z m Z m Z m Z m Z m Z m Z m Z m Z d d l m Z d d l Z d d l Z d d l m Z d d l Z e j  d  Z! d   Z" e j# d e
 e j$ f d     Y Z% d e e% e f d     YZ& d e% e f d     YZ' d e e% f d     YZ( d e) f d     YZ* d e* e% f d     YZ+ d e+ f d     YZ, d e+ f d     YZ- e j# d  e* e
 f d!     Y Z. d" e. f d#     YZ/ d$ e/ f d%     YZ0 d& e e% f d'     YZ1 d(   Z2 d)   Z3 d* e) f d+     YZ4 d, e4 e1 f d-     YZ5 d. e1 f d/     YZ6 d0 e1 f d1     YZ7 d2 e5 f d3     YZ8 d4 e5 f d5     YZ9 d6 e e4 e% f d7     YZ: e j; i d8 d9 6 Z< d: e% f d;     YZ= d< e= f d=     YZ> d S(>   s/  The schema module provides the building blocks for database metadata.

Each element within this module describes a database entity which can be
created and dropped, or is otherwise part of such an entity.  Examples include
tables, columns, sequences, and indexes.

All entities are subclasses of :class:`~sqlalchemy.schema.SchemaItem`, and as
defined in this module they are intended to be agnostic of any vendor-specific
constructs.

A collection of entities are grouped into a unit called
:class:`~sqlalchemy.schema.MetaData`. MetaData serves as a logical grouping of
schema elements, and can also be associated with an actual database connection
such that operations involving the contained elements can contact the database
as needed.

Two of the elements here also build upon their "syntactic" counterparts, which
are defined in :class:`~sqlalchemy.sql.expression.`, specifically
:class:`~sqlalchemy.schema.Table` and :class:`~sqlalchemy.schema.Column`.
Since these objects are part of the SQL expression language, they are usable
as components in SQL expressions.

i    (   t   absolute_importNi   (   t   exct   utilt   eventt
   inspectioni   (   t   SchemaEventTargett   DialectKWArgs(   t   visitors(   t   type_api(   t   _bind_or_errort   ColumnCollection(	   t   ClauseElementt   ColumnClauset   _truncated_labelt   _as_truncatedt
   TextClauset   _literal_as_textt   ColumnElementt   _find_columnst   quoted_name(   t   TableClause(   t   ddlt   retain_schemac         C@  s    | d  k r |  S| d |  Sd  S(   Nt   .(   t   None(   t   namet   schema(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   _get_table_key3   s    t
   SchemaItemc           B@  st   e  Z d  Z d Z d   Z d   Z d   Z d   Z e e	 j
 d d  d     Z e	 j d	    Z d
   Z RS(   s3   Base class for items that define a database schema.t   schema_itemc         C@  s   | j  |  | |  S(   N(   t   _execute_default(   t   selft
   connectiont   multiparamst   params(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   _execute_on_connection@   s    c         G@  s1   x* | D]" } | d k	 r | j |   q q Wd S(   s7   Initialize the list of child items for this SchemaItem.N(   R   t   _set_parent_with_dispatch(   R   t   argst   item(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   _init_itemsC   s    c         K@  s   g  S(   s"   used to allow SchemaVisitor access(    (   R   t   kwargs(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   get_childrenJ   s    c         C@  s   t  j |   S(   N(   R   t   generic_repr(   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   __repr__N   s    s   0.9s   Use ``<obj>.name.quote``c         C@  s
   |  j  j S(   s   Return the value of the ``quote`` flag passed
        to this schema object, for those schema items which
        have a ``name`` field.

        (   R   t   quote(   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR,   Q   s    	c         C@  s   i  S(   sL  Info dictionary associated with the object, allowing user-defined
        data to be associated with this :class:`.SchemaItem`.

        The dictionary is automatically generated when first accessed.
        It can also be specified in the constructor of some objects,
        such as :class:`.Table` and :class:`.Column`.

        (    (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   info\   s    
c         C@  s;   d |  j  k r$ |  j j   | _ n  | j j |  j  | S(   NR-   (   t   __dict__R-   t   copyt   dispatcht   _update(   R   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   _schema_item_copyh   s    (   t   __name__t
   __module__t   __doc__t   __visit_name__R#   R'   R)   R+   t   propertyR   t
   deprecatedR,   t   memoized_propertyR-   R2   (    (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   :   s   				
t   Tablec           B@  s=  e  Z d  Z d Z d   Z e e j d d  d     Z d   Z	 d   Z
 d d  Z e d	    Z d
   Z d   Z d   Z e j d    Z e d    Z d   Z d   Z e d    Z d   Z d   Z d   Z d   Z d   Z e e d  Z d d  Z d e d  Z  d e d  Z! e" d d  Z# RS(   s+  Represent a table in a database.

    e.g.::

        mytable = Table("mytable", metadata,
                        Column('mytable_id', Integer, primary_key=True),
                        Column('value', String(50))
                   )

    The :class:`.Table` object constructs a unique instance of itself based
    on its name and optional schema name within the given
    :class:`.MetaData` object. Calling the :class:`.Table`
    constructor with the same name and same :class:`.MetaData` argument
    a second time will return the *same* :class:`.Table` object - in this way
    the :class:`.Table` constructor acts as a registry function.

    .. seealso::

        :ref:`metadata_describing` - Introduction to database metadata

    Constructor arguments are as follows:

    :param name: The name of this table as represented in the database.

        The table name, along with the value of the ``schema`` parameter,
        forms a key which uniquely identifies this :class:`.Table` within
        the owning :class:`.MetaData` collection.
        Additional calls to :class:`.Table` with the same name, metadata,
        and schema name will return the same :class:`.Table` object.

        Names which contain no upper case characters
        will be treated as case insensitive names, and will not be quoted
        unless they are a reserved word or contain special characters.
        A name with any number of upper case characters is considered
        to be case sensitive, and will be sent as quoted.

        To enable unconditional quoting for the table name, specify the flag
        ``quote=True`` to the constructor, or use the :class:`.quoted_name`
        construct to specify the name.

    :param metadata: a :class:`.MetaData` object which will contain this
        table.  The metadata is used as a point of association of this table
        with other tables which are referenced via foreign key.  It also
        may be used to associate this table with a particular
        :class:`.Connectable`.

    :param \*args: Additional positional arguments are used primarily
        to add the list of :class:`.Column` objects contained within this
        table. Similar to the style of a CREATE TABLE statement, other
        :class:`.SchemaItem` constructs may be added here, including
        :class:`.PrimaryKeyConstraint`, and :class:`.ForeignKeyConstraint`.

    :param autoload: Defaults to ``False``.  When ``True``, :class:`.Column`
        objects
        for this table should be reflected from the database, possibly
        augmenting or replacing existing :class:`.Column` objects that were
        expicitly specified.

        .. seealso::

            :ref:`metadata_reflection_toplevel`

    :param autoload_replace: Defaults to ``True``; when using
        :paramref:`.Table.autoload`
        in conjunction with :paramref:`.Table.extend_existing`, indicates
        that :class:`.Column` objects present in the already-existing
        :class:`.Table` object should be replaced with columns of the same
        name retrieved from the autoload process.   When ``False``, columns
        already present under existing names will be omitted from the
        reflection process.

        Note that this setting does not impact :class:`.Column` objects
        specified programmatically within the call to :class:`.Table` that
        also is autoloading; those :class:`.Column` objects will always
        replace existing columns of the same name when
        :paramref:`.Table.extend_existing` is ``True``.

        .. versionadded:: 0.7.5

        .. seealso::

            :paramref:`.Table.autoload`

            :paramref:`.Table.extend_existing`

    :param autoload_with: An :class:`.Engine` or :class:`.Connection` object
        with which this :class:`.Table` object will be reflected, when
        :paramref:`.Table.autoload` is also ``True``. If left unset,
        but :paramref:`.Table.autoload` is set to ``True``, an autoload
        operation will attempt to proceed by locating an :class:`.Engine` or
        :class:`.Connection` bound to the underlying :class:`.MetaData` object.

        .. seealso::

            :paramref:`.Table.autoload`

    :param extend_existing: When ``True``, indicates that if this
        :class:`.Table` is already present in the given :class:`.MetaData`,
        apply further arguments within the constructor to the existing
        :class:`.Table`.

        If :paramref:`.Table.extend_existing` or
        :paramref:`.Table.keep_existing` are not set, and the given name
        of the new :class:`.Table` refers to a :class:`.Table` that is
        already present in the target :class:`.MetaData` collection, and
        this :class:`.Table` specifies additional columns or other constructs
        or flags that modify the table's state, an
        error is raised.  The purpose of these two mutually-exclusive flags
        is to specify what action should be taken when a :class:`.Table`
        is specified that matches an existing :class:`.Table`, yet specifies
        additional constructs.

        :paramref:`.Table.extend_existing` will also work in conjunction
        with :paramref:`.Table.autoload` to run a new reflection
        operation against the database, even if a :class:`.Table`
        of the same name is already present in the target
        :class:`.MetaData`; newly reflected :class:`.Column` objects
        and other options will be added into the state of the
        :class:`.Table`, potentially overwriting existing columns
        and options of the same name.

        .. versionchanged:: 0.7.4 :paramref:`.Table.extend_existing` will
           invoke a new reflection operation when combined with
           :paramref:`.Table.autoload` set to True.

        As is always the case with :paramref:`.Table.autoload`,
        :class:`.Column` objects can be specified in the same :class:`.Table`
        constructor, which will take precedence.  Below, the existing
        table ``mytable`` will be augmented with :class:`.Column` objects
        both reflected from the database, as well as the given :class:`.Column`
        named "y"::

            Table("mytable", metadata,
                        Column('y', Integer),
                        extend_existing=True,
                        autoload=True,
                        autoload_with=engine
                    )

        .. seealso::

            :paramref:`.Table.autoload`

            :paramref:`.Table.autoload_replace`

            :paramref:`.Table.keep_existing`


    :param implicit_returning: True by default - indicates that
        RETURNING can be used by default to fetch newly inserted primary key
        values, for backends which support this.  Note that
        create_engine() also provides an implicit_returning flag.

    :param include_columns: A list of strings indicating a subset of
        columns to be loaded via the ``autoload`` operation; table columns who
        aren't present in this list will not be represented on the resulting
        ``Table`` object. Defaults to ``None`` which indicates all columns
        should be reflected.

    :param info: Optional data dictionary which will be populated into the
        :attr:`.SchemaItem.info` attribute of this object.

    :param keep_existing: When ``True``, indicates that if this Table
        is already present in the given :class:`.MetaData`, ignore
        further arguments within the constructor to the existing
        :class:`.Table`, and return the :class:`.Table` object as
        originally created. This is to allow a function that wishes
        to define a new :class:`.Table` on first call, but on
        subsequent calls will return the same :class:`.Table`,
        without any of the declarations (particularly constraints)
        being applied a second time.

        If :paramref:`.Table.extend_existing` or
        :paramref:`.Table.keep_existing` are not set, and the given name
        of the new :class:`.Table` refers to a :class:`.Table` that is
        already present in the target :class:`.MetaData` collection, and
        this :class:`.Table` specifies additional columns or other constructs
        or flags that modify the table's state, an
        error is raised.  The purpose of these two mutually-exclusive flags
        is to specify what action should be taken when a :class:`.Table`
        is specified that matches an existing :class:`.Table`, yet specifies
        additional constructs.

        .. seealso::

            :paramref:`.Table.extend_existing`

    :param listeners: A list of tuples of the form ``(<eventname>, <fn>)``
        which will be passed to :func:`.event.listen` upon construction.
        This alternate hook to :func:`.event.listen` allows the establishment
        of a listener function specific to this :class:`.Table` before
        the "autoload" process begins.  Particularly useful for
        the :meth:`.DDLEvents.column_reflect` event::

            def listen_for_reflect(table, column_info):
                "handle the column reflection event"
                # ...

            t = Table(
                'sometable',
                autoload=True,
                listeners=[
                    ('column_reflect', listen_for_reflect)
                ])

    :param mustexist: When ``True``, indicates that this Table must already
        be present in the given :class:`.MetaData` collection, else
        an exception is raised.

    :param prefixes:
        A list of strings to insert after CREATE in the CREATE TABLE
        statement.  They will be separated by spaces.

    :param quote: Force quoting of this table's name on or off, corresponding
        to ``True`` or ``False``.  When left at its default of ``None``,
        the column identifier will be quoted according to whether the name is
        case sensitive (identifiers with at least one upper case character are
        treated as case sensitive), or if it's a reserved word.  This flag
        is only needed to force quoting of a reserved word which is not known
        by the SQLAlchemy dialect.

    :param quote_schema: same as 'quote' but applies to the schema identifier.

    :param schema: The schema name for this table, which is required if
        the table resides in a schema other than the default selected schema
        for the engine's database connection.  Defaults to ``None``.

        The quoting rules for the schema name are the same as those for the
        ``name`` parameter, in that quoting is applied for reserved words or
        case-sensitive names; to enable unconditional quoting for the
        schema name, specify the flag
        ``quote_schema=True`` to the constructor, or use the
        :class:`.quoted_name` construct to specify the name.

    :param useexisting: Deprecated.  Use :paramref:`.Table.extend_existing`.

    :param \**kw: Additional keyword arguments not mentioned above are
        dialect specific, and passed in the form ``<dialectname>_<argname>``.
        See the documentation regarding an individual dialect at
        :ref:`dialect_toplevel` for detail on documented arguments.

    t   tablec         O@  sH  | s t  j |   Sy$ | d | d | d } } } Wn t k
 rV t d   n X| j d d   } | d  k r | j } n  | j d t  } | j d t  } d | k r d	 } t	 j
 |  | r d
 } t j |   n  | j d t  } n  | r| rd } t j |   n  | j d t  }	 t | |  }
 |
 | j k r| r{| r{t |  r{t j d |
   n  | j |
 } | r| j | |   n  | S|	 rt j d |
   n  t  j |   } | j j | |  | j | | |  y1 | j | | | |  | j j | |  | SWn | j | |    n Xd  S(   Ni    i   i   s$   Table() takes at least two argumentsR   t   keep_existingt   extend_existingt   useexistings0   useexisting is deprecated.  Use extend_existing.s/   useexisting is synonymous with extend_existing.s9   keep_existing and extend_existing are mutually exclusive.t	   mustexists   Table '%s' is already defined for this MetaData instance.  Specify 'extend_existing=True' to redefine options and columns on an existing Table object.s   Table '%s' not defined(   t   objectt   __new__t
   IndexErrort	   TypeErrort   getR   R   t   popt   FalseR   t   warn_deprecatedR   t   ArgumentErrorR   t   tablest   boolt   InvalidRequestErrort   _init_existingR0   t   before_parent_attacht
   _add_tablet   _initt   after_parent_attacht   _remove_table(   t   clsR%   t   kwR   t   metadataR   R<   R=   t   msgR?   t   keyR;   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRA   e  sZ    $s   0.9s   Use ``table.schema.quote``c         C@  s
   |  j  j S(   s^   Return the value of the ``quote_schema`` flag passed
        to this :class:`.Table`.
        (   R   R,   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   quote_schema  s    c         O@  s   d S(   s   Constructor for :class:`~.schema.Table`.

        This method is a no-op.   See the top-level
        documentation for :class:`~.schema.Table`
        for constructor arguments.

        N(    (   R   R%   RS   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   __init__  s    c         O@  s$  t  t |   j t | | j d d     | |  _ | j d d   |  _ |  j d  k rg | j |  _ n' | j d d   } t |  j |  |  _ t   |  _	 t   |  _
 t   |  _ t   j |   t   |  _ t   |  _ |  j d  k	 rd |  j |  j f |  _ n |  j |  _ | j d t  } | j d d   } | j d t  | j d d   } | j d	 t  |  _ d
 | k r| j d
  |  _ n  d | k r| j d  }	 x* |	 D] \ }
 } t j |  |
 |  qWn  | j d g   |  _ |  j |   | r|  j | | |  n  |  j |   d  S(   NR,   R   RW   s   %s.%st   autoloadt   autoload_witht   autoload_replacet   include_columnst   implicit_returningR-   t	   listenerst   prefixes(   t   superR:   RX   R   RE   R   RT   R   t   sett   indexest   constraintsR
   t   _columnst   PrimaryKeyConstraintR$   t   foreign_keyst   _extra_dependenciesR   t   fullnameRF   t   TrueR]   R-   R   t   listent	   _prefixest   _extra_kwargst	   _autoloadR'   (   R   R   RT   R%   R(   RW   RY   RZ   R\   R^   t   evtt   fn(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRO     sB    	c         C@  sW   | r% | j  | j j |  | |  n. t | d d } | j  | j j |  | |  d  S(   NRU   s   No engine is bound to this Table's MetaData. Pass an engine to the Table via autoload_with=<someengine>, or associate the MetaData with an engine via metadata.bind=<someengine>(   t   run_callablet   dialectt   reflecttableR	   (   R   RT   RZ   R\   t   exclude_columnst   bind(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRm     s    			c         C@  s   t  |  j d d   S(   sT   Return the set of constraints as a list, sorted by creation
        order.

        RV   c         S@  s   |  j  S(   N(   t   _creation_order(   t   c(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   <lambda>   s    (   t   sortedRc   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   _sorted_constraints  s    c         O@  s  | j  d t  } | j  d d   } | j  d t  } | j  d d   } | r{ | |  j k r{ t j d |  j | f   n  | j  d d   } | d  k	 r x6 |  j D]( } | j | k r |  j	 j
 |  q q Wn  x, d D]$ }	 |	 | k r t j d	   q q Wd
 | k r"| j  d
  |  _ n  | rr| sPg  |  j D] } | j ^ q8}
 n d }
 |  j |  j | | |
  n  |  j |   |  j |   d  S(   NRY   RZ   R[   R   s7   Can't change schema of existing table from '%s' to '%s'R\   R,   RW   s2   Can't redefine 'quote' or 'quote_schema' argumentsR-   (   s   quotes   quote_schema(    (   RE   RF   R   Ri   R   R   RH   Rv   R   Rd   t   removeR-   Rm   RT   Rl   R'   (   R   R%   R(   RY   RZ   R[   R   R\   Rv   RV   Rs   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRL     s8    "	c         K@  s   |  j  |  d  S(   N(   t   _validate_dialect_kwargs(   R   R(   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRl   '  s    c         C@  s   d  S(   N(    (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   _init_collections*  s    c      
   C@  s   x |  j  D] } | j r
 | j j d  k	 r
 t | j j t j j  r
 | j s_ | j d k r
 t	 | j
 t d   t f  r
 | j d  k s | j j r
 | Sq
 Wd  S(   Nt	   ignore_fk(   t   primary_keyt   autoincrementt   typet   _type_affinityR   t
   issubclassR   t   INTEGERTYPERf   t
   isinstancet   defaultt   Sequencet   server_defaultt	   reflected(   R   t   col(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   _autoincrement_column-  s    
c         C@  s   t  |  j |  j  S(   s_  Return the 'key' for this :class:`.Table`.

        This value is used as the dictionary key within the
        :attr:`.MetaData.tables` collection.   It is typically the same
        as that of :attr:`.Table.name` for a table with no
        :attr:`.Table.schema` set; otherwise it is typically of the form
        ``schemaname.tablename``.

        (   R   R   R   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRV   :  s    c         C@  s   d d j  t |  j  g t |  j  g g  |  j D] } t |  ^ q2 g  d g D]% } d | t t |  |   f ^ qR  S(   Ns	   Table(%s)s   , R   s   %s=%s(   t   joint   reprR   RT   t   columnst   getattr(   R   t   xt   k(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR+   G  s    	?c         C@  s   t  |  j |  j  S(   N(   R   t   descriptionR   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   __str__M  s    c         C@  s   |  j  r |  j  j p d S(   s2   Return the connectable associated with this Table.N(   RT   Rt   R   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRt   P  s    c         C@  s   |  j  j |  d S(   s  Add a 'dependency' for this Table.

        This is another Table object which must be created
        first before this one can, or dropped after this one.

        Usually, dependencies between tables are determined via
        ForeignKey objects.   However, for other situations that
        create dependencies outside of foreign keys (rules, inheriting),
        this method can manually establish such a link.

        N(   Rg   t   add(   R   R;   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   add_is_dependent_onV  s    c         C@  s   | j  |   d S(   sz  Append a :class:`~.schema.Column` to this :class:`~.schema.Table`.

        The "key" of the newly added :class:`~.schema.Column`, i.e. the
        value of its ``.key`` attribute, will then be available
        in the ``.c`` collection of this :class:`~.schema.Table`, and the
        column definition will be included in any CREATE TABLE, SELECT,
        UPDATE, etc. statements generated from this :class:`~.schema.Table`
        construct.

        Note that this does **not** change the definition of the table
        as it exists within any underlying database, assuming that
        table has already been created in the database.   Relational
        databases support the addition of columns to existing tables
        using the SQL ALTER command, which would need to be
        emitted for an already-existing table that doesn't contain
        the newly added column.

        N(   R$   (   R   t   column(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   append_columnd  s    c         C@  s   | j  |   d S(   s  Append a :class:`~.schema.Constraint` to this
        :class:`~.schema.Table`.

        This has the effect of the constraint being included in any
        future CREATE TABLE statement, assuming specific DDL creation
        events have not been associated with the given
        :class:`~.schema.Constraint` object.

        Note that this does **not** produce the constraint within the
        relational database automatically, for a table that already exists
        in the database.   To add a constraint to an
        existing relational database table, the SQL ALTER command must
        be used.  SQLAlchemy also provides the
        :class:`.AddConstraint` construct which can produce this SQL when
        invoked as an executable clause.

        N(   R$   (   R   t
   constraint(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   append_constraintz  s    c         @  s9      f d   } t  j |  d   j d d  |  d S(   sz   Append a DDL event listener to this ``Table``.

        .. deprecated:: 0.7
            See :class:`.DDLEvents`.

        c         @  s      |  |  d  S(   N(    (   t   targetR    RS   (   t   listenert
   event_name(    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   adapt_listener  s    t    t   -t   _N(   R   Rj   t   replace(   R   R   R   R   (    (   R   R   s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   append_ddl_listener  s    c         C@  s&   | j  |  j |  j |   | |  _ d  S(   N(   RN   R   R   RT   (   R   RT   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   _set_parent  s    c         K@  s7   | s t  j |  d | | S| r/ t |  j  Sg  Sd  S(   Nt   column_collections(   R   R)   t   listR   (   R   R   t   schema_visitorRS   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR)     s    c         C@  s=   | d k r t |   } n  | j | j j |  j d |  j S(   s!   Return True if this table exists.R   N(   R   R	   Rp   Rq   t	   has_tableR   R   (   R   Rt   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   exists  s    c         C@  s8   | d k r t |   } n  | j t j |  d | d S(   s   Issue a ``CREATE`` statement for this
        :class:`.Table`, using the given :class:`.Connectable`
        for connectivity.

        .. seealso::

            :meth:`.MetaData.create_all`.

        t
   checkfirstN(   R   R	   t   _run_visitorR   t   SchemaGenerator(   R   Rt   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   create  s
    c         C@  s8   | d k r t |   } n  | j t j |  d | d S(   s   Issue a ``DROP`` statement for this
        :class:`.Table`, using the given :class:`.Connectable`
        for connectivity.

        .. seealso::

            :meth:`.MetaData.drop_all`.

        R   N(   R   R	   R   R   t   SchemaDropper(   R   Rt   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   drop  s
    
c      
   C@  s  | t  k r |  j } n | d k r0 | j } n  t |  j |  } | | j k rp t j d |  j  | j | Sg  } x* |  j	 D] } | j
 | j d |   q Wt |  j | d | | |  j } x |  j D] } t | t  rG| j } | r
| |  | | |  }	 n | |  j k r| n d }	 | j | j d |	 d |   q | j | j d | d |   q Wx |  j D]y }
 t |
 j	  d k rt |
 j	  d j rqtn  t |
 j d |
 j g  |
 j	 j   D] } | j | ^ q|
 j qtW|  j |  S(   s=	  Return a copy of this :class:`.Table` associated with a different
        :class:`.MetaData`.

        E.g.::

            m1 = MetaData()

            user = Table('user', m1, Column('id', Integer, priamry_key=True))

            m2 = MetaData()
            user_copy = user.tometadata(m2)

        :param metadata: Target :class:`.MetaData` object, into which the
         new :class:`.Table` object will be created.

        :param schema: optional string name indicating the target schema.
         Defaults to the special symbol :attr:`.RETAIN_SCHEMA` which indicates
         that no change to the schema name should be made in the new
         :class:`.Table`.  If set to a string name, the new :class:`.Table`
         will have this new name as the ``.schema``.  If set to ``None``, the
         schema will be set to that of the schema set on the target
         :class:`.MetaData`, which is typically ``None`` as well, unless
         set explicitly::

            m2 = MetaData(schema='newschema')

            # user_copy_one will have "newschema" as the schema name
            user_copy_one = user.tometadata(m2, schema=None)

            m3 = MetaData()  # schema defaults to None

            # user_copy_two will have None as the schema name
            user_copy_two = user.tometadata(m3, schema=None)

        :param referred_schema_fn: optional callable which can be supplied
         in order to provide for the schema name that should be assigned
         to the referenced table of a :class:`.ForeignKeyConstraint`.
         The callable accepts this parent :class:`.Table`, the
         target schema that we are changing to, the
         :class:`.ForeignKeyConstraint` object, and the existing
         "target schema" of that constraint.  The function should return the
         string schema name that should be applied.
         E.g.::

                def referred_schema_fn(table, to_schema,
                                                constraint, referred_schema):
                    if referred_schema == 'base_tables':
                        return referred_schema
                    else:
                        return to_schema

                new_table = table.tometadata(m2, schema="alt_schema",
                                        referred_schema_fn=referred_schema_fn)

         .. versionadded:: 0.9.2

        sB   Table '%s' already exists within the given MetaData - not copying.R   t   target_tablei   i    t   uniqueN(   t   RETAIN_SCHEMAR   R   R   R   RI   R   t   warnR   R   t   appendR/   R:   R(   Rc   R   t   ForeignKeyConstraintt   _referred_schemaR   Rb   t   lenR   t   indext   IndexR   t   keysRv   R2   (   R   RT   R   t   referred_schema_fnRV   R%   Rv   R;   t   referred_schemat   fk_constraint_schemaR   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt
   tometadata  sF    <		&(    N($   R3   R4   R5   R6   RA   R7   R   R8   RW   RX   RO   Rm   Ry   RL   Rl   R|   R9   R   RV   R+   R   Rt   R   R   R   R   R   Ri   RF   R)   R   R   R   R   R   R   (    (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR:   o   s:   	8		5	%									
	t   Columnc           B@  sz   e  Z d  Z d Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z e e e d
  Z e d  Z RS(   s(   Represents a column in a database table.R   c         O@  s  | j  d d  } | j  d d  } t |  } | r t | d t j  r | d k	 rj t j d   n  | j  d  } q n  | r | d } t | d  r | d k	 r t j d   n  | j  d  } q n  | d k	 r t	 | | j  d d   } n d | k rt j d   n  t
 t |   j | |  | j  d	 |  |  _ | j  d
 t  |  _ | j  d |  j  |  _ | j  d d  |  _ | j  d d  |  _ | j  d d  |  _ | j  d d  |  _ | j  d d  |  _ | j  d t  |  _ | j  d d  |  _ | j  d d  |  _ | j  d t  |  _ t   |  _ t   |  _ d | k rk| j  d  |  _ n% t |  j t   r|  j j! |   n  |  j d k	 r t |  j t" t# f  r| j$ |  j  q t% |  j d t  rt |  j t j&  rt j' d  qn  | j$ t" |  j   n  |  j d k	 rvt |  j t(  r]| j$ |  j j) t   qv| j$ t* |  j   n  |  j d k	 rt |  j t" t# f  r| j$ |  j  q| j$ t" |  j d t  n  |  j d k	 r+t |  j t(  r| j$ |  j j) t   q+| j$ t* |  j d t  n  |  j+ |   t j, |   d | k rf| j  d  |  _- n  | rt j d t. t |     n  d S(   s+  
        Construct a new ``Column`` object.

        :param name: The name of this column as represented in the database.
          This argument may be the first positional argument, or specified
          via keyword.

          Names which contain no upper case characters
          will be treated as case insensitive names, and will not be quoted
          unless they are a reserved word.  Names with any number of upper
          case characters will be quoted and sent exactly.  Note that this
          behavior applies even for databases which standardize upper
          case names as case insensitive such as Oracle.

          The name field may be omitted at construction time and applied
          later, at any time before the Column is associated with a
          :class:`.Table`.  This is to support convenient
          usage within the :mod:`~sqlalchemy.ext.declarative` extension.

        :param type\_: The column's type, indicated using an instance which
          subclasses :class:`~sqlalchemy.types.TypeEngine`.  If no arguments
          are required for the type, the class of the type can be sent
          as well, e.g.::

            # use a type with arguments
            Column('data', String(50))

            # use no arguments
            Column('level', Integer)

          The ``type`` argument may be the second positional argument
          or specified by keyword.

          If the ``type`` is ``None`` or is omitted, it will first default to
          the special type :class:`.NullType`.  If and when this
          :class:`.Column` is made to refer to another column using
          :class:`.ForeignKey` and/or :class:`.ForeignKeyConstraint`, the type
          of the remote-referenced column will be copied to this column as
          well, at the moment that the foreign key is resolved against that
          remote :class:`.Column` object.

          .. versionchanged:: 0.9.0
            Support for propagation of type to a :class:`.Column` from its
            :class:`.ForeignKey` object has been improved and should be
            more reliable and timely.

        :param \*args: Additional positional arguments include various
          :class:`.SchemaItem` derived constructs which will be applied
          as options to the column.  These include instances of
          :class:`.Constraint`, :class:`.ForeignKey`, :class:`.ColumnDefault`,
          and :class:`.Sequence`.  In some cases an equivalent keyword
          argument is available such as ``server_default``, ``default``
          and ``unique``.

        :param autoincrement: This flag may be set to ``False`` to
          indicate an integer primary key column that should not be
          considered to be the "autoincrement" column, that is
          the integer primary key column which generates values
          implicitly upon INSERT and whose value is usually returned
          via the DBAPI cursor.lastrowid attribute.   It defaults
          to ``True`` to satisfy the common use case of a table
          with a single integer primary key column.  If the table
          has a composite primary key consisting of more than one
          integer column, set this flag to True only on the
          column that should be considered "autoincrement".

          The setting *only* has an effect for columns which are:

          * Integer derived (i.e. INT, SMALLINT, BIGINT).

          * Part of the primary key

          * Not refering to another column via :class:`.ForeignKey`, unless
            the value is specified as ``'ignore_fk'``::

                # turn on autoincrement for this column despite
                # the ForeignKey()
                Column('id', ForeignKey('other.id'),
                            primary_key=True, autoincrement='ignore_fk')

            It is typically not desirable to have "autoincrement" enabled
            on such a column as its value intends to mirror that of a
            primary key column elsewhere.

          * have no server side or client side defaults (with the exception
            of Postgresql SERIAL).

          The setting has these two effects on columns that meet the
          above criteria:

          * DDL issued for the column will include database-specific
            keywords intended to signify this column as an
            "autoincrement" column, such as AUTO INCREMENT on MySQL,
            SERIAL on Postgresql, and IDENTITY on MS-SQL.  It does
            *not* issue AUTOINCREMENT for SQLite since this is a
            special SQLite flag that is not required for autoincrementing
            behavior.

            .. seealso::

                :ref:`sqlite_autoincrement`

          * The column will be considered to be available as
            cursor.lastrowid or equivalent, for those dialects which
            "post fetch" newly inserted identifiers after a row has
            been inserted (SQLite, MySQL, MS-SQL).  It does not have
            any effect in this regard for databases that use sequences
            to generate primary key identifiers (i.e. Firebird, Postgresql,
            Oracle).

          .. versionchanged:: 0.7.4
              ``autoincrement`` accepts a special value ``'ignore_fk'``
              to indicate that autoincrementing status regardless of foreign
              key references.  This applies to certain composite foreign key
              setups, such as the one demonstrated in the ORM documentation
              at :ref:`post_update`.

        :param default: A scalar, Python callable, or
            :class:`.ColumnElement` expression representing the
            *default value* for this column, which will be invoked upon insert
            if this column is otherwise not specified in the VALUES clause of
            the insert. This is a shortcut to using :class:`.ColumnDefault` as
            a positional argument; see that class for full detail on the
            structure of the argument.

            Contrast this argument to ``server_default`` which creates a
            default generator on the database side.

        :param doc: optional String that can be used by the ORM or similar
            to document attributes.   This attribute does not render SQL
            comments (a future attribute 'comment' will achieve that).

        :param key: An optional string identifier which will identify this
            ``Column`` object on the :class:`.Table`. When a key is provided,
            this is the only identifier referencing the ``Column`` within the
            application, including ORM attribute mapping; the ``name`` field
            is used only when rendering SQL.

        :param index: When ``True``, indicates that the column is indexed.
            This is a shortcut for using a :class:`.Index` construct on the
            table. To specify indexes with explicit names or indexes that
            contain multiple columns, use the :class:`.Index` construct
            instead.

        :param info: Optional data dictionary which will be populated into the
            :attr:`.SchemaItem.info` attribute of this object.

        :param nullable: If set to the default of ``True``, indicates the
            column will be rendered as allowing NULL, else it's rendered as
            NOT NULL. This parameter is only used when issuing CREATE TABLE
            statements.

        :param onupdate: A scalar, Python callable, or
            :class:`~sqlalchemy.sql.expression.ClauseElement` representing a
            default value to be applied to the column within UPDATE
            statements, which wil be invoked upon update if this column is not
            present in the SET clause of the update. This is a shortcut to
            using :class:`.ColumnDefault` as a positional argument with
            ``for_update=True``.

        :param primary_key: If ``True``, marks this column as a primary key
            column. Multiple columns can have this flag set to specify
            composite primary keys. As an alternative, the primary key of a
            :class:`.Table` can be specified via an explicit
            :class:`.PrimaryKeyConstraint` object.

        :param server_default: A :class:`.FetchedValue` instance, str, Unicode
            or :func:`~sqlalchemy.sql.expression.text` construct representing
            the DDL DEFAULT value for the column.

            String types will be emitted as-is, surrounded by single quotes::

                Column('x', Text, server_default="val")

                x TEXT DEFAULT 'val'

            A :func:`~sqlalchemy.sql.expression.text` expression will be
            rendered as-is, without quotes::

                Column('y', DateTime, server_default=text('NOW()'))

                y DATETIME DEFAULT NOW()

            Strings and text() will be converted into a
            :class:`.DefaultClause` object upon initialization.

            Use :class:`.FetchedValue` to indicate that an already-existing
            column will generate a default value on the database side which
            will be available to SQLAlchemy for post-fetch after inserts. This
            construct does not specify any DDL and the implementation is left
            to the database, such as via a trigger.

        :param server_onupdate:   A :class:`.FetchedValue` instance
             representing a database-side default generation function. This
             indicates to SQLAlchemy that a newly generated value will be
             available after updates. This construct does not specify any DDL
             and the implementation is left to the database, such as via a
             trigger.

        :param quote: Force quoting of this column's name on or off,
             corresponding to ``True`` or ``False``. When left at its default
             of ``None``, the column identifier will be quoted according to
             whether the name is case sensitive (identifiers with at least one
             upper case character are treated as case sensitive), or if it's a
             reserved word. This flag is only needed to force quoting of a
             reserved word which is not known by the SQLAlchemy dialect.

        :param unique: When ``True``, indicates that this column contains a
             unique constraint, or if ``index`` is ``True`` as well, indicates
             that the :class:`.Index` should be created with the unique flag.
             To specify multiple columns in the constraint/index or to specify
             an explicit name, use the :class:`.UniqueConstraint` or
             :class:`.Index` constructs explicitly.

        :param system: When ``True``, indicates this is a "system" column,
             that is a column which is automatically made available by the
             database, and should not be included in the columns list for a
             ``CREATE TABLE`` statement.

             For more elaborate scenarios where columns should be
             conditionally rendered differently on different backends,
             consider custom compilation rules for :class:`.CreateColumn`.

             ..versionadded:: 0.8.3 Added the ``system=True`` parameter to
               :class:`.Column`.

        R   t   type_i    s0   May not pass name positionally and as a keyword.t
   _sqla_types1   May not pass type_ positionally and as a keyword.R,   s9   Explicit 'name' is required when sending 'quote' argumentRV   R~   t   nullableR   R   t   server_onupdateR   R   t   systemt   doct   onupdateR   t   _proxiest   _warn_on_bytestrings2   Unicode column received non-unicode default value.t
   for_updateR-   s$   Unknown arguments passed to Column: N(/   RE   R   R   R   R   t   string_typesR   RH   t   hasattrR   R`   R   RX   RV   RF   R~   R   R   R   R   R   R   R   R   R   Ri   R   Ra   Rc   Rf   R   R   R   R$   t   ColumnDefaultR   R   R   t   binary_typeR   t   FetchedValuet   _as_for_updatet   DefaultClauseR'   t   set_creation_orderR-   R   (   R   R%   R(   R   R   t   coltype(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRX   C  s    
c         C@  sX   |  j  d  k r d S|  j d  k	 rM |  j j rC |  j j d |  j S|  j Sn |  j Sd  S(   Ns	   (no name)R   (   R   R   R;   t   named_with_columnR   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR     s    
c         C@  s8   x1 |  j  D]" } | j j j | j  r
 t Sq
 Wt Sd S(   sO   Return True if this Column references the given column via foreign
        key.N(   Rf   R   t	   proxy_sett   intersectionRi   RF   (   R   R   t   fk(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt
   references  s    c         C@  s   | j  |   d  S(   N(   R$   (   R   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   append_foreign_key  s    c         C@  st  g  } |  j  |  j k r( | j d  n  |  j rA | j d  n  |  j sZ | j d  n  |  j rs | j d  n  |  j r | j d  n  |  j r | j d  n  d d j t	 |  j  g t	 |  j
  g g  |  j D] } | d  k	 r t	 |  ^ q g  |  j D] } t	 |  ^ q|  j d  k	 r8d	 |  j j p;d
 g g  | D]% } d | t	 t |  |   f ^ qF S(   NRV   R~   R   R   R   R   s
   Column(%s)s   , s
   table=<%s>s
   table=Nones   %s=%s(   RV   R   R   R~   R   R   R   R   R   R   R   Rf   R   Rc   R;   R   R   (   R   t   kwargR   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR+     s     						c         C@  sk  |  j  s t j d   n  |  j d  k r9 |  j  |  _ n  t |  d d   } | d  k	 r| | | k	 r| t j d | j   n  |  j | j k r| j j |  j  } | |  k	 rxL | j	 D]> } | j	 j
 |  | j | j k r | j j
 | j  q q Wqn  | j j |   |  j r=| j j |   t j j |  n4 |  j | j k rqt j d |  j | j f   n  | |  _ |  j rt |  j t j  rt j d   n  t d  |  d t |  j  nI |  j rt |  j t j  rt j d   n  | j t |  j   n  | j |  j f } | |  j j j k rgx+ |  j j j | D] } | j  |  qMWn  d  S(   Nsf   Column must be constructed with a non-blank name or assign a non-blank .name before adding to a Table.R;   s,   Column object already assigned to Table '%s'sT   Trying to redefine primary-key column '%s' as a non-primary-key column on table '%s's   The 'index' keyword argument on Column is boolean only. To create indexes with a specific name, create an explicit Index object external to the Table.R   s   The 'unique' keyword argument on Column is boolean only. To create unique constraints or indexes with a specific name, append an explicit UniqueConstraint to the Table's list of elements, or create an explicit Index object external to the Table.(!   R   R   RH   RV   R   R   R   Rd   RD   Rf   Rz   R   Rc   R   R~   t   _replaceR:   R   t   _resetRh   R;   R   R   R   R   R   RJ   R   R   t   UniqueConstraintRT   t	   _fk_memost   _set_remote_table(   R   R;   t   existingR   R   t   fk_key(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR     sP    	 				c         C@  s9   |  j  d  k	 r" | |  |  j   n  t j |  d |  d  S(   NRP   (   R;   R   R   Rj   (   R   Ro   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   _on_table_attach  s    c         K@  s  g  |  j  D] } | j |   ^ q
 g  |  j D] } | j s, | j |   ^ q, } |  j } t | t  r{ | j |   } n  |  j d |  j d | d |  j	 d |  j
 d |  j d |  j d |  j d |  j d	 |  j d
 |  j d |  j d |  j d |  j d |  j |  } |  j |  S(   sg   Create a copy of this ``Column``, unitialized.

        This is used in ``Table.tometadata``.

        R   R   RV   R~   R   R   R   R   R   R   R   R   R   R   (   Rc   R/   Rf   R   R   R   R   t   _constructorR   RV   R~   R   R   R   R   R   R   R   R   R   R   R2   (   R   RS   Rv   R%   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR/     s,    	"/															c   	      K@  sy  g  |  j  D] } t | j d | j ^ q
 } | d k r[ |  j d k r[ t j d   n  y| |  j | r t	 | py |  j  n | p |  j |  j
 d | r | n | r | n |  j d |  j d |  j d |  g | } Wn+ t k
 rt j t d |  j   n X| | _ | j j |  | j d k	 rF| j j | j | _ n  |  j rb| j j |  n  | j j | |  | S(	   s$  Create a *proxy* for this column.

        This is a copy of this ``Column`` referenced by a different parent
        (such as an alias or select statement).  The column should
        be used only in select scenarios, as its full DDL/default
        information is not transferred.

        t   _constraints^   Cannot initialize a sub-selectable with this Column object until its 'name' has been assigned.RV   R~   R   R   s   Could not create a copy of this %r object.  Ensure the class includes a _constructor() attribute or method which accepts the standard Column constructor arguments, or references the Column class itself.N(   Rf   t
   ForeignKeyR   R   R   R   R   RK   R   R   R   RV   R~   R   RC   R   t   raise_from_causet	   __class__R;   Rd   R   t   _is_clone_ofR   R0   RP   (	   R   t
   selectableR   RV   t   name_is_truncatableRS   t   fR   Rv   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   _make_proxy  s4    
+'	!				c         K@  sc   | rO g  |  j  |  j f D] } | d  k	 r | ^ q t |  j  t |  j  St j |  |  Sd  S(   N(   R   R   R   R   Rf   Rc   R   R)   (   R   R   R(   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR)   F  s    I(   R3   R4   R5   R6   RX   R   R   R   R+   R   R   R/   R   RF   R   R)   (    (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   >  s   	 E		
			;		$,R   c        
   B@  s   e  Z d  Z d Z d e d d d d d e d d 	 Z d   Z d d  Z d d  Z	 e
 d    Z d   Z e
 e	  Z d   Z d	   Z e j d
    Z d   Z d   Z d   Z e j d    Z d   Z d   Z d   Z d   Z RS(   s  Defines a dependency between two columns.

    ``ForeignKey`` is specified as an argument to a :class:`.Column` object,
    e.g.::

        t = Table("remote_table", metadata,
            Column("remote_id", ForeignKey("main_table.id"))
        )

    Note that ``ForeignKey`` is only a marker object that defines
    a dependency between two columns.   The actual constraint
    is in all cases represented by the :class:`.ForeignKeyConstraint`
    object.   This object will be generated automatically when
    a ``ForeignKey`` is associated with a :class:`.Column` which
    in turn is associated with a :class:`.Table`.   Conversely,
    when :class:`.ForeignKeyConstraint` is applied to a :class:`.Table`,
    ``ForeignKey`` markers are automatically generated to be
    present on each associated :class:`.Column`, which are also
    associated with the constraint object.

    Note that you cannot define a "composite" foreign key constraint,
    that is a constraint between a grouping of multiple parent/child
    columns, using ``ForeignKey`` objects.   To define this grouping,
    the :class:`.ForeignKeyConstraint` object must be used, and applied
    to the :class:`.Table`.   The associated ``ForeignKey`` objects
    are created automatically.

    The ``ForeignKey`` objects associated with an individual
    :class:`.Column` object are available in the `foreign_keys` collection
    of that column.

    Further examples of foreign key configuration are in
    :ref:`metadata_foreignkeys`.

    t   foreign_keyc         K@  s)  | |  _  t |  j  t j  r* d |  _ n t |  j  d  rQ |  j  j   |  _ n |  j  |  _ t |  j t  s t	 j
 d |  j   n: t |  j j t j t f  s t	 j
 d |  j j   n  | |  _ d |  _ | |  _ | |  _ | |  _ | |  _ | |  _ | |  _ |	 |  _ |
 |  _ | |  _ d S(   s
  
        Construct a column-level FOREIGN KEY.

        The :class:`.ForeignKey` object when constructed generates a
        :class:`.ForeignKeyConstraint` which is associated with the parent
        :class:`.Table` object's collection of constraints.

        :param column: A single target column for the key relationship. A
            :class:`.Column` object or a column name as a string:
            ``tablename.columnkey`` or ``schema.tablename.columnkey``.
            ``columnkey`` is the ``key`` which has been assigned to the column
            (defaults to the column name itself), unless ``link_to_name`` is
            ``True`` in which case the rendered name of the column is used.

            .. versionadded:: 0.7.4
                Note that if the schema name is not included, and the
                underlying :class:`.MetaData` has a "schema", that value will
                be used.

        :param name: Optional string. An in-database name for the key if
            `constraint` is not provided.

        :param onupdate: Optional string. If set, emit ON UPDATE <value> when
            issuing DDL for this constraint. Typical values include CASCADE,
            DELETE and RESTRICT.

        :param ondelete: Optional string. If set, emit ON DELETE <value> when
            issuing DDL for this constraint. Typical values include CASCADE,
            DELETE and RESTRICT.

        :param deferrable: Optional bool. If set, emit DEFERRABLE or NOT
            DEFERRABLE when issuing DDL for this constraint.

        :param initially: Optional string. If set, emit INITIALLY <value> when
            issuing DDL for this constraint.

        :param link_to_name: if True, the string name given in ``column`` is
            the rendered name of the referenced column, not its locally
            assigned ``key``.

        :param use_alter: passed to the underlying
            :class:`.ForeignKeyConstraint` to indicate the constraint should
            be generated/dropped externally from the CREATE TABLE/ DROP TABLE
            statement. See that classes' constructor for details.

        :param match: Optional string. If set, emit MATCH <value> when issuing
            DDL for this constraint. Typical values include SIMPLE, PARTIAL
            and FULL.

        :param \**dialect_kw:  Additional keyword arguments are dialect
            specific, and passed in the form ``<dialectname>_<argname>``.  The
            arguments are ultimately handled by a corresponding
            :class:`.ForeignKeyConstraint`.  See the documentation regarding
            an individual dialect at :ref:`dialect_toplevel` for detail on
            documented arguments.

            .. versionadded:: 0.9.2

        t   __clause_element__s9   String, Column, or Column-bound argument expected, got %rs8   ForeignKey received Column not bound to a Table, got: %rN(   t   _colspecR   R   R   R   t   _table_columnR   R   R   R   RH   R;   t   NoneTypeR   R   t   parentt	   use_alterR   R   t   ondeletet
   deferrablet	   initiallyt   link_to_namet   matcht   _unvalidated_dialect_kw(   R   R   R   R   R   R   R   R   R   R   R   t
   dialect_kw(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRX   v  s4    @											c         C@  s   d |  j    S(   Ns   ForeignKey(%r)(   t   _get_colspec(   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR+     s    c         C@  ss   t  |  j d |  d |  j d |  j d |  j d |  j d |  j d |  j d |  j d	 |  j	 |  j
 } |  j |  S(
   s  Produce a copy of this :class:`.ForeignKey` object.

        The new :class:`.ForeignKey` will not be bound
        to any :class:`.Column`.

        This method is usually used by the internal
        copy procedures of :class:`.Column`, :class:`.Table`,
        and :class:`.MetaData`.

        :param schema: The returned :class:`.ForeignKey` will
          reference the original table and column name, qualified
          by the given string schema name.

        R   R   R   R   R   R   R   R   R   (   R   R   R   R   R   R   R   R   R   R   R   R2   (   R   R   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR/     s    							c         C@  s`   | r) |  j  \ } } } d | | | f S|  j d k	 rU d |  j j j |  j j f S|  j Sd S(   s   Return a string based 'column specification' for this
        :class:`.ForeignKey`.

        This is usually the equivalent of the string-based "tablename.colname"
        argument first passed to the object's constructor.

        s   %s.%s.%ss   %s.%sN(   t   _column_tokensR   R   R;   Rh   RV   R   (   R   R   t   _schemat   tnamet   colname(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR     s    c         C@  s   |  j  d S(   Ni    (   R   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR     s    c         C@  sX   |  j  d  k	 r5 |  j  j d  k r% d  S|  j  j j Sn |  j \ } } } t | |  Sd  S(   N(   R   R   R;   RV   R   R   (   R   R   R   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt
   _table_key  s    c         C@  s   | j  |  j  d k	 S(   s\   Return True if the given :class:`.Table` is referenced by this
        :class:`.ForeignKey`.N(   t   corresponding_columnR   R   (   R   R;   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR     s    c         C@  s   | j  |  j  S(   s   Return the :class:`.Column` in the given :class:`.Table`
        referenced by this :class:`.ForeignKey`.

        Returns None if this :class:`.ForeignKey` does not reference the given
        :class:`.Table`.

        (   R   R   (   R   R;   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   get_referent#  s    	c         C@  s   |  j    j d  } | d k r: t j d |  j   n  t |  d k ra | j   } d } n | j   } | j   } t |  d k r d j |  } n d } | | | f S(   s7   parse a string-based _colspec into its component parts.R   s,   Invalid foreign key column specification: %si   i    N(	   R   t   splitR   R   RH   R   R   RE   R   (   R   t   mR   R   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   .  s    	c         C@  s   |  j  d  k r! t j d   n$ |  j  j d  k rE t j d   n  |  j  j } xH |  j  j D]. } t | t  r^ | j | k s t  Pq^ q^ Wt	 s t  |  j
 \ } } } | d  k r | j j d  k	 r | j j } n  t | |  } | | | f S(   NsL   this ForeignKey object does not yet have a parent Column associated with it.sC   this ForeignKey's parent column is not yet associated with a Table.(   R   R   R   RK   R;   t   base_columnsR   R   t   AssertionErrorRF   R   RT   R   R   (   R   t   parenttableRv   R   R   R   t   tablekey(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   _resolve_col_tokensM  s"    c         C@  s  t  |  j d  s! | |  j _ n |  j j | k s9 t  d  } | d  k rr |  j } | j j |  j j d   } nY |  j	 r | } xG | j D] } | j
 | k r | } q q Wn | } | j j | d   } | d  k rt j d |  j | j
 | j
 | f | j
 |   n  |  j |  d  S(   Nt   _referred_tablesi   Could not initialize target column for ForeignKey '%s' on table '%s': table '%s' has no column named '%s'(   R   R   R  R  R   R   Rv   RD   RV   R   R   R   t   NoReferencedColumnErrorR   t   _set_target_column(   R   R  R;   R   t   _columnRV   Rv   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   _link_to_col_by_colstringn  s(    		c         C@  s   |  j  j j r! | j |  j  _ n  t |  j  j t  r |  j  j j |  j  j f } | |  j  j j j k r xB |  j  j j j | D]' } | j  j j r | j | j  _ q q Wq n  | |  _	 d  S(   N(
   R   R   t   _isnullR   R;   R:   RV   RT   R   R   (   R   R   R   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR	    s    c         C@  s   t  |  j t j  r |  j   \ } } } | | j k r^ t j d |  j | | f |   q | j	 | j k r t j
 d |   q t j d |  j | j | | f | |   n2 t |  j d  r |  j j   } | S|  j } | Sd S(   s  Return the target :class:`.Column` referenced by this
        :class:`.ForeignKey`.

        If no target column has been established, an exception
        is raised.

        .. versionchanged:: 0.9.0
            Foreign key target column resolution now occurs as soon as both
            the ForeignKey object and the remote Column to which it refers
            are both associated with the same MetaData object.

        s|   Foreign key associated with column '%s' could not find table '%s' with which to generate a foreign key to target column '%s's9   Table %s is no longer associated with its parent MetaDatasi   Could not initialize target column for ForeignKey '%s' on table '%s': table '%s' has no column named '%s'R   N(   R   R   R   R   R  RT   R   t   NoReferencedTableErrorR   RV   RK   R  R   R   R   (   R   R  R  R   R
  (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR     s(    	c         C@  sc   |  j  d  k	 r0 |  j  | k	 r0 t j d   n  | |  _  |  j  j j |   |  j  j |  j  d  S(   Ns&   This ForeignKey already has a parent !(   R   R   R   RK   Rf   R   R   t
   _set_table(   R   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR     s    	c         C@  s<   |  j    \ } } } |  j | | |  |  j j |  d  S(   N(   R  R  R   t   _validate_dest_table(   R   R;   R  R  R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR     s    c         C@  sO   |  j    \ } } } | | f } |  | j | k rK | j | j |   n  d  S(   N(   R  R   Rz   (   R   RT   R  t	   table_keyR   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   _remove_from_metadata  s    c         C@  s  |  j  d  k r t | t  r t g  g  d |  j d |  j d |  j d |  j d |  j	 d |  j
 d |  j |  j |  _  |  |  j  j |  j <|  j  j |  n  | j j |   t |  j t j  rN|  j   \ } } } | | f } | | j j k r4| j j | } y |  j | | |  Wq4t j k
 r0q4Xn  | j j | j |   nG t |  j d  r|  j j   } |  j |  n |  j } |  j |  d  S(	   NR   R   R   R   R   R   R   R   (    R   R   R   R:   R   R   R   R   R   R   R   R   R   t	   _elementsR   R$   Rf   R   R   R   R   R  RT   RI   R  R   R  R   R   R   R   R	  (   R   R   R;   R  R  R   R   R
  (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR    s4    	N(   R3   R4   R5   R6   R   RF   RX   R+   R/   R   R7   R   R   t   target_fullnameR   R   R   R9   R   R  R  R	  R   R   R   R  R  (    (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   O  s,   #		c		
			!	!	,			t   _NotAColumnExprc           B@  s-   e  Z d    Z d   Z Z e d    Z RS(   c         C@  s   t  j d |  j j   d  S(   Ns7   This %s cannot be used directly as a column expression.(   R   RK   R   R3   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   _not_a_column_expr  s    c         C@  s
   |  j    S(   N(   R  (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRw     s    c         C@  s
   |  j    S(   N(   R  (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRw     s    (   R3   R4   R  R   t
   self_groupR7   t   _from_objects(    (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR    s   	t   DefaultGeneratorc           B@  sV   e  Z d  Z d Z e Z e Z d Z e d  Z	 d   Z
 d d  Z e d    Z RS(   s'   Base class for column *default* values.t   default_generatorc         C@  s   | |  _  d  S(   N(   R   (   R   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRX     s    c         C@  s1   | |  _  |  j r! |  |  j  _ n |  |  j  _ d  S(   N(   R   R   R   R   (   R   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR     s    		c         K@  s+   | d  k r t |   } n  | j |  |  S(   N(   R   R	   R   (   R   Rt   R(   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   execute"  s    c         C@  s-   t  |  d d  d k	 r% |  j j j Sd Sd S(   s4   Return the connectable associated with this default.R   N(   R   R   R   R;   Rt   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRt   '  s    N(   R3   R4   R5   R6   RF   t   is_sequencet   is_server_defaultR   R   RX   R   R  R7   Rt   (    (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR    s   	R   c           B@  st   e  Z d  Z d   Z e j d    Z e j d    Z e j d    Z d   Z	 d   Z
 e e
  Z d   Z RS(   s  A plain default value on a column.

    This could correspond to a constant, a callable function,
    or a SQL clause.

    :class:`.ColumnDefault` is generated automatically
    whenever the ``default``, ``onupdate`` arguments of
    :class:`.Column` are used.  A :class:`.ColumnDefault`
    can be passed positionally as well.

    For example, the following::

        Column('foo', Integer, default=50)

    Is equivalent to::

        Column('foo', Integer, ColumnDefault(50))


    c         K@  se   t  t |   j |   t | t  r7 t j d   n  t j |  rX |  j	 |  } n  | |  _
 d S(   sj  "Construct a new :class:`.ColumnDefault`.


        :param arg: argument representing the default value.
         May be one of the following:

         * a plain non-callable Python value, such as a
           string, integer, boolean, or other simple type.
           The default value will be used as is each time.
         * a SQL expression, that is one which derives from
           :class:`.ColumnElement`.  The SQL expression will
           be rendered into the INSERT or UPDATE statement,
           or in the case of a primary key column when
           RETURNING is not used may be
           pre-executed before an INSERT within a SELECT.
         * A Python callable.  The function will be invoked for each
           new row subject to an INSERT or UPDATE.
           The callable must accept exactly
           zero or one positional arguments.  The one-argument form
           will receive an instance of the :class:`.ExecutionContext`,
           which provides contextual information as to the current
           :class:`.Connection` in use as well as the current
           statement and parameters.

        s4   ColumnDefault may not be a server-side default type.N(   R`   R   RX   R   R   R   RH   R   t   callablet   _maybe_wrap_callablet   arg(   R   R  R(   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRX   F  s    c         C@  s   t  j |  j  S(   N(   R   R  R  (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   is_callableh  s    c         C@  s   t  |  j t  S(   N(   R   R  R   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   is_clause_elementl  s    c         C@  s   |  j  o |  j o |  j S(   N(   R   R!  R  (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt	   is_scalarp  s    

c         @  s   y t  j   d t } Wn t k
 r6   f d   SX| d d k	 rW t | d  pZ d } t | d  | } | d k r   f d   S| d k r   St j d   d S(	   s   Wrap callables that don't accept a context.

        This is to allow easy compatibility with default callables
        that aren't specific to accepting of a context.

        t   no_selfc         @  s       S(   N(    (   t   ctx(   Ro   (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRw     s    i   i    c         @  s       S(   N(    (   R$  (   Ro   (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRw     s    i   sD   ColumnDefault Python function takes zero or one positional argumentsN(   R   t   get_callable_argspecRi   RC   R   R   R   RH   (   R   Ro   t   argspect	   defaultedt   positionals(    (   Ro   s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR  v  s    &c         C@  s   |  j  r d Sd Sd  S(   Nt   column_onupdatet   column_default(   R   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   _visit_name  s    	c         C@  s   d |  j  S(   Ns   ColumnDefault(%r)(   R  (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR+     s    (   R3   R4   R5   RX   R   R9   R   R!  R"  R  R+  R7   R6   R+   (    (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   0  s   	"		R   c        	   B@  s   e  Z d  Z d Z e Z d d d e d d d e d  Z e	 j
 d    Z e	 j
 d    Z e	 j d  d    Z d   Z d   Z d	   Z e d
    Z d e d  Z d e d  Z d   Z RS(   s  Represents a named database sequence.

    The :class:`.Sequence` object represents the name and configurational
    parameters of a database sequence.   It also represents
    a construct that can be "executed" by a SQLAlchemy :class:`.Engine`
    or :class:`.Connection`, rendering the appropriate "next value" function
    for the target database and returning a result.

    The :class:`.Sequence` is typically associated with a primary key column::

        some_table = Table(
            'some_table', metadata,
            Column('id', Integer, Sequence('some_table_seq'),
            primary_key=True)
        )

    When CREATE TABLE is emitted for the above :class:`.Table`, if the
    target platform supports sequences, a CREATE SEQUENCE statement will
    be emitted as well.   For platforms that don't support sequences,
    the :class:`.Sequence` construct is ignored.

    .. seealso::

        :class:`.CreateSequence`

        :class:`.DropSequence`

    t   sequencec
   
      C@  s   t  t |   j d |	  t | |  |  _ | |  _ | |  _ | |  _ | d k	 rz | d k rz | j	 rz | j	 |  _	 } n t | |  |  _	 | |  _
 t | |  |  _ | r |  j |  n  d S(   s,  Construct a :class:`.Sequence` object.

        :param name: The name of the sequence.
        :param start: the starting index of the sequence.  This value is
         used when the CREATE SEQUENCE command is emitted to the database
         as the value of the "START WITH" clause.   If ``None``, the
         clause is omitted, which on most platforms indicates a starting
         value of 1.
        :param increment: the increment value of the sequence.  This
         value is used when the CREATE SEQUENCE command is emitted to
         the database as the value of the "INCREMENT BY" clause.  If ``None``,
         the clause is omitted, which on most platforms indicates an
         increment of 1.
        :param schema: Optional schema name for the sequence, if located
         in a schema other than the default.
        :param optional: boolean value, when ``True``, indicates that this
         :class:`.Sequence` object only needs to be explicitly generated
         on backends that don't provide another way to generate primary
         key identifiers.  Currently, it essentially means, "don't create
         this sequence on the Postgresql backend, where the SERIAL keyword
         creates a sequence for us automatically".
        :param quote: boolean value, when ``True`` or ``False``, explicitly
         forces quoting of the schema name on or off.  When left at its
         default of ``None``, normal quoting rules based on casing and
         reserved words take place.
        :param quote_schema: set the quoting preferences for the ``schema``
         name.
        :param metadata: optional :class:`.MetaData` object which will be
         associated with this :class:`.Sequence`.  A :class:`.Sequence`
         that is associated with a :class:`.MetaData` gains access to the
         ``bind`` of that :class:`.MetaData`, meaning the
         :meth:`.Sequence.create` and :meth:`.Sequence.drop` methods will
         make usage of that engine automatically.

         .. versionchanged:: 0.7
             Additionally, the appropriate CREATE SEQUENCE/
             DROP SEQUENCE DDL commands will be emitted corresponding to this
             :class:`.Sequence` when :meth:`.MetaData.create_all` and
             :meth:`.MetaData.drop_all` are invoked.

         Note that when a :class:`.Sequence` is applied to a :class:`.Column`,
         the :class:`.Sequence` is automatically associated with the
         :class:`.MetaData` object of that column's parent :class:`.Table`,
         when that association is made.   The :class:`.Sequence` will then
         be subject to automatic CREATE SEQUENCE/DROP SEQUENCE corresponding
         to when the :class:`.Table` object itself is created or dropped,
         rather than that of the :class:`.MetaData` object overall.
        :param for_update: Indicates this :class:`.Sequence`, when associated
         with a :class:`.Column`, should be invoked for UPDATE statements
         on that column's table, rather than for INSERT statements, when
         no value is otherwise present for that column in the statement.

        R   N(   R`   R   RX   R   R   t   startt	   incrementt   optionalR   R   RT   R   t   _keyt   _set_metadata(
   R   R   R-  R.  R   R/  R,   RT   RW   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRX     s    9			!	c         C@  s   t  S(   N(   RF   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR     s    c         C@  s   t  S(   N(   RF   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR!    s    s   sqlalchemy.sql.functions.funcc         C@  s   | j  |  d |  j S(   s   Return a :class:`.next_value` function element
        which will render the appropriate increment function
        for this :class:`.Sequence` within any SQL expression.

        Rt   (   t
   next_valueRt   (   R   t   func(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR2  
  s    c         C@  s*   t  t |   j |  | j |  j  d  S(   N(   R`   R   R   R   R  (   R   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR     s    c         C@  s   |  j  | j  d  S(   N(   R1  RT   (   R   R   R;   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR    s    c         C@  s    | |  _  |  |  j  j |  j <d  S(   N(   RT   t
   _sequencesR0  (   R   RT   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR1    s    	c         C@  s   |  j  r |  j  j Sd  Sd  S(   N(   RT   Rt   R   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRt     s    	
c         C@  s8   | d k r t |   } n  | j t j |  d | d S(   s&   Creates this sequence in the database.R   N(   R   R	   R   R   R   (   R   Rt   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   %  s
    c         C@  s8   | d k r t |   } n  | j t j |  d | d S(   s&   Drops this sequence from the database.R   N(   R   R	   R   R   R   (   R   Rt   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   .  s
    c         C@  s   t  j d |  j j   d  S(   Ns   This %s cannot be used directly as a column expression.  Use func.next_value(sequence) to produce a 'next value' function that's usable as a column element.(   R   RK   R   R3   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR  7  s    N(   R3   R4   R5   R6   Ri   R  R   RF   RX   R   R9   R   R!  t   dependenciesR2  R   R  R1  R7   Rt   R   R   R  (    (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR     s"   		D						R   c           B@  sP   e  Z d  Z e Z e Z e Z e d  Z d   Z	 d   Z
 d   Z d   Z RS(   s  A marker for a transparent database-side default.

    Use :class:`.FetchedValue` when the database is configured
    to provide some automatic default for a column.

    E.g.::

        Column('foo', Integer, FetchedValue())

    Would indicate that some trigger or default generator
    will create a new value for the ``foo`` column during an
    INSERT.

    .. seealso::

        :ref:`triggered_columns`

    c         C@  s   | |  _  d  S(   N(   R   (   R   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRX   X  s    c         C@  s$   | |  j  k r |  S|  j |  Sd  S(   N(   R   t   _clone(   R   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   [  s    c         C@  sH   |  j  j |  j   } | j j |  j  | j j d d   | | _ | S(   NR   (   R   RA   R.   t   updateRE   R   R   (   R   R   t   n(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR6  a  s
    	c         C@  s1   | |  _  |  j r! |  |  j  _ n |  |  j  _ d  S(   N(   R   R   R   R   (   R   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   h  s    		c         C@  s   t  j |   S(   N(   R   R*   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR+   o  s    (   R3   R4   R5   Ri   R  RF   R   t   has_argumentRX   R   R6  R   R+   (    (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   @  s   			R   c           B@  s,   e  Z d  Z e Z e e d  Z d   Z RS(   s7  A DDL-specified DEFAULT column value.

    :class:`.DefaultClause` is a :class:`.FetchedValue`
    that also generates a "DEFAULT" clause when
    "CREATE TABLE" is emitted.

    :class:`.DefaultClause` is generated automatically
    whenever the ``server_default``, ``server_onupdate`` arguments of
    :class:`.Column` are used.  A :class:`.DefaultClause`
    can be passed positionally as well.

    For example, the following::

        Column('foo', Integer, server_default="50")

    Is equivalent to::

        Column('foo', Integer, DefaultClause("50"))

    c         C@  sO   t  j | t  j d t t f d  t t |   j |  | |  _ | |  _	 d  S(   Ni    R  (
   R   t   assert_arg_typeR   R   R   R`   R   RX   R  R   (   R   R  R   t
   _reflected(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRX     s    	c         C@  s   d |  j  |  j f S(   Ns    DefaultClause(%r, for_update=%r)(   R  R   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR+     s    (   R3   R4   R5   Ri   R9  RF   RX   R+   (    (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   s  s   t   PassiveDefaultc           B@  s,   e  Z d  Z e j d d e  d    Z RS(   s   A DDL-specified DEFAULT column value.

    .. deprecated:: 0.6
        :class:`.PassiveDefault` is deprecated.
        Use :class:`.DefaultClause`.
    s   0.6sE   :class:`.PassiveDefault` is deprecated.  Use :class:`.DefaultClause`.c         O@  s   t  j |  | |  d  S(   N(   R   RX   (   R   R  RS   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRX     s    (   R3   R4   R5   R   R8   RF   RX   (    (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR<    s   	t
   Constraintc           B@  sJ   e  Z d  Z d Z d d d d d  Z e d    Z d   Z d   Z	 RS(   s   A table-level SQL constraint.R   c         K@  sB   | |  _  | |  _ | |  _ | |  _ t j |   |  j |  d S(   sC  Create a SQL constraint.

        :param name:
          Optional, the in-database name of this ``Constraint``.

        :param deferrable:
          Optional bool.  If set, emit DEFERRABLE or NOT DEFERRABLE when
          issuing DDL for this constraint.

        :param initially:
          Optional string.  If set, emit INITIALLY <value> when issuing DDL
          for this constraint.

        :param _create_rule:
          a callable which is passed the DDLCompiler object during
          compilation. Returns True or False to signal inline generation of
          this Constraint.

          The AddConstraint and DropConstraint DDL constructs provide
          DDLElement's more comprehensive "conditional DDL" approach that is
          passed a database connection when DDL is being issued. _create_rule
          is instead called during any CREATE TABLE compilation, where there
          may not be any transaction/connection in progress. However, it
          allows conditional compilation of the constraint even for backends
          which do not support addition of constraints through ALTER TABLE,
          which currently includes SQLite.

          _create_rule is used by some types to create constraints.
          Currently, its call signature is subject to change at any time.

        :param \**dialect_kw:  Additional keyword arguments are dialect
            specific, and passed in the form ``<dialectname>_<argname>``.  See
            the documentation regarding an individual dialect at
            :ref:`dialect_toplevel` for detail on documented arguments.

        N(   R   R   R   t   _create_ruleR   R   R{   (   R   R   R   R   R>  R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRX     s    (				c         C@  sD   y t  |  j t  r |  j SWn t k
 r0 n Xt j d   d  S(   Nsd   This constraint is not bound to a table.  Did you mean to call table.append_constraint(constraint) ?(   R   R   R:   t   AttributeErrorR   RK   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR;     s    c         C@  s   | |  _  | j j |   d  S(   N(   R   Rc   R   (   R   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR     s    	c         K@  s   t     d  S(   N(   t   NotImplementedError(   R   RS   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR/     s    N(
   R3   R4   R5   R6   R   RX   R7   R;   R   R/   (    (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR=    s   	.	c         C@  sC   t  |  d  r |  j   }  n  t |  t  s? t j d   n  |  S(   NR   s   schema.Column object expected(   R   R   R   R   R   RH   (   t   element(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   _to_schema_column  s
    c         C@  sW   t  |  d  r |  j   }  n  t |  t j t f  sS d } t j | |    n  |  S(   NR   s1   Element %r is not a string name or column element(   R   R   R   R   R   R   R   RH   (   RA  RU   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   _to_schema_column_or_string  s    t   ColumnCollectionMixinc           B@  s   e  Z d    Z d   Z RS(   c         G@  s   t    |  _ g  | D] } t |  ^ q |  _ |  j r t |  j d t  r t |  j d j t  r |  j |  j d j  n  d  S(   Ni    (	   R
   R   RC  t   _pending_colargsR   R   R;   R:   R$   (   R   R   Rv   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRX    	  s    	c         C@  sJ   xC |  j  D]8 } t | t j  r2 | j | } n  |  j j |  q
 Wd  S(   N(   RE  R   R   R   Rv   R   R   (   R   R;   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   		  s    (   R3   R4   RX   R   (    (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRD    s   		t   ColumnCollectionConstraintc           B@  sM   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   s-   A constraint that proxies a ColumnCollection.c         O@  s$   t  j |  |  t j |  |  d S(   sZ  
        :param \*columns:
          A sequence of column names or Column objects.

        :param name:
          Optional, the in-database name of this constraint.

        :param deferrable:
          Optional bool.  If set, emit DEFERRABLE or NOT DEFERRABLE when
          issuing DDL for this constraint.

        :param initially:
          Optional string.  If set, emit INITIALLY <value> when issuing DDL
          for this constraint.

        :param \**kw: other keyword arguments including dialect-specific
          arguments are propagated to the :class:`.Constraint` superclass.

        N(   R=  RX   RD  (   R   R   RS   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRX   	  s    c         C@  s$   t  j |  |  t j |  |  d  S(   N(   R=  R   RD  (   R   R;   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   *	  s    c         C@  s   | |  j  k S(   N(   R   (   R   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   __contains__.	  s    c         K@  s@   |  j  d |  j d |  j d |  j |  j j    } |  j |  S(   NR   R   R   (   R   R   R   R   R   R   R2   (   R   RS   Rv   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR/   1	  s    c         C@  s   |  j  j |  S(   N(   R   t   contains_column(   R   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRH  6	  s    c         @  s#   |  j  j     f d     j D S(   Nc         3@  s   |  ] }   | Vq d  S(   N(    (   t   .0RV   (   t   ordered_dict(    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pys	   <genexpr>>	  s    (   R   t   _datat   _list(   R   (    (   RJ  s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   __iter__9	  s    c         C@  s   t  |  j j  S(   N(   R   R   RK  (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   __len__@	  s    (
   R3   R4   R5   RX   R   RG  R/   RH  RM  RN  (    (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRF  	  s   						t   CheckConstraintc           B@  sJ   e  Z d  Z d d d d d e d  Z d   Z e e  Z d d  Z RS(   sl   A table- or column-level CHECK constraint.

    Can be included in the definition of a Table or Column.
    c         C@  s   t  t |   j | | | |  t |  |  _ | d k	 rJ |  j |  nt | r t |  j  } t g  | D]! }	 t	 |	 j
 t  ri |	 j
 ^ qi  }
 t |
  d k r |  j |
 j    q n  d S(   s  Construct a CHECK constraint.

        :param sqltext:
          A string containing the constraint definition, which will be used
          verbatim, or a SQL expression construct.   If given as a string,
          the object is converted to a :class:`.Text` object.   If the textual
          string includes a colon character, escape this using a backslash::

            CheckConstraint(r"foo ~ E'a(?\:b|c)d")

        :param name:
          Optional, the in-database name of the constraint.

        :param deferrable:
          Optional bool.  If set, emit DEFERRABLE or NOT DEFERRABLE when
          issuing DDL for this constraint.

        :param initially:
          Optional string.  If set, emit INITIALLY <value> when issuing DDL
          for this constraint.

        i   N(   R`   RO  RX   R   t   sqltextR   R$   R   Ra   R   R;   R:   R   RE   (   R   RP  R   R   R   R;   R>  t   _autoattacht   colsRv   RI   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRX   J	  s    $c         C@  s   t  |  j t  r d Sd Sd  S(   Nt   check_constraintt   column_check_constraint(   R   R   R:   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR6   q	  s    c         @  s    d  k	 r9    f d   } t j   j i  |  } n	   j } t | d   j d   j d   j d   j d  d t	 }   j
 |  S(   Nc         @  s+     j  j j |   r#  j |  j Sd  Sd  S(   N(   R;   Rv   RH  RV   R   (   R   (   R   R   (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   z	  s    R   R   R   R>  R;   RQ  (   R   R   t   replacement_traverseRP  RO  R   R   R   R>  RF   R2   (   R   R   RS   R   RP  Rv   (    (   R   R   s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR/   x	  s    							N(	   R3   R4   R5   R   Ri   RX   R6   R7   R/   (    (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRO  D	  s   	%	R   c        
   B@  s   e  Z d  Z d Z d
 d
 d
 d
 d
 e e d
 d
 d 	 Z e d    Z d   Z	 e d    Z
 e d    Z e d    Z d   Z d
 d	  Z RS(   s  A table-level FOREIGN KEY constraint.

    Defines a single column or composite FOREIGN KEY ... REFERENCES
    constraint. For a no-frills, single column foreign key, adding a
    :class:`.ForeignKey` to the definition of a :class:`.Column` is a
    shorthand equivalent for an unnamed, single column
    :class:`.ForeignKeyConstraint`.

    Examples of foreign key configuration are in :ref:`metadata_foreignkeys`.

    t   foreign_key_constraintc         K@  sl  t  t |   j | | | |  | |  _ | |  _ |	 |  _ |  j d k ra | ra t j	 d   n  | |  _
 |
 |  _ t j   |  _ x t | |  D]s \ } } t | d |  d |  j d |  j d |  j d |  j
 d |  j d |  j d	 |  j d
 |  j |  j 	|  j | <q W| d k	 r%|  j |  nC | rht | d t  rh| d j d k	 rh|  j | d j  n  d S(   s	  Construct a composite-capable FOREIGN KEY.

        :param columns: A sequence of local column names. The named columns
          must be defined and present in the parent Table. The names should
          match the ``key`` given to each column (defaults to the name) unless
          ``link_to_name`` is True.

        :param refcolumns: A sequence of foreign column names or Column
          objects. The columns must all be located within the same Table.

        :param name: Optional, the in-database name of the key.

        :param onupdate: Optional string. If set, emit ON UPDATE <value> when
          issuing DDL for this constraint. Typical values include CASCADE,
          DELETE and RESTRICT.

        :param ondelete: Optional string. If set, emit ON DELETE <value> when
          issuing DDL for this constraint. Typical values include CASCADE,
          DELETE and RESTRICT.

        :param deferrable: Optional bool. If set, emit DEFERRABLE or NOT
          DEFERRABLE when issuing DDL for this constraint.

        :param initially: Optional string. If set, emit INITIALLY <value> when
          issuing DDL for this constraint.

        :param link_to_name: if True, the string name given in ``column`` is
          the rendered name of the referenced column, not its locally assigned
          ``key``.

        :param use_alter: If True, do not emit the DDL for this constraint as
          part of the CREATE TABLE definition. Instead, generate it via an
          ALTER TABLE statement issued after the full collection of tables
          have been created, and drop it via an ALTER TABLE statement before
          the full collection of tables are dropped. This is shorthand for the
          usage of :class:`.AddConstraint` and :class:`.DropConstraint`
          applied as "after-create" and "before-drop" events on the MetaData
          object.  This is normally used to generate/drop constraints on
          objects that are mutually dependent on each other.

        :param match: Optional string. If set, emit MATCH <value> when issuing
          DDL for this constraint. Typical values include SIMPLE, PARTIAL
          and FULL.

        :param \**dialect_kw:  Additional keyword arguments are dialect
          specific, and passed in the form ``<dialectname>_<argname>``.  See
          the documentation regarding an individual dialect at
          :ref:`dialect_toplevel` for detail on documented arguments.

            .. versionadded:: 0.9.2

        s$   Alterable Constraint requires a nameR   R   R   R   R   R   R   R   R   i    N(   R`   R   RX   R   R   R   R   R   R   RH   R   R   R   t   OrderedDictR  t   zipR   R   R   t   dialect_kwargsR$   R   R   R;   (   R   R   t
   refcolumnsR   R   R   R   R   R   R   R   R;   R   R   t   refcol(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRX   	  s:    8												c         C@  s&   x |  j  j   D]
 } | j SWd  Sd  S(   N(   R  t   valuesR   R   (   R   t   elem(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   	  s    c         C@  s   t  g  |  j j   D] } | j   ^ q  } d  | k r t |  d k r t |  d d !\ } } t j d | j	 |  j
 | | f   n  d  S(   Ni   i    i   sJ   ForeignKeyConstraint on %s(%s) refers to multiple remote tables: %s and %s(   Ra   R  R\  R   R   R   Rx   R   RH   Rh   t   _col_description(   R   R;   R]  t
   table_keyst   elem0t   elem1(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   
  s    (c         C@  s   d j  |  j  S(   Ns   , (   R   R  (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR^  
  s    c         C@  s   t  |  j  S(   N(   R   R  (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   
  s    c         C@  s   t  |  j j    S(   N(   R   R  R\  (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   elements
  s    c         @  s1  t  t |   j    |  j    x |  j j   D] \ } } t | t j  r y   j	 | } Wq t
 k
 r t j d   j | f   q Xn  t | d  s | j | k	 r3 | j |  q3 q3 W|  j r-  f d   } t j   j d t j |  d |  t j   j d t j |  d |  n  d  S(   NsQ   Can't create ForeignKeyConstraint on table '%s': no column named '%s' is present.R   c         @  s      t  | d  k o | j j S(   NRI   (   Ra   Rq   t   supports_alter(   R   R   R   Rt   RS   (   R;   (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRc  0
  s    t   after_createt   ont   before_drop(   R`   R   R   R  R  t   itemsR   R   R   Rv   t   KeyErrorR   RH   R   R   R   R$   R   R   Rj   RT   R   t   AddConstraintt   DropConstraint(   R   R;   R   R   Rc  (    (   R;   s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   
  s&    	c         K@  s   t  g  |  j j   D] } | j j ^ q g  |  j j   D] } | j d |  ^ q8 d |  j d |  j d |  j d |  j	 d |  j
 d |  j d |  j d	 |  j } x< t |  j j   | j j    D] \ } } | j |  q W|  j |  S(
   NR   R   R   R   R   R   R   R   R   (   R   R  R\  R   RV   R   R   R   R   R   R   R   R   R   RX  R2   (   R   R   RS   R   t   fkct   self_fkt   other_fk(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR/   9
  s"    %+							N(   R3   R4   R5   R6   R   RF   RX   R7   R   R  R^  R   Rb  R   R/   (    (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   	  s   		\		Re   c           B@  s/   e  Z d  Z d Z d   Z d   Z d   Z RS(   s  A table-level PRIMARY KEY constraint.

    The :class:`.PrimaryKeyConstraint` object is present automatically
    on any :class:`.Table` object; it is assigned a set of
    :class:`.Column` objects corresponding to those marked with
    the :paramref:`.Column.primary_key` flag::

        >>> my_table = Table('mytable', metadata,
        ...                 Column('id', Integer, primary_key=True),
        ...                 Column('version_id', Integer, primary_key=True),
        ...                 Column('data', String(50))
        ...     )
        >>> my_table.primary_key
        PrimaryKeyConstraint(
            Column('id', Integer(), table=<mytable>,
                   primary_key=True, nullable=False),
            Column('version_id', Integer(), table=<mytable>,
                   primary_key=True, nullable=False)
        )

    The primary key of a :class:`.Table` can also be specified by using
    a :class:`.PrimaryKeyConstraint` object explicitly; in this mode of usage,
    the "name" of the constraint can also be specified, as well as other
    options which may be recognized by dialects::

        my_table = Table('mytable', metadata,
                    Column('id', Integer),
                    Column('version_id', Integer),
                    Column('data', String(50)),
                    PrimaryKeyConstraint('id', 'version_id',
                                         name='mytable_pk')
                )

    The two styles of column-specification should generally not be mixed.
    An warning is emitted if the columns present in the
    :class:`.PrimaryKeyConstraint`
    don't match the columns that were marked as ``primary_key=True``, if both
    are present; in this case, the columns are taken strictly from the
    :class:`.PrimaryKeyConstraint` declaration, and those columns otherwise
    marked as ``primary_key=True`` are ignored.  This behavior is intended to
    be backwards compatible with previous behavior.

    .. versionchanged:: 0.9.2  Using a mixture of columns within a
       :class:`.PrimaryKeyConstraint` in addition to columns marked as
       ``primary_key=True`` now emits a warning if the lists don't match.
       The ultimate behavior of ignoring those columns marked with the flag
       only is currently maintained for backwards compatibility; this warning
       may raise an exception in a future release.

    For the use case where specific options are to be specified on the
    :class:`.PrimaryKeyConstraint`, but the usual style of using
    ``primary_key=True`` flags is still desirable, an empty
    :class:`.PrimaryKeyConstraint` may be specified, which will take on the
    primary key column collection from the :class:`.Table` based on the
    flags::

        my_table = Table('mytable', metadata,
                    Column('id', Integer, primary_key=True),
                    Column('version_id', Integer, primary_key=True),
                    Column('data', String(50)),
                    PrimaryKeyConstraint(name='mytable_pk',
                                         mssql_clustered=True)
                )

    .. versionadded:: 0.9.2 an empty :class:`.PrimaryKeyConstraint` may now
       be specified for the purposes of establishing keyword arguments with
       the constraint, independently of the specification of "primary key"
       columns within the :class:`.Table` itself; columns marked as
       ``primary_key=True`` will be gathered into the empty constraint's
       column collection.

    t   primary_key_constraintc      
   C@  sL  t  t |   j |  | j |  k	 rT | j j | j  |  | _ | j j |   n  g  | j D] } | j r^ | ^ q^ } |  j r| rt	 |  t	 |  j j
    k rt j d | j d j d   | D  d j d   |  j D  d j d   |  j D  f  g  | (n  x# |  j D] } t | _ t | _ qW|  j j |  d  S(   Ns   Table '%s' specifies columns %s as primary_key=True, not matching locally specified columns %s; setting the current primary key columns to %s. This warning may become an exception in a future releases   , c         s@  s   |  ] } d  | j  Vq d S(   s   '%s'N(   R   (   RI  Rv   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pys	   <genexpr>
  s    c         s@  s   |  ] } d  | j  Vq d S(   s   '%s'N(   R   (   RI  Rv   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pys	   <genexpr>
  s    c         s@  s   |  ] } d  | j  Vq d S(   s   '%s'N(   R   (   RI  Rv   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pys	   <genexpr>
  s    (   R`   Re   R   R~   Rc   t   discardR   Rv   R   Ra   R\  R   R   R   R   Ri   RF   R   t   extend(   R   R;   Rv   t	   table_pks(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   
  s&    	%!!
	c         C@  s>   x | D] } t  | _ q W|  j j |  |  j |  j  d S(   sD  repopulate this :class:`.PrimaryKeyConstraint` given
        a set of columns.

        Existing columns in the table that are marked as primary_key=True
        are maintained.

        Also fires a new event.

        This is basically like putting a whole new
        :class:`.PrimaryKeyConstraint` object on the parent
        :class:`.Table` object without actually replacing the object.

        The ordering of the given list of columns is also maintained; these
        columns will be appended to the list of columns after any which
        are already present.

        N(   Ri   R~   R   Rp  R$   R;   (   R   R   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   _reload
  s    c         C@  s   |  j  j |  d  S(   N(   R   R   (   R   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   
  s    (   R3   R4   R5   R6   R   Rr  R   (    (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRe   N
  s
   H		R   c           B@  s   e  Z d  Z d Z RS(   s  A table-level UNIQUE constraint.

    Defines a single column or composite UNIQUE constraint. For a no-frills,
    single column constraint, adding ``unique=True`` to the ``Column``
    definition is a shorthand equivalent for an unnamed, single column
    UniqueConstraint.
    t   unique_constraint(   R3   R4   R5   R6   (    (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   
  s   R   c           B@  sV   e  Z d  Z d Z d   Z d   Z e d    Z d d  Z	 d d  Z
 d   Z RS(	   s	  A table-level INDEX.

    Defines a composite (one or more column) INDEX.

    E.g.::

        sometable = Table("sometable", metadata,
                        Column("name", String(50)),
                        Column("address", String(100))
                    )

        Index("some_index", sometable.c.name)

    For a no-frills, single column index, adding
    :class:`.Column` also supports ``index=True``::

        sometable = Table("sometable", metadata,
                        Column("name", String(50), index=True)
                    )

    For a composite index, multiple columns can be specified::

        Index("some_index", sometable.c.name, sometable.c.address)

    Functional indexes are supported as well, typically by using the
    :data:`.func` construct in conjunction with table-bound
    :class:`.Column` objects::

        Index("some_index", func.lower(sometable.c.name))

    .. versionadded:: 0.8 support for functional and expression-based indexes.

    An :class:`.Index` can also be manually associated with a :class:`.Table`,
    either through inline declaration or using
    :meth:`.Table.append_constraint`.  When this approach is used, the names
    of the indexed columns can be specified as strings::

        Table("sometable", metadata,
                        Column("name", String(50)),
                        Column("address", String(100)),
                        Index("some_index", "name", "address")
                )

    To support functional or expression-based indexes in this form, the
    :func:`.text` construct may be used::

        from sqlalchemy import text

        Table("sometable", metadata,
                        Column("name", String(50)),
                        Column("address", String(100)),
                        Index("some_index", text("lower(name)"))
                )

    .. versionadded:: 0.9.5 the :func:`.text` construct may be used to
       specify :class:`.Index` expressions, provided the :class:`.Index`
       is explicitly associated with the :class:`.Table`.


    .. seealso::

        :ref:`schema_indexes` - General information on :class:`.Index`.

        :ref:`postgresql_indexes` - PostgreSQL-specific options available for
        the :class:`.Index` construct.

        :ref:`mysql_indexes` - MySQL-specific options available for the
        :class:`.Index` construct.

        :ref:`mssql_indexes` - MSSQL-specific options available for the
        :class:`.Index` construct.

    R   c         O@  s   d |  _ g  } xj | D]b } t | t  s; | j |  q g  } t j | i  i | j d 6 | r | j | d  q q W| |  _ t | | j	 d d   |  _
 | j	 d t  |  _ |  j |  t j |  |  d S(   s  Construct an index object.

        :param name:
          The name of the index

        :param \*expressions:
          Column expressions to include in the index.   The expressions
          are normally instances of :class:`.Column`, but may also
          be arbitrary SQL expressions which ultimately refer to a
          :class:`.Column`.

        :param unique=False:
            Keyword only argument; if True, create a unique index.

        :param quote=None:
            Keyword only argument; whether to apply quoting to the name of
            the index.  Works in the same manner as that of
            :paramref:`.Column.quote`.

        :param \**kw: Additional keyword arguments not mentioned above are
            dialect specific, and passed in the form
            ``<dialectname>_<argname>``. See the documentation regarding an
            individual dialect at :ref:`dialect_toplevel` for detail on
            documented arguments.

        R   i    R,   R   N(   R   R;   R   R   R   R   t   traverset   expressionsR   RE   R   RF   R   R{   RD  RX   (   R   R   Ru  RS   R   t   exprRR  (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRX   2  s    		c         C@  s  t  j |  |  |  j d  k	 rY | |  j k	 rY t j d |  j |  j j | j f   n  | |  _ xE |  j D]: } | j |  j k rl t j d | |  j j f   ql ql W| j	 j
 |   g  t j |  j |  j  D]' \ } } t | t  r | n | ^ q |  _ d  S(   NsK   Index '%s' is against table '%s', and cannot be associated with table '%s'.s&   Column '%s' is not part of table '%s'.(   RD  R   R;   R   R   RH   R   R   R   Rb   R   R   t   zip_longestRu  R   R   (   R   R;   Rv   Rv  t   colexpr(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   b  s"    		c         C@  s
   |  j  j S(   s2   Return the connectable associated with this Index.(   R;   Rt   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRt   ~  s    c         C@  s2   | d k r t |   } n  | j t j |   |  S(   s   Issue a ``CREATE`` statement for this
        :class:`.Index`, using the given :class:`.Connectable`
        for connectivity.

        .. seealso::

            :meth:`.MetaData.create_all`.

        N(   R   R	   R   R   R   (   R   Rt   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR     s    
c         C@  s2   | d k r t |   } n  | j t j |   d S(   s   Issue a ``DROP`` statement for this
        :class:`.Index`, using the given :class:`.Connectable`
        for connectivity.

        .. seealso::

            :meth:`.MetaData.drop_all`.

        N(   R   R	   R   R   R   (   R   Rt   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR     s    
c         C@  sS   d d j  t |  j  g g  |  j D] } t |  ^ q" |  j rJ d g pM g   S(   Ns	   Index(%s)s   , s   unique=True(   R   R   R   Ru  R   (   R   t   e(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR+     s    /N(   R3   R4   R5   R6   RX   R   R7   Rt   R   R   R   R+   (    (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   
  s   I	0	s   ix_%(column_0_label)st   ixt   MetaDatac           B@  s
  e  Z d  Z d Z d e d d e d  Z d Z d   Z	 d   Z
 d   Z d   Z d   Z d   Z d	   Z d
   Z e j d  d    Z e e e  Z d   Z d   Z e d    Z d d e d e e d  Z d   Z d d e d  Z d d e d  Z RS(   s  A collection of :class:`.Table` objects and their associated schema
    constructs.

    Holds a collection of :class:`.Table` objects as well as
    an optional binding to an :class:`.Engine` or
    :class:`.Connection`.  If bound, the :class:`.Table` objects
    in the collection and their columns may participate in implicit SQL
    execution.

    The :class:`.Table` objects themselves are stored in the
    :attr:`.MetaData.tables` dictionary.

    :class:`.MetaData` is a thread-safe object for read operations.
    Construction of new tables within a single :class:`.MetaData` object,
    either explicitly or via reflection, may not be completely thread-safe.

    .. seealso::

        :ref:`metadata_describing` - Introduction to database metadata

    RT   c         C@  s   t  j   |  _ t | |  |  _ | |  _ t   |  _ i  |  _ t	 j
 t  |  _ | |  _ | r t  j d  | s t j d   n  |  j   n  d S(   s  Create a new MetaData object.

        :param bind:
          An Engine or Connection to bind to.  May also be a string or URL
          instance, these are passed to create_engine() and this MetaData will
          be bound to the resulting engine.

        :param reflect:
          Optional, automatically load all tables from the bound database.
          Defaults to False. ``bind`` is required when this option is set.

          .. deprecated:: 0.8
                Please use the :meth:`.MetaData.reflect` method.

        :param schema:
           The default schema to use for the :class:`.Table`,
           :class:`.Sequence`, and other objects associated with this
           :class:`.MetaData`. Defaults to ``None``.

        :param quote_schema:
            Sets the ``quote_schema`` flag for those :class:`.Table`,
            :class:`.Sequence`, and other objects which make usage of the
            local ``schema`` name.

        :param naming_convention: a dictionary referring to values which
          will establish default naming conventions for :class:`.Constraint`
          and :class:`.Index` objects, for those objects which are not given
          a name explicitly.

          The keys of this dictionary may be:

          * a constraint or Index class, e.g. the :class:`.UniqueConstraint`,
            :class:`.ForeignKeyConstraint` class, the :class:`.Index` class

          * a string mnemonic for one of the known constraint classes;
            ``"fk"``, ``"pk"``, ``"ix"``, ``"ck"``, ``"uq"`` for foreign key,
            primary key, index, check, and unique constraint, respectively.

          * the string name of a user-defined "token" that can be used
            to define new naming tokens.

          The values associated with each "constraint class" or "constraint
          mnemonic" key are string naming templates, such as
          ``"uq_%(table_name)s_%(column_0_name)s"``,
          which describe how the name should be composed.  The values
          associated with user-defined "token" keys should be callables of the
          form ``fn(constraint, table)``, which accepts the constraint/index
          object and :class:`.Table` as arguments, returning a string
          result.

          The built-in names are as follows, some of which may only be
          available for certain types of constraint:

            * ``%(table_name)s`` - the name of the :class:`.Table` object
              associated with the constraint.

            * ``%(referred_table_name)s`` - the name of the :class:`.Table`
              object associated with the referencing target of a
              :class:`.ForeignKeyConstraint`.

            * ``%(column_0_name)s`` - the name of the :class:`.Column` at
              index position "0" within the constraint.

            * ``%(column_0_label)s`` - the label of the :class:`.Column` at
              index position "0", e.g. :attr:`.Column.label`

            * ``%(column_0_key)s`` - the key of the :class:`.Column` at
              index position "0", e.g. :attr:`.Column.key`

            * ``%(referred_column_0_name)s`` - the name of a :class:`.Column`
              at index position "0" referenced by a
              :class:`.ForeignKeyConstraint`.

            * ``%(constraint_name)s`` - a special key that refers to the
              existing name given to the constraint.  When this key is
              present, the :class:`.Constraint` object's existing name will be
              replaced with one that is composed from template string that
              uses this token. When this token is present, it is required that
              the :class:`.Constraint` is given an expicit name ahead of time.

            * user-defined: any additional token may be implemented by passing
              it along with a ``fn(constraint, table)`` callable to the
              naming_convention dictionary.

          .. versionadded:: 0.9.2

          .. seealso::

                :ref:`constraint_naming_conventions` - for detailed usage
                examples.

        s;   reflect=True is deprecate; please use the reflect() method.s8   A bind must be supplied in conjunction with reflect=TrueN(   R   t   immutabledictRI   R   R   t   naming_conventionRa   t   _schemasR4  t   collectionst   defaultdictR   R   Rt   RG   R   RH   t   reflect(   R   Rt   R  R   RW   R}  (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRX     s    `			c         C@  s   d |  j  S(   Ns   MetaData(bind=%r)(   Rt   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR+   G  s    c         C@  s+   t  | t j  s | j } n  | |  j k S(   N(   R   R   R   RV   RI   (   R   t   table_or_key(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRG  J  s    c         C@  sB   t  | |  } t j |  j | |  | r> |  j j |  n  d  S(   N(   R   t   dictt   __setitem__RI   R~  R   (   R   R   R   R;   RV   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRN   O  s    c         C@  s   t  | |  } t j |  j | d   } | d  k	 rW x! | j D] } | j |   q= Wn  |  j r t g  |  j j	   D] } | j
 d  k	 rs | j
 ^ qs  |  _ n  d  S(   N(   R   R  RE   RI   R   Rf   R  R~  Ra   R\  R   (   R   R   R   RV   t   removedR   t   t(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRQ   U  s    	c         C@  s6   i |  j  d 6|  j d 6|  j d 6|  j d 6|  j d 6S(   NRI   R   t   schemast	   sequencest   fk_memos(   RI   R   R~  R4  R   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   __getstate__`  s
    


c         C@  sN   | d |  _  | d |  _ d  |  _ | d |  _ | d |  _ | d |  _ d  S(   NRI   R   R  R  R  (   RI   R   R   t   _bindR4  R~  R   (   R   t   state(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   __setstate__g  s    	c         C@  s   |  j  d k	 S(   s:   True if this MetaData is bound to an Engine or Connection.N(   R  R   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   is_boundo  s    c         C@  s   |  j  S(   s	  An :class:`.Engine` or :class:`.Connection` to which this
        :class:`.MetaData` is bound.

        Typically, a :class:`.Engine` is assigned to this attribute
        so that "implicit execution" may be used, or alternatively
        as a means of providing engine binding information to an
        ORM :class:`.Session` object::

            engine = create_engine("someurl://")
            metadata.bind = engine

        .. seealso::

           :ref:`dbengine_implicit` - background on "bound metadata"

        (   R  (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRt   t  s    s   sqlalchemy.engine.urlc         C@  s>   t  | t j | j f  r1 t j |  |  _ n	 | |  _ d S(   s;   Bind this MetaData to an Engine, Connection, string or URL.N(   R   R   R   t   URLt
   sqlalchemyt   create_engineR  (   R   t   urlRt   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   _bind_to  s    c         C@  s.   t  j |  j  |  j j   |  j j   d S(   s+   Clear all Table objects from this MetaData.N(   R  t   clearRI   R~  R   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR    s    c         C@  s   |  j  | j | j  d S(   s1   Remove the given Table object from this MetaData.N(   RQ   R   R   (   R   R;   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRz     s    c         C@  s   t  j |  j j    S(   s  Returns a list of :class:`.Table` objects sorted in order of
        foreign key dependency.

        The sorting will place :class:`.Table` objects that have dependencies
        first, before the dependencies themselves, representing the
        order in which they can be created.   To get the order in which
        the tables would be dropped, use the ``reversed()`` Python built-in.

        .. seealso::

            :attr:`.MetaData.tables`

            :meth:`.Inspector.get_table_names`

        (   R   t   sort_tablesRI   R\  (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   sorted_tables  s    c         K@  s  | d k r t |   } n  | j   \} i t d 6| d 6| d 6| d 6}	 |	 j |  | d k rq |  j } n  | d k	 r | |	 d <n  t j | j j	 | d |  }
 | r |
 j | j
 j | |   n  | d k	 rt j g  |
 D] } d | | f ^ q  } n |
 } t |  j  } | d k rig  t |
 |  D]$ \ } } | sZ| | k r<| ^ q<} n t j |  rg  t |
 |  D]3 \ } } | s| | k r| | |   r| ^ q} n g  | D] } | |
 k r| ^ q} | r3| rd | pd	 } t j d
 | j j | d j |  f   n  g  | D] } | sR| | k r:| ^ q:} x | D] } t | |  |	  qeWWd QXd S(   sL	  Load all available table definitions from the database.

        Automatically creates ``Table`` entries in this ``MetaData`` for any
        table available in the database but not yet present in the
        ``MetaData``.  May be called multiple times to pick up tables recently
        added to the database, however no special action is taken if a table
        in this ``MetaData`` no longer exists in the database.

        :param bind:
          A :class:`.Connectable` used to access the database; if None, uses
          the existing bind on this ``MetaData``, if any.

        :param schema:
          Optional, query and reflect tables from an alterate schema.
          If None, the schema associated with this :class:`.MetaData`
          is used, if any.

        :param views:
          If True, also reflect views.

        :param only:
          Optional.  Load only a sub-set of available named tables.  May be
          specified as a sequence of names or a callable.

          If a sequence of names is provided, only those tables will be
          reflected.  An error is raised if a table is requested but not
          available.  Named tables already present in this ``MetaData`` are
          ignored.

          If a callable is provided, it will be used as a boolean predicate to
          filter the list of potential table names.  The callable is called
          with a table name and this ``MetaData`` instance as positional
          arguments and should return a true value for any table to reflect.

        :param extend_existing: Passed along to each :class:`.Table` as
          :paramref:`.Table.extend_existing`.

          .. versionadded:: 0.9.1

        :param autoload_replace: Passed along to each :class:`.Table` as
          :paramref:`.Table.autoload_replace`.

          .. versionadded:: 0.9.1

        :param \**dialect_kwargs: Additional keyword arguments not mentioned
         above are dialect specific, and passed in the form
         ``<dialectname>_<argname>``.  See the documentation regarding an
         individual dialect at :ref:`dialect_toplevel` for detail on
         documented arguments.

          .. versionadded:: 0.9.2 - Added
             :paramref:`.MetaData.reflect.**dialect_kwargs` to support
             dialect-level reflection options for all :class:`.Table`
             objects reflected.

        RY   RZ   R=   R[   R   R    s   %s.%ss    schema '%s'R   sA   Could not reflect: requested table(s) not available in %s%s: (%s)s   , N(   R   R	   t   connectRi   R7  R   R   t
   OrderedSett   enginet   table_namesRq   t   get_view_namesRa   RI   RX  R  R   RK   R  R   R:   (   R   Rt   R   t   viewst   onlyR=   R[   RY  t   connt   reflect_optst	   availableR   t   available_w_schemat   currentt   schnamet   loadt   missingt   s(    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR    sT    <
	&!%%c         @  s6     f d   } t  j |  d | j d d  |  d S(   s}   Append a DDL event listener to this ``MetaData``.

        .. deprecated:: 0.7
            See :class:`.DDLEvents`.

        c         @  s$   | d }   t  |  | d | d  S(   NRI   (   R   (   R   R    RS   RI   (   R   (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   -  s    
R   R   R   N(   R   Rj   R   (   R   R   R   R   (    (   R   s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR   &  s    c         C@  s>   | d k r t |   } n  | j t j |  d | d | d S(   sy  Create all tables stored in this metadata.

        Conditional by default, will not attempt to recreate tables already
        present in the target database.

        :param bind:
          A :class:`.Connectable` used to access the
          database; if None, uses the existing bind on this ``MetaData``, if
          any.

        :param tables:
          Optional list of ``Table`` objects, which is a subset of the total
          tables in the ``MetaData`` (others are ignored).

        :param checkfirst:
          Defaults to True, don't issue CREATEs for tables already present
          in the target database.

        R   RI   N(   R   R	   R   R   R   (   R   Rt   RI   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt
   create_all3  s    c         C@  s>   | d k r t |   } n  | j t j |  d | d | d S(   st  Drop all tables stored in this metadata.

        Conditional by default, will not attempt to drop tables not present in
        the target database.

        :param bind:
          A :class:`.Connectable` used to access the
          database; if None, uses the existing bind on this ``MetaData``, if
          any.

        :param tables:
          Optional list of ``Table`` objects, which is a subset of the
          total tables in the ``MetaData`` (others are ignored).

        :param checkfirst:
          Defaults to True, only issue DROPs for tables confirmed to be
          present in the target database.

        R   RI   N(   R   R	   R   R   R   (   R   Rt   RI   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   drop_allN  s    N(   R3   R4   R5   R6   R   RF   t   DEFAULT_NAMING_CONVENTIONRX   RI   R+   RG  RN   RQ   R  R  R  Rt   R   R5  R  R7   R  Rz   R  Ri   R  R   R  R  (    (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR{    s2   	o										t	t   ThreadLocalMetaDatac           B@  s_   e  Z d  Z d Z d   Z d   Z e j d  d    Z e	 e e  Z d   Z
 d   Z RS(   s  A MetaData variant that presents a different ``bind`` in every thread.

    Makes the ``bind`` property of the MetaData a thread-local value, allowing
    this collection of tables to be bound to different ``Engine``
    implementations or connections in each thread.

    The ThreadLocalMetaData starts off bound to None in each thread.  Binds
    must be made explicitly by assigning to the ``bind`` property or using
    ``connect()``.  You can also re-bind dynamically multiple times per
    thread, just like a regular ``MetaData``.

    RT   c         C@  s2   t  j j   |  _ i  |  _ t t |   j   d S(   s    Construct a ThreadLocalMetaData.N(   R   t	   threadingt   localt   contextt   _ThreadLocalMetaData__enginesR`   R  RX   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRX   z  s    	c         C@  s   t  |  j d d  S(   s   The bound Engine or Connection for this thread.

        This property may be assigned an Engine or Connection, or assigned a
        string or URL to automatically create a basic Engine for this bind
        with ``create_engine()``.t   _engineN(   R   R  R   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyRt     s    s   sqlalchemy.engine.urlc         C@  s   t  | t j | j f  rr y |  j | |  j _ Wq t k
 rn t j	 |  } | |  j | <| |  j _ q Xn+ | |  j k r | |  j | <n  | |  j _ d S(   s-   Bind to a Connectable in the caller's thread.N(
   R   R   R   R  R  R  R  Rh  R  R  (   R   R  Rt   Ry  (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR    s    c         C@  s"   t  |  j d  o! |  j j d k	 S(   s(   True if there is a bind for this thread.R  N(   R   R  R  R   (   R   (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR    s    c         C@  s:   x3 |  j  j   D]" } t | d  r | j   q q Wd S(   s2   Dispose all bound engines, in all thread contexts.t   disposeN(   R  R\  R   R  (   R   Ry  (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR    s    (   R3   R4   R5   R6   RX   Rt   R   R5  R  R7   R  R  (    (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyR  j  s   				(?   R5   t
   __future__R    t   inspectR   R   R   R   R   t   baseR   R   R   R   R	   R
   Rb  R   R   R   R   R   R   R   R   R   R   R   R  R  R   t   typest   symbolR   R   t   _self_inspectst	   VisitableR   R:   R   R   R@   R  R  R   R   R   R   R<  R=  RB  RC  RD  RF  RO  R   Re   R   R   R|  R  R{  R  (    (    (    s[   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/sqlalchemy/sql/schema.pyt   <module>   s`   "@		4     
!i	2%G			4H	 