
4Nc           @   s  d  Z  d d l Z d d l Z d d l m Z m Z m Z d d l m Z m	 Z	 e j
 d d  Z e j
 d d  Z d	 d
 d d d d d d d d d d d d d d d d d d d d d d  d! d" g Z e j   e j d#  Z d	 e	 j f d$     YZ d%   Z d
 e e j f d&     YZ d e e j f d'     YZ d e f d(     YZ d e f d)     YZ d e f d*     YZ d e f d+     YZ d e f d,     YZ d e f d-     YZ d e f d.     YZ d e f d/     YZ  d0 e  f d1     YZ! d e  f d2     YZ" d e  f d3     YZ# d e! f d4     YZ$ d e! f d5     YZ% d e f d6     YZ& d e f d7     YZ' d e' f d8     YZ( d e	 j) f d9     YZ* d: e j+ e j, f d;     YZ- d e- f d<     YZ. d=   Z/ d>   Z0 d? e- f d@     YZ1 d e1 f dA     YZ2 d e1 f dB     YZ3 d e1 f dC     YZ4 d  e1 f dD     YZ5 dE e1 f dF     YZ6 dG e1 f dH     YZ7 d! e1 f dI     YZ8 d" e1 f dJ     YZ9 e: dK  Z; d S(L   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.

iN(   t   exct   utilt   dialects(   t
   expressiont   visitorss   sqlalchemy.sqlR   s   sqlalchemy.enginet   urlt
   SchemaItemt   Tablet   Columnt
   ForeignKeyt   Sequencet   Indext   ForeignKeyConstraintt   PrimaryKeyConstraintt   CheckConstraintt   UniqueConstraintt   DefaultGeneratort
   Constraintt   MetaDatat   ThreadLocalMetaDatat   SchemaVisitort   PassiveDefaultt   DefaultClauset   FetchedValuet   ColumnDefaultt   DDLt   CreateTablet	   DropTablet   CreateSequencet   DropSequencet   AddConstraintt   DropConstraintt   retain_schemac           B   sP   e  Z d  Z d Z d Z d   Z d   Z d   Z d   Z	 e
 j d    Z RS(   s3   Base class for items that define a database schema.t   schema_itemc         G   s1   x* | D]" } | d k	 r | j |   q q Wd S(   s7   Initialize the list of child items for this SchemaItem.N(   t   Nonet   _set_parent(   t   selft   argst   item(    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   _init_items8   s    c         C   s   t     d S(   s/   Associate with this SchemaItem's parent object.N(   t   NotImplementedError(   R$   t   parent(    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR#   ?   s    c         K   s   g  S(   s"   used to allow SchemaVisitor access(    (   R$   t   kwargs(    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   get_childrenD   s    c         C   s   d |  j  j S(   Ns   %s()(   t	   __class__t   __name__(   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   __repr__H   s    c         C   s   i  S(   N(    (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   infoK   s    N(   R-   t
   __module__t   __doc__t   __visit_name__R"   t   quoteR'   R#   R+   R.   R   t   memoized_propertyR/   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   2   s   				c         C   s    | d  k r |  S| d |  Sd  S(   Nt   .(   R"   (   t   namet   schema(    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   _get_table_keyO   s    c           B   s  e  Z d  Z d Z d Z d   Z d   Z d   Z d	   Z d
   Z	 d   Z
 e j d    Z e 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  Z! RS(   so  Represent a table in a database.

    e.g.::

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

    The Table object constructs a unique instance of itself based on its
    name within the given MetaData object.   Constructor
    arguments are as follows:

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

        This property, along with the *schema*, indicates the *singleton
        identity* of this table in relation to its parent :class:`MetaData`.
        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.  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.

    :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:`~sqlalchemy.engine.base.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: the Columns for this table should 
        be reflected from the database. Usually there will be no Column
        objects in the constructor if this property is set.

    :param autoload_with: If autoload==True, this is an optional Engine 
        or Connection instance to be used for the table reflection. If
        ``None``, the underlying MetaData's bound connectable will be used.

    :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: A dictionary which defaults to ``{}``.  A space to store
        application specific data. This must be a dictionary.

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

    :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``.

    :param useexisting: When ``True``, indicates that if this Table is already
        present in the given :class:`MetaData`, apply further arguments within
        the constructor to the existing :class:`Table`. If this flag is not
        set, an error is raised when the parameters of an existing
        :class:`Table` are overwritten.

    t   tables   before-creates   after-creates   before-drops
   after-dropc   
      O   sj  | s t  j |   Sy$ | d | d | d } } } Wn t k
 rV t d   n X| j d d   } | j d t  } | j d t  } t | |  } | | j	 k r | r t
 |  r t j d |   n  | j	 | }	 |	 j | |   |	 S| rt j d	 |   n  t  j |   | j	 | <}	 y |	 j | | | |  |	 SWn | j	 j |    n Xd  S(
   Ni    i   i   s$   Table() takes at least two argumentsR7   t   useexistingt	   mustexists   Table '%s' is already defined for this MetaData instance.  Specify 'useexisting=True' to redefine options and columns on an existing Table object.s   Table '%s' not defined(   t   objectt   __new__t
   IndexErrort	   TypeErrort   getR"   t   popt   FalseR8   t   tablest   boolR    t   InvalidRequestErrort   _init_existingt   _init(
   t   clsR%   t   kwR6   t   metadataR7   R:   R;   t   keyR9   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR=      s8    $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%   RI   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   __init__   s    c         O   s  t  t |   j |  | |  _ | j d d   |  _ t   |  _ t   |  _	 t
 j   |  _ |  j t    t j   |  _ t   |  _ t j t  |  _ i  |  _ |  j d  k	 r d |  j |  j f |  _ n |  j |  _ | j d t  } | j d d   } | j d d   } | j d t  |  _ | j d d   |  _ | j d d   |  _ d	 | k rn| j d	  |  _ n  | j d
 g   |  _ |  j  |   | r| r| j! |  d | qt" | d d j! |  d | n  |  j# |   d  S(   NR7   s   %s.%st   autoloadt   autoload_witht   include_columnst   implicit_returningR3   t   quote_schemaR/   t   prefixest   msgs   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   superR   RL   RJ   RA   R"   R7   t   sett   indexest   constraintsR   t   ColumnCollectiont   _columnst   _set_primary_keyR   R   t
   OrderedSett   _foreign_keyst   _extra_dependenciest   defaultdictt   listt   ddl_listenersR*   R6   t   fullnameRB   t   TrueRP   R3   RQ   R/   t	   _prefixest   _extra_kwargst   reflecttablet   _bind_or_errorR'   (   R$   R6   RJ   R%   R*   RM   RN   RO   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRG      s@    		
		c   	      O   s2  | j  d t  } | j  d d   } | j  d d   } | ri | |  j k ri t j d |  j | f   n  | j  d d   } | r x6 |  j D]( } | j | k r |  j j |  q q Wn  x6 d	 D]. } | | k r t	 |  | | j  |   q q Wd | k r| j  d  |  _
 n  |  j |   |  j |   d  S(
   NRM   RN   R7   s7   Can't change schema of existing table from '%s' to '%s'RO   R3   RQ   R/   (   s   quotes   quote_schema(   RA   RB   R"   R7   R    t   ArgumentErrort   cR6   t   removet   setattrR/   Rd   R'   (	   R$   R%   R*   RM   RN   R7   RO   Rh   RK   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRF     s&     c         K   sn   t  g  | D]. } t j d d j t j  |  s
 | ^ q
  rZ t d | j     n  |  j j	 |  d  S(   Ns   ^(?:%s)_t   |s!   Invalid argument(s) for Table: %r(
   t   lent   ret   matcht   joinR   t   __all__R?   t   keysR*   t   update(   R$   R*   t   k(    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRd   /  s    (c         C   sk   t  |  d d   |  j k r1 |  j j |  j  n  | |  _ |  j j |  x | j D] } t | _ qT Wd  S(   Nt   _primary_key(	   t   getattrR"   RW   Ri   Rt   t   addt   columnsRb   t   primary_key(   R$   t   pkRh   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRZ   ;  s    	c         C   sb   x[ |  j  D]P } | j r
 t | j t j  r
 | j r
 t | j t d   t	 f  r
 | Sq
 Wd  S(   N(
   Rx   t   autoincrementt
   isinstancet   typet   typest   Integert   foreign_keyst   defaultR"   R
   (   R$   t   col(    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   _autoincrement_columnD  s    	
c         C   s   t  |  j |  j  S(   N(   R8   R6   R7   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRK   N  s    c         C   s   |  j  S(   N(   Rt   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRx   R  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   , R7   s   %s=%s(   Ro   t   reprR6   RJ   Rw   Ru   (   R$   t   xRs   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR.   V  s    	?c         C   s   t  |  j |  j  S(   N(   R8   t   descriptionR7   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   __str__\  s    c         C   s   |  j  r |  j  j p d S(   s2   Return the connectable associated with this Table.N(   RJ   t   bindR"   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   _  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(   R]   Rv   (   R$   R9   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   add_is_dependent_one  s    c         C   s   | j  |   d S(   s  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(    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   append_columns  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(    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   append_constraint  s    c         C   s6   | |  j  k r t |   n  |  j | j |  d S(   sI  Append a DDL event listener to this ``Table``.

        The ``listener`` callable will be triggered when this ``Table`` is
        created or dropped, either directly before or after the DDL is issued
        to the database.  The listener may modify the Table, but may not abort
        the event itself.

        :param event:
          One of ``Table.ddl_events``; e.g. 'before-create', 'after-create',
          'before-drop' or 'after-drop'.

        :param listener:
          A callable, invoked with three positional arguments:

          :event:
            The event currently being handled

          :target:
            The ``Table`` object being created or dropped

          :bind:
            The ``Connection`` bueing used for DDL execution.

        Listeners are added to the Table's ``ddl_listeners`` attribute.

        N(   t
   ddl_eventst   LookupErrorR`   t   append(   R$   t   eventt   listener(    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   append_ddl_listener  s    c         C   s)   |  | j  t |  j |  j  <| |  _ d  S(   N(   RC   R8   R6   R7   RJ   (   R$   RJ   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR#     s    c         K   s:   | s t  j j |  d | | S| r2 t |  j  Sg  Sd  S(   Nt   column_collections(   R   t   TableClauseR+   R_   Rw   (   R$   R   t   schema_visitorRI   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/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.R7   N(   R"   Rf   t   run_callablet   dialectt	   has_tableR6   R7   (   R$   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   exists  s    c         C   s2   | d k r t |   } n  | j |  d | d S(   sc   Issue a ``CREATE`` statement for this table.

        See also ``metadata.create_all()``.

        t
   checkfirstN(   R"   Rf   t   create(   R$   R   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s    c         C   s2   | d k r t |   } n  | j |  d | d S(   s_   Issue a ``DROP`` statement for this table.

        See also ``metadata.drop_all()``.

        R   N(   R"   Rf   t   drop(   R$   R   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s    c   	   
   C   sd  | t  k r |  j } n  t |  j |  } | | j k rX t j d |  j  | j | Sg  } x* |  j D] } | j	 | j
 d |   qh Wx* |  j D] } | j	 | j
 d |   q Wt |  j | d | | |  j } x |  j D]y } t | j  d k rt | j  d j rq n  t | j d | j g  | j j   D] } | j | ^ q<| j q W| S(   s  Return a copy of this :class:`Table` associated with a different
        :class:`MetaData`.

        E.g.::

            # create two metadata
            meta1 = MetaData('sqlite:///querytest.db')
            meta2 = MetaData()

            # load 'users' from the sqlite engine
            users_table = Table('users', meta1, autoload=True)

            # create the same Table object for the plain metadata
            users_table_2 = users_table.tometadata(meta2)

        sB   Table '%s' already exists within the given MetaData - not copying.R7   i   i    t   unique(   t   RETAIN_SCHEMAR7   R8   R6   RC   R   t   warnR   Rw   R   t   copyRW   R   R*   RV   Rl   R_   t   indexR   R   Rq   Rh   (	   R$   RJ   R7   RK   R%   Rh   R9   R   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt
   tometadata  s0    	&(   s   before-creates   after-creates   before-drops
   after-dropN("   R-   R0   R1   R2   R   R=   RL   RG   RF   Rd   RZ   R   R4   R   t   propertyRK   Rx   R.   R   R   R   R   R   R   R#   Rb   RB   R+   R"   R   R   R   R   R   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   U   s6   Y 	#		3				
						 	
	c           B   st   e  Z d  Z d Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z 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  r| | d k	 rg t j d   n  | j  d  } q| n  | r | d } t | t j  s t | t	  r t
 | t j  r | d k	 r t j d   n  | j  d  } q n  | d k } t t |   j | d |  | 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 d  |  _ | j  d d  |  _ | j  d d  |  _ | j  d t  |  _ t   |  _ t j   |  _  t   |  _! d | k rb| j  d  |  _" n( t |  j	 t j#  r|  j	 j$ |   n  |  j d k	 rt |  j t% t& f  r| j' |  j  q| j' t% |  j   n  |  j d k	 r*t |  j t(  r| j' |  j  q*| j' t) |  j   n  |  j d k	 rt |  j t% t& f  rd| j' |  j  q| j' t% |  j d t  n  |  j d k	 rt |  j t(  r| j' |  j  q| j' t) |  j d t  n  |  j* |   |  j  r| rt j d   n  t j+ |   d | k r3| j  d  |  _, n  | r[t j d t- | j.      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.AbstractType`.  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.

          There is partial support for automatic detection of the 
          type based on that of a :class:`ForeignKey` associated 
          with this column, if the type is specified as ``None``. 
          However, this feature is not fully implemented and 
          may not function in all cases.

        :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

          * Are not referenced by any foreign keys

          * 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.  See the SQLite dialect documentation for
            information on SQLite's 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).

        :param default: A scalar, Python callable, or
            :class:`~sqlalchemy.sql.expression.ClauseElement` 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.

            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: A dictionary which defaults to ``{}``. A space to store
            application specific data. This must be a dictionary.

        :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()'))0

                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.

        R6   t   type_i    s0   May not pass name positionally and as a keyword.s1   May not pass type_ positionally and as a keyword.RK   Rx   t   nullableR   t   server_defaultt   server_onupdateR   R   R3   t   doct   onupdateRz   t   _proxiest
   for_updates@   'type' is required on Column objects which have no foreign keys.R/   s$   Unknown arguments passed to Column: N(/   RA   R"   R_   R{   t
   basestringR    Rg   R}   t   AbstractTypeR|   t
   issubclassRT   R   RL   RK   RB   Rx   R   R   R   R   R   R   R3   R   R   Rb   Rz   RU   RW   R   R[   R   t   _table_eventst   proxiest
   SchemaTypeR#   R   R
   R   R   R   R'   t   set_creation_orderR/   R   Rq   (   R$   R%   R*   R6   R   t   coltypet   no_type(    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRL     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)R5   (   R6   R"   R9   t   named_with_columnR   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   /  s    
c         C   s2   x+ |  j  D] } | j | j  r
 t Sq
 Wt Sd S(   sO   Return True if this Column references the given column via foreign
        key.N(   R   t
   referencesR9   Rb   RB   (   R$   R   t   fk(    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   :  s    c         C   s   | j  |   d  S(   N(   R#   (   R$   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   append_foreign_keyD  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(   NRK   Rx   R   R   R   R   s
   Column(%s)s   , s
   table=<%s>t    s   %s=%s(   RK   R6   R   Rx   R   R   R   R   Ro   R   R|   R   R"   RW   R9   R   Ru   (   R$   t   kwargR   Rs   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR.   G  s     						c         C   s  |  j  d  k r! t j d   n  |  j d  k r? |  j  |  _ n  t |  d d   d  k	 ri t j d   n  |  j | j k r | j j |  j  } x\ | j D]N } | j j	 |  | j j	 |  | j
 | j k r | j j	 | j
  q q Wn  | j j |   |  j r| j j |   n4 |  j | j k rOt j d |  j | j f   n  | |  _ |  j rt |  j t  rt j d   n  t t j d |  j  |  d |  j nF |  j rt |  j t  rt j d   n  | j t |  j   n  x |  j D] } | | |   qW|  ` d  S(	   NsP   Column must be constructed with a name or assign .name before adding to a Table.R9   s    this Column already has a table!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.s   ix_%sR   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.(   R6   R"   R    Rg   RK   Ru   RY   R@   R   Ri   R   RW   t   replaceRx   t   _replaceRa   R9   R   R{   R   R   R   t   _generated_labelt   _labelR   R   R   R   (   R$   R9   R   R   t   fn(    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR#   ]  sF    			)	c         C   s6   |  j  d  k	 r" | |  j  |   n |  j j |  d  S(   N(   R9   R"   R   Rv   (   R$   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   _on_table_attach  s    c          K   s  g  |  j  D] } | j |   ^ q
 g  |  j D] } | j s, | j |   ^ q, } t d |  j d |  j d |  j d |  j d |  j	 d |  j
 d |  j d |  j d	 |  j d
 |  j d |  j d |  j d |  j d |  j d |  j |  } t |  d  rt |  j  | _ n  | S(   sg   Create a copy of this ``Column``, unitialized.

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

        R6   R   RK   Rx   R   R   R3   R   Rz   R   R   R   R   R/   R   R   (   RW   R   R   R   R   R6   R|   RK   Rx   R   R   R3   R   Rz   R   R   R   R   R/   R   t   hasattrR_   R   (   R$   RI   Rh   R%   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s,    	"/															c         C   s  g  |  j  D] } t | j  ^ q
 } | d k rR |  j d k rR t j d   n  |  j | pd |  j |  j d | py |  j	 d |  j
 d |  j d |  j d |  g | } | | _ | j j |  |  j
 r | j
 j |  n  x | j D] } | | |  q W| ` | 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.

        s_   Cannot initialize a sub-selectable with this Column object until it's 'name' has been assigned.RK   Rx   R   R3   R   N(   R   R	   R   R"   R6   R    RE   t   _constructorR|   RK   Rx   R   R3   R9   Rw   Rv   R   (   R$   t
   selectableR6   t   fR   Rh   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   _make_proxy  s$    	%					c         K   sf   | rO g  |  j  |  j f D] } | d  k	 r | ^ q t |  j  t |  j  St j j |  |  Sd  S(   N(	   R   R   R"   R_   R   RW   R   t   ColumnClauseR+   (   R$   R   R*   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR+     s    I(   R-   R0   R1   R2   RL   R   R   R   R.   R#   R   R   R"   R   RB   R+   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s   	 		
			6		"c        	   B   s   e  Z d  Z d Z d e d d d d d e d  Z d   Z d d  Z d d  Z	 e
 e	  Z d   Z d   Z e j 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
   
      C   sU   | |  _  | |  _ | |  _ | |  _ | |  _ | |  _ | |  _ | |  _ |	 |  _ d S(   ss  
        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.

        :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.

        N(	   t   _colspecR   t	   use_alterR6   R   t   ondeletet
   deferrablet	   initiallyt   link_to_name(
   R$   R   t   _constraintR   R6   R   R   R   R   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRL   	  s    -								c         C   s   d |  j    S(   Ns   ForeignKey(%r)(   t   _get_colspec(   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR.   H  s    c         C   sU   t  |  j d |  d |  j d |  j d |  j d |  j d |  j d |  j d |  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.

        R7   R   R6   R   R   R   R   R   (	   R	   R   R   R6   R   R   R   R   R   (   R$   R7   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   K  s    						c         C   s   | r) | d |  j  j j d |  j  j St |  j t  rB |  j St |  j d  rf |  j j   } n	 |  j } d | j j	 | j f 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.

        R5   t   __clause_element__s   %s.%s(
   R   R9   R6   RK   R{   R   R   R   R   Ra   (   R$   R7   t   _column(    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   f  s    #	c         C   s   | j  |  j  d k	 S(   sR   Return True if the given :class:`Table` is referenced by this :class:`ForeignKey`.N(   t   corresponding_columnR   R"   (   R$   R9   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/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$   R9   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   get_referent  s    	c   
      C   s  t  |  j t  r(xL |  j j D]" } t  | t  r | j } Pq q Wt j d t	 |  j    |  j j
 d  } | d k r t j d |  j   n  d \ } } } t |  d k r | j   } n | j   } | j   } t |  d k rd j |  } n  t | |  | j k r>t j d |  j | | f   n  t | | j d t d | } d } | d k r|  j }	 | j j |  j j d  } nY |  j r| }	 xG | j D] } | j | k r| } qqWn | }	 | j j | d  } | d k rUt j d	 |  j | j | j |	 f   qUn- t |  j d
  rL|  j j   } n	 |  j } t  |  j j t j  r| j |  j _ n  | S(   s  Return the target :class:`.Column` referenced by this :class:`.ForeignKey`.

        If this :class:`ForeignKey` was created using a
        string-based target column specification, this
        attribute will on first access initiate a resolution
        process to locate the referenced remote
        :class:`.Column`.  The resolution process traverses
        to the parent :class:`.Column`, :class:`.Table`, and
        :class:`.MetaData` to proceed - if any of these aren't 
        yet present, an error is raised.

        s@   Parent column '%s' does not descend from a table-attached ColumnR5   s,   Invalid foreign key column specification: %si   i    s{   Foreign key assocated with column '%s' could not find table '%s' with which to generate a foreign key to target column '%s'R;   R7   sS   Could not create ForeignKey '%s' on table '%s': table '%s' has no column named '%s'R   N(   NNN(   R{   R   R   R)   t   base_columnsR   R9   R    Rg   t   strt   splitR"   Rl   RA   Ro   R8   RJ   t   NoReferencedTableErrorR   Rb   Rh   R@   RK   R   R6   t   NoReferencedColumnErrorR   R   R|   R}   t   NullType(
   R$   Rh   t   parenttablet   mR7   t   tnamet   colnameR9   R   RK   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s^    			%	c         C   sg   t  |  d  r4 |  j | k r" d  St j d   n  | |  _ |  j j j |   |  j j |  j  d  S(   NR)   s&   This ForeignKey already has a parent !(   R   R)   R    RE   R   Rv   R   t
   _set_table(   R$   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR#     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
 |  _  |  |  j  j |  j <|  j  j |  n  | j j |   d  S(   NR   R6   R   R   R   R   (   R   R"   R{   R   R   R   R6   R   R   R   R   t	   _elementsR)   R#   R   Rv   (   R$   R9   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s    N(   R-   R0   R1   R2   R"   RB   RL   R.   R   R   R   t   target_fullnameR   R   R   R4   R   R#   R   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR	     s   #		=			a	
c           B   sS   e  Z d  Z d Z e Z e d  Z d   Z d d  Z	 e
 d    Z d   Z RS(   s'   Base class for column *default* values.t   default_generatorc         C   s   | |  _  d  S(   N(   R   (   R$   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRL   
  s    c         C   s1   | |  _  |  j r! |  |  j  _ n |  |  j  _ d  S(   N(   R   R   R   R   (   R$   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR#     s    		c         K   s+   | d  k r t |   } n  | j |  |  S(   N(   R"   Rf   t   _execute_default(   R$   R   R*   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/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(   Ru   R"   R   R9   R   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s    c         C   s   d S(   Ns   DefaultGenerator()(    (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR.   !  s    N(   R-   R0   R1   R2   RB   t   is_sequenceRL   R#   R"   R   R   R   R.   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s   	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(   Ns4   ColumnDefault may not be a server-side default type.(   RT   R   RL   R{   R   R    Rg   R   t   callablet   _maybe_wrap_callablet   arg(   R$   R   R*   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRL   ;  s    c         C   s   t  j |  j  S(   N(   R   R   R   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   is_callableD  s    c         C   s   t  |  j t j  S(   N(   R{   R   R   t   ClauseElement(   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   is_clause_elementH  s    c         C   s   |  j  o |  j o |  j S(   N(   R   R   R   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt	   is_scalarL  s    

c            s%  t  j    r   } n< t  j    r3   j } n! t   d  rN   j } n   } y t  j |  } Wn t k
 r   f d   SXt | d  } t  j	 |  s t  j    r | d 8} n  | d k r   f d   S| d d k	 r t | d  p d } | | d k r!t j d   n    S(	   s<   Backward compat: Wrap callables that don't accept a context.t   __call__c            s       S(   N(    (   t   ctx(   R   (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   <lambda>a  s    i    i   c            s       S(   N(    (   R   (   R   (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   j  s    i   sD   ColumnDefault Python function takes zero or one positional argumentsN(   t   inspectt
   isfunctiont   isclassRL   R   R   t
   getargspecR?   Rl   t   ismethodR"   R    Rg   (   R$   R   t   inspectablet   argspect   positionalst	   defaulted(    (   R   su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   R  s*    	&c         C   s   |  j  r d Sd Sd  S(   Nt   column_onupdatet   column_default(   R   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   _visit_names  s    	c         C   s   d |  j  S(   Ns   ColumnDefault(%r)(   R   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR.   z  s    (   R-   R0   R1   RL   R   R4   R   R   R   R   R   R   R2   R.   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   %  s   			!	c           B   s   e  Z d  Z d Z e Z d d d e d d e d  Z e	 j
 d    Z e	 j
 d    Z d   Z d   Z d   Z e d    Z d e d	  Z d e d
  Z RS(   s%   Represents a named database sequence.t   sequencec	   	      C   s\   t  t |   j d |  | |  _ | |  _ | |  _ | |  _ | |  _ | |  _ | |  _	 d  S(   NR   (
   RT   R
   RL   R6   t   startt	   incrementt   optionalR3   R7   RJ   (	   R$   R6   R   R   R7   R   R3   RJ   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRL     s    						c         C   s   t  S(   N(   RB   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s    c         C   s   t  S(   N(   RB   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s    c         C   sV   d d j  t |  j  g g  d d d g D]% } d | t t |  |   f ^ q(  S(   Ns   Sequence(%s)s   , R   R   R   s   %s=%s(   Ro   R   R6   Ru   (   R$   Rs   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR.     s    	c         C   s*   t  t |   j |  | j |  j  d  S(   N(   RT   R
   R#   R   R   (   R$   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR#     s    c         C   s   | j  |  _  d  S(   N(   RJ   (   R$   R9   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s    c         C   s   |  j  r |  j  j Sd  Sd  S(   N(   RJ   R   R"   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s    	
c         C   s2   | d k r t |   } n  | j |  d | d S(   s&   Creates this sequence in the database.R   N(   R"   Rf   R   (   R$   R   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s    c         C   s2   | d k r t |   } n  | j |  d | d S(   s&   Drops this sequence from the database.R   N(   R"   Rf   R   (   R$   R   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s    N(   R-   R0   R1   R2   Rb   R   R"   RB   RL   R   R4   R   R   R.   R#   R   R   R   R   R   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR
   }  s   	
			c           B   s,   e  Z d  Z e d  Z d   Z d   Z RS(   sk  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.

    c         C   s   | |  _  d  S(   N(   R   (   R$   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRL     s    c         C   s1   | |  _  |  j r! |  |  j  _ n |  |  j  _ d  S(   N(   R   R   R   R   (   R$   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR#     s    		c         C   s   d |  j  S(   Ns   FetchedValue(for_update=%r)(   R   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR.     s    (   R-   R0   R1   RB   RL   R#   R.   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s   	c           B   s#   e  Z d  Z 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   sE   t  j | t t j t j f d  t t |   j |  | |  _	 d  S(   NR   (
   R   t   assert_arg_typeR   R   R   t   _TextClauseRT   R   RL   R   (   R$   R   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRL     s
    c         C   s   d |  j  |  j f S(   Ns    DefaultClause(%r, for_update=%r)(   R   R   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR.     s    (   R-   R0   R1   RB   RL   R.   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s   c           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   RL   (   R$   R   RI   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRL     s    (   R-   R0   R1   R   t
   deprecatedRB   RL   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s   	c           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         C   s(   | |  _  | |  _ | |  _ | |  _ d S(   s"  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.

        N(   R6   R   R   t   _create_rule(   R$   R6   R   R   R  (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRL     s    "			c         C   sD   y t  |  j t  r |  j SWn t k
 r0 n Xt j d   d  S(   Nsa   This constraint is not bound to a table.  Did you mean to call table.add_constraint(constraint) ?(   R{   R)   R   t   AttributeErrorR    RE   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR9   2  s    c         C   s   | |  _  | j j |   d  S(   N(   R)   RW   Rv   (   R$   R)   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR#   =  s    	c         K   s   t     d  S(   N(   R(   (   R$   RI   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   A  s    N(
   R-   R0   R1   R2   R"   RL   R   R9   R#   R   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     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  t |   j |   t j   |  _ g  | D] } t |  ^ q, |  _ |  j r t |  j d t	  r |  j d j
 d k	 r |  j |  j d j
  n  d S(   s  
        :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.

        i    N(   RT   R  RL   R   RX   Rw   t   _to_schema_column_or_stringt   _pending_colargsR{   R   R9   R"   R#   (   R$   Rw   RI   Rh   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRL   G  s    	c         C   s]   t  t |   j |  x@ |  j D]5 } t | t  rE | j | } n  |  j j |  q  Wd  S(   N(	   RT   R  R#   R  R{   R   Rh   Rw   Rv   (   R$   R9   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR#   a  s
    c         C   s   | |  j  k S(   N(   Rw   (   R$   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   __contains__h  s    c         K   s1   |  j  d |  j d |  j d |  j |  j j    S(   NR6   R   R   (   R,   R6   R   R   Rw   Rq   (   R$   RI   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   k  s    c         C   s   |  j  j |  S(   N(   Rw   t   contains_column(   R$   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR  o  s    c         C   s   t  |  j  S(   N(   t   iterRw   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   __iter__r  s    c         C   s   t  |  j  S(   N(   Rl   Rw   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   __len__u  s    (
   R-   R0   R1   RL   R#   R  R   R  R
  R  (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR  D  s   						c           B   sD   e  Z d  Z d d d d d d  Z d   Z e e  Z d   Z RS(   sl   A table- or column-level CHECK constraint.

    Can be included in the definition of a Table or Column.
    c         C   sQ   t  t |   j | | | |  t j |  |  _ | d k	 rM |  j |  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.

        :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.

        N(   RT   R   RL   R   t   _literal_as_textt   sqltextR"   R#   (   R$   R  R6   R   R   R9   R  (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRL     s
    c         C   s   t  |  j t  r d Sd Sd  S(   Nt   check_constraintt   column_check_constraint(   R{   R)   R   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR2     s    c      
   K   s1   t  |  j d |  j d |  j d |  j d |  j S(   NR6   R   R   R  (   R   R  R6   R   R   R  (   R$   RI   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s
    			N(   R-   R0   R1   R"   RL   R2   R   R   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   y  s   	c        	   B   se   e  Z d  Z d Z d d d d d e e d d  Z e d    Z e d    Z	 d   Z
 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         C   s   t  t |   j | | |  | |  _ | |  _ |	 |  _ |  j d k r^ | r^ t j	 d   n  | |  _
 t j   |  _ xc t | |  D]R \ } } t | d |  d |  j d |  j d |  j d |  j
 d |  j |  j | <q W|
 d k	 r |  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.

        s$   Alterable Constraint requires a nameR   R6   R   R   R   R   N(   RT   R   RL   R   R   R   R6   R"   R    Rg   R   R   t   OrderedDictR   t   zipR	   R#   (   R$   Rw   t
   refcolumnsR6   R   R   R   R   R   R   R9   R   t   refcol(    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRL     s(    ,								c         C   s   |  j  j   S(   N(   R   Rq   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRw     s    c         C   s   |  j  j   S(   N(   R   t   values(   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   elements  s    c            s   t  t |   j    xI |  j j   D]8 \ } } t | t  rQ   j | } n  | j |  q& W|  j r   f d   } t	 |  d | j
 d   j  t |  d | j
 d   j  n  d  S(   Nc            s      t  | d  k o | j j S(   NRC   (   RU   R   t   supports_alter(   t   ddlR   R!   R   RI   (   R9   (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR    s    t   ons   after-creates   before-drop(   RT   R   R#   R   t	   iteritemsR{   R   Rh   R   R   t
   execute_atRJ   R   (   R$   R9   R   R   R  (    (   R9   su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR#     s    	c         K   s   t  g  |  j j   D] } | j j ^ q g  |  j j   D] } | j |   ^ q8 d |  j d |  j d |  j d |  j d |  j	 d |  j
 d |  j S(   NR6   R   R   R   R   R   R   (   R   R   R  R)   R6   R   R   R   R   R   R   R   (   R$   RI   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s    %+						N(   R-   R0   R1   R2   R"   RB   RL   R   Rw   R  R#   R   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s   
H	c           B   s&   e  Z d  Z d Z d   Z d   Z RS(   s1  A table-level PRIMARY KEY constraint.

    Defines a single column or composite PRIMARY KEY constraint. For a
    no-frills primary key, adding ``primary_key=True`` to one or more
    ``Column`` definitions is a shorthand equivalent for an unnamed single- or
    multiple-column PrimaryKeyConstraint.
    t   primary_key_constraintc         C   s'   t  t |   j |  | j |   d  S(   N(   RT   R   R#   RZ   (   R$   R9   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR#   2  s    c         C   s   |  j  j |  d  S(   N(   Rw   R   (   R$   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   6  s    (   R-   R0   R1   R2   R#   R   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   '  s   	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(   R-   R0   R1   R2   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   9  s   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. For a no-frills, single
    column index, adding ``index=True`` to the ``Column`` definition is
    a shorthand equivalent for an unnamed, single column Index.
    R   c         O   s   | |  _  t j   |  _ d |  _ | j d t  |  _ | |  _	 x | D]{ } t
 |  } |  j d k rz |  j | j  n7 | j |  j k r t j d | | j |  j f   n  |  j j |  qF Wd S(   s  Construct an index object.

        :param name:
          The name of the index

        :param \*columns:
          Columns to include in the index. All columns must belong to the same
          table.

        :param unique:
            Defaults to False: create a unique index.

        :param \**kw:
            Other keyword arguments may be interpreted by specific dialects.

        R   s?   All index columns must be from same table. %s is from %s not %sN(   R6   R   RX   Rw   R"   R9   RA   RB   R   R*   t   _to_schema_columnR#   R    Rg   Rv   (   R$   R6   Rw   R*   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRL   N  s    			c         C   s   | |  _  | j j |   d  S(   N(   R9   RV   Rv   (   R$   R9   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR#   r  s    	c         C   s
   |  j  j S(   s2   Return the connectable associated with this Index.(   R9   R   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   v  s    c         C   s,   | d  k r t |   } n  | j |   |  S(   N(   R"   Rf   R   (   R$   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   |  s    c         C   s,   | d  k r t |   } n  | j |   d  S(   N(   R"   Rf   R   (   R$   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s    c         C   s9   d |  j  d j d   |  j D  |  j r1 d p4 d f S(   Ns   Index("%s", %s%s)s   , c         s   s   |  ] } t  |  Vq d  S(   N(   R   (   t   .0Rh   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pys	   <genexpr>  s    s   , unique=TrueR   (   R6   Ro   Rw   R   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR.     s    N(   R-   R0   R1   R2   RL   R#   R   R   R"   R   R   R.   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   D  s   	$	c           B   s   e  Z d  Z d Z d Z d e d  Z d   Z d   Z	 d	   Z
 d
   Z d   Z d   Z d   Z e e e  Z d   Z d   Z e d    Z d d e d d  Z d   Z d d e d  Z d d e d  Z RS(   s  A collection of Tables and their associated schema constructs.

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

    The `Table` objects themselves are stored in the `metadata.tables`
    dictionary.

    The ``bind`` property may be assigned to dynamically.  A common pattern is
    to start unbound and then bind later when an engine is available::

      metadata = MetaData()
      # define tables
      Table('mytable', metadata, ...)
      # connect to an engine later, perhaps after loading a URL from a
      # configuration file
      metadata.bind = an_engine

    MetaData is a thread-safe object after tables have been explicitly defined
    or loaded via reflection.

    .. index::
      single: thread safety; MetaData

    RJ   s   before-creates   after-creates   before-drops
   after-dropc         C   s\   i  |  _  | |  _ |  |  _ t j t  |  _ | rX | sK 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.
          For finer control over loaded tables, use the ``reflect`` method of
          ``MetaData``.

        s8   A bind must be supplied in conjunction with reflect=TrueN(
   RC   R   RJ   R   R^   R_   R`   R    Rg   t   reflect(   R$   R   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRL     s    			c         C   s   d |  j  S(   Ns   MetaData(%r)(   R   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR.     s    c         C   s(   t  | t  s | j } n  | |  j k S(   N(   R{   R   RK   RC   (   R$   t   table_or_key(    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR    s    c         C   s   i |  j  d 6S(   NRC   (   RC   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   __getstate__  s    c         C   s   | d |  _  d  |  _ d  S(   NRC   (   RC   R"   t   _bind(   R$   t   state(    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   __setstate__  s    c         C   s   |  j  d k	 S(   s:   True if this MetaData is bound to an Engine or Connection.N(   R#  R"   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   is_bound  s    c         C   s   |  j  S(   s	  An Engine or Connection to which this MetaData is bound.

        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()``.

        (   R#  (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s    c         C   sG   t  | t t j f  r: d d l m } | |  |  _ n	 | |  _ d S(   s;   Bind this MetaData to an Engine, Connection, string or URL.i(   t   create_engineN(   R{   R   R   t   URLt
   sqlalchemyR'  R#  (   R$   R   R'  (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   _bind_to  s    c         C   s   |  j  j   d S(   s+   Clear all Table objects from this MetaData.N(   RC   t   clear(   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR+    s    c         C   s   |  j  | j =d S(   s1   Remove the given Table object from this MetaData.N(   RC   RK   (   R$   R9   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRi     s    c         C   s   t  j |  j j    S(   sS   Returns a list of ``Table`` objects sorted in order of
        dependency.
        (   t   sqlutilt   sort_tablesRC   t
   itervalues(   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   sorted_tables  s    c      	   C   s  i t  d 6} | d	 k r. t |   } d	 } n | | d <| j   } | d	 k	 r] | | d <n  t j | j j | d |  } | r | j | j	 j
 | p | |   n  t |  j j    } | d	 k r g  | D] }	 |	 | k r |	 ^ q }
 n t j |  r8g  | D]' }	 |	 | k r| |	 |   r|	 ^ q}
 n g  | D] }	 |	 | k r?|	 ^ q?} | r| rsd | pvd } t j d | j j | d j |  f   n  g  | D] }	 |	 | k r|	 ^ q}
 x |
 D] }	 t |	 |  |  qWd	 S(
   s  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:`~sqlalchemy.engine.base.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.

        :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.

        RM   RN   R7   t
   connections    schema '%s'R   sA   Could not reflect: requested table(s) not available in %s%s: (%s)s   , N(   Rb   R"   Rf   t   contextual_connectR   R[   t   enginet   table_namesRr   R   t   get_view_namesRU   RC   t   iterkeysR   R    RE   R   Ro   R   (   R$   R   R7   t   viewst   onlyt   reflect_optst   connt	   availablet   currentR6   t   loadt   missingt   s(    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s8    #	
(*%%%c         C   s6   | |  j  k r t |   n  |  j | j |  d S(   sE  Append a DDL event listener to this ``MetaData``.

        The ``listener`` callable will be triggered when this ``MetaData`` is
        involved in DDL creates or drops, and will be invoked either before
        all Table-related actions or after.

        :param event:
          One of ``MetaData.ddl_events``; 'before-create', 'after-create',
          'before-drop' or 'after-drop'.

        :param listener:
          A callable, invoked with three positional arguments:

          :event:
            The event currently being handled

          :target:
            The ``MetaData`` object being operated upon

          :bind:
            The ``Connection`` bueing used for DDL execution.

        Listeners are added to the MetaData's ``ddl_listeners`` attribute.

        Note: MetaData listeners are invoked even when ``Tables`` are created
        in isolation.  This may change in a future release. I.e.::

          # triggers all MetaData and Table listeners:
          metadata.create_all()

          # triggers MetaData listeners too:
          some.table.create()

        N(   R   R   R`   R   (   R$   R   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   M  s    #c         C   s8   | d k r t |   } n  | j |  d | d | d S(   s  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:`~sqlalchemy.engine.base.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   RC   N(   R"   Rf   R   (   R$   R   RC   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt
   create_allt  s    c         C   s8   | d k r t |   } n  | j |  d | d | d S(   s  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:`~sqlalchemy.engine.base.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   RC   N(   R"   Rf   R   (   R$   R   RC   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   drop_all  s    (   s   before-creates   after-creates   before-drops
   after-dropN(   R-   R0   R1   R2   R   R"   RB   RL   R.   R  R"  R%  R&  R   R*  R   R+  Ri   R/  R   R   Rb   R?  R@  (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s(    						
			I	'c           B   sP   e  Z d  Z d Z d   Z d   Z 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``.

    RJ   c         C   s2   t  j j   |  _ i  |  _ t t |   j   d S(   s    Construct a ThreadLocalMetaData.N(   R   t	   threadingt   localt   contextt   _ThreadLocalMetaData__enginesRT   R   RL   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRL     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(   Ru   RC  R"   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s    c         C   s   t  | t t j f  r{ y |  j | |  j _ Wq t k
 rw d d l m	 } | |  } | |  j | <| |  j _ q Xn+ | |  j k r | |  j | <n  | |  j _ d S(   s-   Bind to a Connectable in the caller's thread.i(   R'  N(
   R{   R   R   R(  RD  RC  RE  t   KeyErrorR)  R'  (   R$   R   R'  t   e(    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/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.RE  N(   R   RC  RE  R"   (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/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(   RD  R.  R   RH  (   R$   RG  (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRH    s    (
   R-   R0   R1   R2   RL   R   R*  R   R&  RH  (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s   					c           B   s   e  Z d  Z i e d 6Z RS(   s/   Define the visiting for ``SchemaItem`` objects.R   (   R-   R0   R1   Rb   t   __traverse_options__(    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s   t
   DDLElementc           B   s   e  Z d  Z e j j j i e d 6 Z d Z	 d Z
 d d d  Z d   Z e j d    Z d   Z d   Z d   Z d   Z d	   Z e e e  Z d
   Z d   Z RS(   s)   Base class for DDL expression constructs.t
   autocommitc         C   s]   | d k r t |   } n  |  j d | |  rF | j |  j |   S| j j j d  d S(   sg  Execute this DDL immediately.

        Executes the DDL statement in isolation using the supplied
        :class:`~sqlalchemy.engine.base.Connectable` or
        :class:`~sqlalchemy.engine.base.Connectable` assigned to the ``.bind``
        property, if not supplied. If the DDL has a conditional ``on``
        criteria, it will be invoked with None as the event.

        :param bind:
          Optional, an ``Engine`` or ``Connection``. If not supplied, a valid
          :class:`~sqlalchemy.engine.base.Connectable` must be present in the
          ``.bind`` property.

        :param target:
          Optional, defaults to None.  The target SchemaItem for the 
          execute call.  Will be passed to the ``on`` callable if any, 
          and may also provide string expansion data for the
          statement. See ``execute_at`` for more information.

        s(   DDL execution skipped, criteria not met.N(   R"   Rf   t   _should_executeR   t   againstR2  t   loggerR/   (   R$   R   t   target(    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR     s    c         C   s}   t  | d  s. t j d t |  j   n  | | j k re t j d d j | j  | f   n  | j | j |   |  S(   sO  Link execution of this DDL to the DDL lifecycle of a SchemaItem.

        Links this ``DDLElement`` to a ``Table`` or ``MetaData`` instance,
        executing it when that schema item is created or dropped. The DDL
        statement will be executed using the same Connection and transactional
        context as the Table create/drop itself. The ``.bind`` property of
        this statement is ignored.

        :param event:
          One of the events defined in the schema item's ``.ddl_events``;
          e.g. 'before-create', 'after-create', 'before-drop' or 'after-drop'

        :param target:
          The Table or MetaData instance for which this DDLElement will
          be associated with.

        A DDLElement instance can be linked to any number of schema items. 

        ``execute_at`` builds on the ``append_ddl_listener`` interface of
        :class:`MetaData` and :class:`Table` objects.

        Caveat: Creating or dropping a Table in isolation will also trigger
        any DDL set to ``execute_at`` that Table's MetaData.  This may change
        in a future release.
        R`   s   %s does not support DDL eventss-   Unknown event, expected one of (%s), got '%r's   , (	   R   R    Rg   R|   R-   R   Ro   R`   R   (   R$   R   RO  (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR  	  s    c         C   s   | |  _  d S(   s9   Return a copy of this DDL against a specific schema item.N(   RO  (   R$   RO  (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRM  7	  s    c         K   s2   |  j  | | | |  r. | j |  j |   Sd S(   s"   Execute the DDL as a ddl_listener.N(   RL  R   RM  (   R$   R   RO  R   RI   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   =	  s    c         C   s[   | d  k	 rW t | t t t t f  rW t j |  rW t j	 d t
 |  j   n  d  S(   Nsj   Expected the name of a database dialect, a tuple of names, or a callable for 'on' criteria, got type '%s'.(   R"   R{   R   t   tupleR_   RU   R   R   R    Rg   R|   R-   (   R$   R  (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   _check_ddl_onC	  s    c         K   s   |  j  d  k r t St |  j  t  r8 |  j  | j j k St |  j  t t t	 f  rf | j j |  j  k S|  j  |  | | | |  Sd  S(   N(
   R  R"   Rb   R{   R   R2  R6   RP  R_   RU   (   R$   R   RO  R   RI   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRL  L	  s    c         C   s   |  j  r |  j  Sd  S(   N(   R#  (   R$   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   V	  s    	c         C   s   | |  _  d  S(   N(   R#  (   R$   R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt	   _set_bindY	  s    c         C   s+   |  j  j |  j   } |  j j   | _ | S(   N(   R,   R=   t   __dict__R   (   R$   R>  (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt	   _generate]	  s    c         K   s   | j  | |  |  S(   sN   Return a compiler appropriate for this ClauseElement, given a
        Dialect.(   t   ddl_compiler(   R$   R   RI   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt	   _compilerb	  s    N(   R-   R0   R1   R   t
   Executablet   _execution_optionst   unionRb   R"   RO  R  R   R  t   _generativeRM  R   RQ  RL  R   RR  R   RT  RV  (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRJ    s    	%				
			c           B   s/   e  Z d  Z d Z d d d d  Z d   Z RS(   s  A literal DDL statement.

    Specifies literal SQL DDL to be executed by the database.  DDL objects can
    be attached to ``Tables`` or ``MetaData`` instances, conditionally
    executing SQL as part of the DDL lifecycle of those schema items.  Basic
    templating support allows a single DDL instance to handle repetitive tasks
    for multiple tables.

    Examples::

      tbl = Table('users', metadata, Column('uid', Integer)) # ...
      DDL('DROP TRIGGER users_trigger').execute_at('before-create', tbl)

      spow = DDL('ALTER TABLE %(table)s SET secretpowers TRUE', on='somedb')
      spow.execute_at('after-create', tbl)

      drop_spow = DDL('ALTER TABLE users SET secretpowers FALSE')
      connection.execute(drop_spow)

    When operating on Table events, the following ``statement``
    string substitions are available::

      %(table)s  - the Table name, with any required quoting applied
      %(schema)s - the schema name, with any required quoting applied
      %(fullname)s - the Table name including schema, quoted if needed

    The DDL's ``context``, if any, will be combined with the standard
    substutions noted above.  Keys present in the context will override
    the standard substitutions.

    R  c         C   s`   t  | t  s% t j d |   n  | |  _ | p7 i  |  _ |  j |  | |  _ | |  _ d S(   s  Create a DDL statement.

        :param statement:
          A string or unicode string to be executed.  Statements will be
          processed with Python's string formatting operator.  See the
          ``context`` argument and the ``execute_at`` method.

          A literal '%' in a statement must be escaped as '%%'.

          SQL bind parameters are not available in DDL statements.

        :param on:
          Optional filtering criteria.  May be a string, tuple or a callable
          predicate.  If a string, it will be compared to the name of the
          executing database dialect::

            DDL('something', on='postgresql')

          If a tuple, specifies multiple dialect names::

            DDL('something', on=('postgresql', 'mysql'))

          If a callable, it will be invoked with four positional arguments
          as well as optional keyword arguments:

            :ddl:
              This DDL element.

            :event:
              The name of the event that has triggered this DDL, such as
              'after-create' Will be None if the DDL is executed explicitly.

            :target:
              The ``Table`` or ``MetaData`` object which is the target of 
              this event. May be None if the DDL is executed explicitly.

            :connection:
              The ``Connection`` being used for DDL execution

            :tables:
              Optional keyword argument - a list of Table objects which are to
              be created/ dropped within a MetaData.create_all() or drop_all()
              method call.


          If the callable returns a true value, the DDL statement will be
          executed.

        :param context:
          Optional dictionary, defaults to None.  These values will be
          available for use in string substitutions on the DDL statement.

        :param bind:
          Optional. A :class:`~sqlalchemy.engine.base.Connectable`, used by
          default when ``execute()`` is invoked without a bind argument.

        s4   Expected a string or unicode SQL statement, got '%r'N(	   R{   R   R    Rg   t	   statementRC  RQ  R  R#  (   R$   R[  R  RC  R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRL   	  s    ;		c         C   sn   d t  |   j t |   d j t |  j  g g  d D]. } t |  |  r4 d | t |  |  f ^ q4  f S(   Ns   <%s@%s; %s>s   , R  RC  s   %s=%r(   s   ons   context(   R|   R-   t   idRo   R   R[  Ru   (   R$   RK   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR.   	  s    
N(   R-   R0   R1   R2   R"   RL   R.   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   h	  s   Hc         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    Rg   (   t   element(    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR  	  s
    c         C   s"   t  |  d  r |  j   }  n  |  S(   NR   (   R   R   (   R]  (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR  	  s    t   _CreateDropBasec           B   s&   e  Z d  Z d d d  Z d   Z RS(   s   Base class for DDL constucts that represent CREATE and DROP or
    equivalents.

    The common theme of _CreateDropBase is a single
    ``element`` attribute which refers to the element
    to be created or dropped.

    c         C   s,   | |  _  |  j |  | |  _ | |  _ d  S(   N(   R]  RQ  R  R   (   R$   R]  R  R   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRL   	  s    		c         C   s   t  S(   s   Allow disable of _create_rule using a callable.

        Pass to _create_rule using 
        util.portable_instancemethod(self._create_rule_disable)
        to retain serializability.

        (   RB   (   R$   t   compiler(    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   _create_rule_disable	  s    N(   R-   R0   R1   R"   RL   R`  (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR^  	  s   c           B   s   e  Z d  Z d Z RS(   s#   Represent a CREATE TABLE statement.t   create_table(   R-   R0   R1   R2   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   
  s   c           B   s   e  Z d  Z d Z RS(   s!   Represent a DROP TABLE statement.t
   drop_table(   R-   R0   R1   R2   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   
  s   c           B   s   e  Z d  Z d Z RS(   s&   Represent a CREATE SEQUENCE statement.t   create_sequence(   R-   R0   R1   R2   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   
  s   c           B   s   e  Z d  Z d Z RS(   s$   Represent a DROP SEQUENCE statement.t   drop_sequence(   R-   R0   R1   R2   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   
  s   t   CreateIndexc           B   s   e  Z d  Z d Z RS(   s#   Represent a CREATE INDEX statement.t   create_index(   R-   R0   R1   R2   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRe  
  s   t	   DropIndexc           B   s   e  Z d  Z d Z RS(   s!   Represent a DROP INDEX statement.t
   drop_index(   R-   R0   R1   R2   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRg  
  s   c           B   s   e  Z d  Z d Z d   Z RS(   s2   Represent an ALTER TABLE ADD CONSTRAINT statement.t   add_constraintc         O   s5   t  t |   j | | |  t j |  j  | _ d  S(   N(   RT   R   RL   R   t   portable_instancemethodR`  R  (   R$   R]  R%   RI   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRL   $
  s    (   R-   R0   R1   R2   RL   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   
  s   c           B   s    e  Z d  Z d Z e d  Z RS(   s3   Represent an ALTER TABLE DROP CONSTRAINT statement.t   drop_constraintc         K   s;   | |  _  t t |   j | |  t j |  j  | _ d  S(   N(   t   cascadeRT   R   RL   R   Rj  R`  R  (   R$   R]  Rl  RI   (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRL   .
  s    	(   R-   R0   R1   R2   RB   RL   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyR   )
  s   c         C   s   |  j  } | s |  j j } t |  d t |  d d    } | rR d | | f } n | } t |  t t f  rz d | } n
 d | } | d  k r d | | f } n  t j	 |   n  | S(   NRa   R6   s   %s %rs   the %s's .binds   this %s's .metadata.binds   The %s is not bound to an Engine or Connection.  Execution can not proceed without a database to execute against.  Either execute with an explicit connection or assign %s to enable implicit execution.(
   R   R,   R-   Ru   R"   R{   R   R   R    t   UnboundExecutionError(   t
   schemaitemRS   R   R6   t   labelR&   t   bindable(    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyRf   4
  s     		
(<   R1   Rm   R   R)  R    R   R   t   sqlalchemy.sqlR   R   t   importlaterR,  R   Rp   t   sortt   symbolR   t	   VisitableR   R8   R   R   R   R   R	   R   R   R
   R<   R   R   R   R   R  R   R   R   R   R   R   R   t   ClauseVisitorR   RW  R   RJ  R   R  R  R^  R   R   R   R   Re  Rg  R   R   R"   Rf   (    (    (    su   /afs/athena.mit.edu/user/x/a/xavid/.local/lib/python2.7/site-packages/SQLAlchemy-0.6.8-py2.6.egg/sqlalchemy/schema.pyt   <module>   sj   		
	   ""X=!>5/I @~s		
