%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyc

�
��4]c�@s�dZddlZddlZddlZddlZddlmZddlmZddlm	Z	ddlm
Zdd	lmZdd
lm
ZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
m Z ddl
m!Z!ddl
m"Z"ddl
m#Z#ddlm$Z$d fZ%d!fZ&d"fZ'd#fZ(d$fZ)d%fZ*e+d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�g��Z,d�ej-fd���YZ-d�ej.fd���YZ/d�ej0fd���YZ1d�ej2fd���YZ2e2Z3d�e4fd���YZ5d�e5ej6fd���YZ7d�e5ej6fd���YZ8d�e5ej6fd���YZ9d�ej:fd���YZ;d�e4fd���YZ<d�e<ej=fd���YZ>d�e<ej?fd���YZ@d�ejAfd���YZBd�eBfd���YZCd�ej?fd���YZDd�ejEejFfd���YZEd�ejFfd���YZGd�ejHfd���YZId�ej:fd���YZJdej:fd��YZKdej:fd��YZLdej:fd��YZMdej:fd��YZNe7ZOe1ZPe-ZQe/ZRe2ZSe8ZTe9ZUe;ZVe"ZWeDZXe#ZYe ZZeZ[eZ\eZ]eEZ^eGZ_eJZ`eKZaeLZbeMZceNZdied6ed	6e!d
6e/d6e#d6e d
6ed6ed6e"d6eDd6ed6ed6ed6ed6e9d6e;d6ed6e2d6e8d6ed6eEd6eJd6e-d6eGd6eId 6eBd!6eKd"6eLd#6eMd$6eNd%6Zed&ejffd'��YZgd(ejhfd)��YZid*ejjfd+��YZkd,ekfd-��YZld.ejmfd/��YZnd0ejofd1��YZpd2�Zqd3�Zrd4�Zsd5�Ztd6�Zud7ejvfd8��YZwdS(9s
Y
.. dialect:: mssql
    :name: Microsoft SQL Server


.. _mssql_identity:

Auto Increment Behavior / IDENTITY Columns
------------------------------------------

SQL Server provides so-called "auto incrementing" behavior using the
``IDENTITY`` construct, which can be placed on any single integer column in a
table. SQLAlchemy considers ``IDENTITY`` within its default "autoincrement"
behavior for an integer primary key column, described at
:paramref:`.Column.autoincrement`.  This means that by default, the first
integer primary key column in a :class:`.Table` will be considered to be the
identity column and will generate DDL as such::

    from sqlalchemy import Table, MetaData, Column, Integer

    m = MetaData()
    t = Table('t', m,
            Column('id', Integer, primary_key=True),
            Column('x', Integer))
    m.create_all(engine)

The above example will generate DDL as:

.. sourcecode:: sql

    CREATE TABLE t (
        id INTEGER NOT NULL IDENTITY(1,1),
        x INTEGER NULL,
        PRIMARY KEY (id)
    )

For the case where this default generation of ``IDENTITY`` is not desired,
specify ``False`` for the :paramref:`.Column.autoincrement` flag,
on the first integer primary key column::

    m = MetaData()
    t = Table('t', m,
            Column('id', Integer, primary_key=True, autoincrement=False),
            Column('x', Integer))
    m.create_all(engine)

To add the ``IDENTITY`` keyword to a non-primary key column, specify
``True`` for the :paramref:`.Column.autoincrement` flag on the desired
:class:`.Column` object, and ensure that :paramref:`.Column.autoincrement`
is set to ``False`` on any integer primary key column::

    m = MetaData()
    t = Table('t', m,
            Column('id', Integer, primary_key=True, autoincrement=False),
            Column('x', Integer, autoincrement=True))
    m.create_all(engine)

.. versionchanged::  1.3   Added ``mssql_identity_start`` and
   ``mssql_identity_increment`` parameters to :class:`.Column`.  These replace
   the use of the :class:`.Sequence` object in order to specify these values.

.. deprecated:: 1.3

   The use of :class:`.Sequence` to specify IDENTITY characteristics is
   deprecated and will be removed in a future release.   Please use
   the ``mssql_identity_start`` and ``mssql_identity_increment`` parameters
   documented at :ref:`mssql_identity`.

.. note::

    There can only be one IDENTITY column on the table.  When using
    ``autoincrement=True`` to enable the IDENTITY keyword, SQLAlchemy does not
    guard against multiple columns specifying the option simultaneously.  The
    SQL Server database will instead reject the ``CREATE TABLE`` statement.

.. note::

    An INSERT statement which attempts to provide a value for a column that is
    marked with IDENTITY will be rejected by SQL Server.   In order for the
    value to be accepted, a session-level option "SET IDENTITY_INSERT" must be
    enabled.   The SQLAlchemy SQL Server dialect will perform this operation
    automatically when using a core :class:`.Insert` construct; if the
    execution specifies a value for the IDENTITY column, the "IDENTITY_INSERT"
    option will be enabled for the span of that statement's invocation.However,
    this scenario is not high performing and should not be relied upon for
    normal use.   If a table doesn't actually require IDENTITY behavior in its
    integer primary key column, the keyword should be disabled when creating
    the table by ensuring that ``autoincrement=False`` is set.

Controlling "Start" and "Increment"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Specific control over the "start" and "increment" values for
the ``IDENTITY`` generator are provided using the
``mssql_identity_start`` and ``mssql_identity_increment`` parameters
passed to the :class:`.Column` object::

    from sqlalchemy import Table, Integer, Column

    test = Table(
        'test', metadata,
        Column(
            'id', Integer, primary_key=True, mssql_identity_start=100,
             mssql_identity_increment=10
        ),
        Column('name', String(20))
    )

The CREATE TABLE for the above :class:`.Table` object would be:

.. sourcecode:: sql

   CREATE TABLE test (
     id INTEGER NOT NULL IDENTITY(100,10) PRIMARY KEY,
     name VARCHAR(20) NULL,
     )

.. versionchanged:: 1.3  The ``mssql_identity_start`` and
   ``mssql_identity_increment`` parameters are now used to affect the
   ``IDENTITY`` generator for a :class:`.Column` under  SQL Server.
   Previously, the :class:`.Sequence` object was used.  As SQL Server now
   supports real sequences as a separate construct, :class:`.Sequence` will be
   functional in the normal way in a future SQLAlchemy version.

INSERT behavior
^^^^^^^^^^^^^^^^

Handling of the ``IDENTITY`` column at INSERT time involves two key
techniques. The most common is being able to fetch the "last inserted value"
for a given ``IDENTITY`` column, a process which SQLAlchemy performs
implicitly in many cases, most importantly within the ORM.

The process for fetching this value has several variants:

* In the vast majority of cases, RETURNING is used in conjunction with INSERT
  statements on SQL Server in order to get newly generated primary key values:

  .. sourcecode:: sql

    INSERT INTO t (x) OUTPUT inserted.id VALUES (?)

* When RETURNING is not available or has been disabled via
  ``implicit_returning=False``, either the ``scope_identity()`` function or
  the ``@@identity`` variable is used; behavior varies by backend:

  * when using PyODBC, the phrase ``; select scope_identity()`` will be
    appended to the end of the INSERT statement; a second result set will be
    fetched in order to receive the value.  Given a table as::

        t = Table('t', m, Column('id', Integer, primary_key=True),
                Column('x', Integer),
                implicit_returning=False)

    an INSERT will look like:

    .. sourcecode:: sql

        INSERT INTO t (x) VALUES (?); select scope_identity()

  * Other dialects such as pymssql will call upon
    ``SELECT scope_identity() AS lastrowid`` subsequent to an INSERT
    statement. If the flag ``use_scope_identity=False`` is passed to
    :func:`.create_engine`, the statement ``SELECT @@identity AS lastrowid``
    is used instead.

A table that contains an ``IDENTITY`` column will prohibit an INSERT statement
that refers to the identity column explicitly.  The SQLAlchemy dialect will
detect when an INSERT construct, created using a core :func:`.insert`
construct (not a plain string SQL), refers to the identity column, and
in this case will emit ``SET IDENTITY_INSERT ON`` prior to the insert
statement proceeding, and ``SET IDENTITY_INSERT OFF`` subsequent to the
execution.  Given this example::

    m = MetaData()
    t = Table('t', m, Column('id', Integer, primary_key=True),
                    Column('x', Integer))
    m.create_all(engine)

    engine.execute(t.insert(), {'id': 1, 'x':1}, {'id':2, 'x':2})

The above column will be created with IDENTITY, however the INSERT statement
we emit is specifying explicit values.  In the echo output we can see
how SQLAlchemy handles this:

.. sourcecode:: sql

    CREATE TABLE t (
        id INTEGER NOT NULL IDENTITY(1,1),
        x INTEGER NULL,
        PRIMARY KEY (id)
    )

    COMMIT
    SET IDENTITY_INSERT t ON
    INSERT INTO t (id, x) VALUES (?, ?)
    ((1, 1), (2, 2))
    SET IDENTITY_INSERT t OFF
    COMMIT



This
is an auxiliary use case suitable for testing and bulk insert scenarios.

MAX on VARCHAR / NVARCHAR
-------------------------

SQL Server supports the special string "MAX" within the
:class:`.sqltypes.VARCHAR` and :class:`.sqltypes.NVARCHAR` datatypes,
to indicate "maximum length possible".   The dialect currently handles this as
a length of "None" in the base type, rather than supplying a
dialect-specific version of these types, so that a base type
specified such as ``VARCHAR(None)`` can assume "unlengthed" behavior on
more than one backend without using dialect-specific types.

To build a SQL Server VARCHAR or NVARCHAR with MAX length, use None::

    my_table = Table(
        'my_table', metadata,
        Column('my_data', VARCHAR(None)),
        Column('my_n_data', NVARCHAR(None))
    )


Collation Support
-----------------

Character collations are supported by the base string types,
specified by the string argument "collation"::

    from sqlalchemy import VARCHAR
    Column('login', VARCHAR(32, collation='Latin1_General_CI_AS'))

When such a column is associated with a :class:`.Table`, the
CREATE TABLE statement for this column will yield::

    login VARCHAR(32) COLLATE Latin1_General_CI_AS NULL

LIMIT/OFFSET Support
--------------------

MSSQL has no support for the LIMIT or OFFSET keywords. LIMIT is
supported directly through the ``TOP`` Transact SQL keyword::

    select.limit

will yield::

    SELECT TOP n

If using SQL Server 2005 or above, LIMIT with OFFSET
support is available through the ``ROW_NUMBER OVER`` construct.
For versions below 2005, LIMIT with OFFSET usage will fail.

.. _mssql_isolation_level:

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

All SQL Server dialects support setting of transaction isolation level
both via a dialect-specific parameter
:paramref:`.create_engine.isolation_level`
accepted by :func:`.create_engine`,
as well as the :paramref:`.Connection.execution_options.isolation_level`
argument as passed to
:meth:`.Connection.execution_options`.  This feature works by issuing the
command ``SET TRANSACTION ISOLATION LEVEL <level>`` for
each new connection.

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

    engine = create_engine(
        "mssql+pyodbc://scott:tiger@ms_2008",
        isolation_level="REPEATABLE READ"
    )

To set using per-connection execution options::

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

Valid values for ``isolation_level`` include:

* ``AUTOCOMMIT`` - pyodbc / pymssql-specific
* ``READ COMMITTED``
* ``READ UNCOMMITTED``
* ``REPEATABLE READ``
* ``SERIALIZABLE``
* ``SNAPSHOT`` - specific to SQL Server

.. versionadded:: 1.1 support for isolation level setting on Microsoft
   SQL Server.

.. versionadded:: 1.2 added AUTOCOMMIT isolation level setting

Nullability
-----------
MSSQL has support for three levels of column nullability. The default
nullability allows nulls and is explicit in the CREATE TABLE
construct::

    name VARCHAR(20) NULL

If ``nullable=None`` is specified then no specification is made. In
other words the database's configured default is used. This will
render::

    name VARCHAR(20)

If ``nullable`` is ``True`` or ``False`` then the column will be
``NULL`` or ``NOT NULL`` respectively.

Date / Time Handling
--------------------
DATE and TIME are supported.   Bind parameters are converted
to datetime.datetime() objects as required by most MSSQL drivers,
and results are processed from strings if needed.
The DATE and TIME types are not available for MSSQL 2005 and
previous - if a server version below 2008 is detected, DDL
for these types will be issued as DATETIME.

.. _mssql_large_type_deprecation:

Large Text/Binary Type Deprecation
----------------------------------

Per
`SQL Server 2012/2014 Documentation <http://technet.microsoft.com/en-us/library/ms187993.aspx>`_,
the ``NTEXT``, ``TEXT`` and ``IMAGE`` datatypes are to be removed from SQL
Server in a future release.   SQLAlchemy normally relates these types to the
:class:`.UnicodeText`, :class:`.Text` and :class:`.LargeBinary` datatypes.

In order to accommodate this change, a new flag ``deprecate_large_types``
is added to the dialect, which will be automatically set based on detection
of the server version in use, if not otherwise set by the user.  The
behavior of this flag is as follows:

* When this flag is ``True``, the :class:`.UnicodeText`, :class:`.Text` and
  :class:`.LargeBinary` datatypes, when used to render DDL, will render the
  types ``NVARCHAR(max)``, ``VARCHAR(max)``, and ``VARBINARY(max)``,
  respectively.  This is a new behavior as of the addition of this flag.

* When this flag is ``False``, the :class:`.UnicodeText`, :class:`.Text` and
  :class:`.LargeBinary` datatypes, when used to render DDL, will render the
  types ``NTEXT``, ``TEXT``, and ``IMAGE``,
  respectively.  This is the long-standing behavior of these types.

* The flag begins with the value ``None``, before a database connection is
  established.   If the dialect is used to render DDL without the flag being
  set, it is interpreted the same as ``False``.

* On first connection, the dialect detects if SQL Server version 2012 or
  greater is in use; if the flag is still at ``None``, it sets it to ``True``
  or ``False`` based on whether 2012 or greater is detected.

* The flag can be set to either ``True`` or ``False`` when the dialect
  is created, typically via :func:`.create_engine`::

        eng = create_engine("mssql+pymssql://user:pass@host/db",
                        deprecate_large_types=True)

* Complete control over whether the "old" or "new" types are rendered is
  available in all SQLAlchemy versions by using the UPPERCASE type objects
  instead: :class:`.NVARCHAR`, :class:`.VARCHAR`, :class:`.types.VARBINARY`,
  :class:`.TEXT`, :class:`.mssql.NTEXT`, :class:`.mssql.IMAGE` will always
  remain fixed and always output exactly that type.

.. versionadded:: 1.0.0

.. _multipart_schema_names:

Multipart Schema Names
----------------------

SQL Server schemas sometimes require multiple parts to their "schema"
qualifier, that is, including the database name and owner name as separate
tokens, such as ``mydatabase.dbo.some_table``. These multipart names can be set
at once using the :paramref:`.Table.schema` argument of :class:`.Table`::

    Table(
        "some_table", metadata,
        Column("q", String(50)),
        schema="mydatabase.dbo"
    )

When performing operations such as table or component reflection, a schema
argument that contains a dot will be split into separate
"database" and "owner"  components in order to correctly query the SQL
Server information schema tables, as these two values are stored separately.
Additionally, when rendering the schema name for DDL or SQL, the two
components will be quoted separately for case sensitive names and other
special characters.   Given an argument as below::

    Table(
        "some_table", metadata,
        Column("q", String(50)),
        schema="MyDataBase.dbo"
    )

The above schema would be rendered as ``[MyDataBase].dbo``, and also in
reflection, would be reflected using "dbo" as the owner and "MyDataBase"
as the database name.

To control how the schema name is broken into database / owner,
specify brackets (which in SQL Server are quoting characters) in the name.
Below, the "owner" will be considered as ``MyDataBase.dbo`` and the
"database" will be None::

    Table(
        "some_table", metadata,
        Column("q", String(50)),
        schema="[MyDataBase.dbo]"
    )

To individually specify both database and owner name with special characters
or embedded dots, use two sets of brackets::

    Table(
        "some_table", metadata,
        Column("q", String(50)),
        schema="[MyDataBase.Period].[MyOwner.Dot]"
    )


.. versionchanged:: 1.2 the SQL Server dialect now treats brackets as
   identifier delimeters splitting the schema into separate database
   and owner tokens, to allow dots within either name itself.

.. _legacy_schema_rendering:

Legacy Schema Mode
------------------

Very old versions of the MSSQL dialect introduced the behavior such that a
schema-qualified table would be auto-aliased when used in a
SELECT statement; given a table::

    account_table = Table(
        'account', metadata,
        Column('id', Integer, primary_key=True),
        Column('info', String(100)),
        schema="customer_schema"
    )

this legacy mode of rendering would assume that "customer_schema.account"
would not be accepted by all parts of the SQL statement, as illustrated
below::

    >>> eng = create_engine("mssql+pymssql://mydsn", legacy_schema_aliasing=True)
    >>> print(account_table.select().compile(eng))
    SELECT account_1.id, account_1.info
    FROM customer_schema.account AS account_1

This mode of behavior is now off by default, as it appears to have served
no purpose; however in the case that legacy applications rely upon it,
it is available using the ``legacy_schema_aliasing`` argument to
:func:`.create_engine` as illustrated above.

.. versionchanged:: 1.1 the ``legacy_schema_aliasing`` flag introduced
   in version 1.0.5 to allow disabling of legacy mode for schemas now
   defaults to False.


.. _mssql_indexes:

Clustered Index Support
-----------------------

The MSSQL dialect supports clustered indexes (and primary keys) via the
``mssql_clustered`` option.  This option is available to :class:`.Index`,
:class:`.UniqueConstraint`. and :class:`.PrimaryKeyConstraint`.

To generate a clustered index::

    Index("my_index", table.c.x, mssql_clustered=True)

which renders the index as ``CREATE CLUSTERED INDEX my_index ON table (x)``.

To generate a clustered primary key use::

    Table('my_table', metadata,
          Column('x', ...),
          Column('y', ...),
          PrimaryKeyConstraint("x", "y", mssql_clustered=True))

which will render the table, for example, as::

  CREATE TABLE my_table (x INTEGER NOT NULL, y INTEGER NOT NULL,
                         PRIMARY KEY CLUSTERED (x, y))

Similarly, we can generate a clustered unique constraint using::

    Table('my_table', metadata,
          Column('x', ...),
          Column('y', ...),
          PrimaryKeyConstraint("x"),
          UniqueConstraint("y", mssql_clustered=True),
          )

To explicitly request a non-clustered primary key (for example, when
a separate clustered index is desired), use::

    Table('my_table', metadata,
          Column('x', ...),
          Column('y', ...),
          PrimaryKeyConstraint("x", "y", mssql_clustered=False))

which will render the table, for example, as::

  CREATE TABLE my_table (x INTEGER NOT NULL, y INTEGER NOT NULL,
                         PRIMARY KEY NONCLUSTERED (x, y))

.. versionchanged:: 1.1 the ``mssql_clustered`` option now defaults
   to None, rather than False.  ``mssql_clustered=False`` now explicitly
   renders the NONCLUSTERED clause, whereas None omits the CLUSTERED
   clause entirely, allowing SQL Server defaults to take effect.


MSSQL-Specific Index Options
-----------------------------

In addition to clustering, the MSSQL dialect supports other special options
for :class:`.Index`.

INCLUDE
^^^^^^^

The ``mssql_include`` option renders INCLUDE(colname) for the given string
names::

    Index("my_index", table.c.x, mssql_include=['y'])

would render the index as ``CREATE INDEX my_index ON table (x) INCLUDE (y)``

.. _mssql_index_where:

Filtered Indexes
^^^^^^^^^^^^^^^^

The ``mssql_where`` option renders WHERE(condition) for the given string
names::

    Index("my_index", table.c.x, mssql_where=table.c.x > 10)

would render the index as ``CREATE INDEX my_index ON table (x) WHERE x > 10``.

.. versionadded:: 1.3.4

Index ordering
^^^^^^^^^^^^^^

Index ordering is available via functional expressions, such as::

    Index("my_index", table.c.x.desc())

would render the index as ``CREATE INDEX my_index ON table (x DESC)``

.. seealso::

    :ref:`schema_indexes_functional`

Compatibility Levels
--------------------
MSSQL supports the notion of setting compatibility levels at the
database level. This allows, for instance, to run a database that
is compatible with SQL2000 while running on a SQL2005 database
server. ``server_version_info`` will always return the database
server version information (in this case SQL2005) and not the
compatibility level information. Because of this, if running under
a backwards compatibility mode SQLAlchemy may attempt to use T-SQL
statements that are unable to be parsed by the database server.

Triggers
--------

SQLAlchemy by default uses OUTPUT INSERTED to get at newly
generated primary key values via IDENTITY columns or other
server side defaults.   MS-SQL does not
allow the usage of OUTPUT INSERTED on tables that have triggers.
To disable the usage of OUTPUT INSERTED on a per-table basis,
specify ``implicit_returning=False`` for each :class:`.Table`
which has triggers::

    Table('mytable', metadata,
        Column('id', Integer, primary_key=True),
        # ...,
        implicit_returning=False
    )

Declarative form::

    class MyClass(Base):
        # ...
        __table_args__ = {'implicit_returning':False}


This option can also be specified engine-wide using the
``implicit_returning=False`` argument on :func:`.create_engine`.

.. _mssql_rowcount_versioning:

Rowcount Support / ORM Versioning
---------------------------------

The SQL Server drivers may have limited ability to return the number
of rows updated from an UPDATE or DELETE statement.

As of this writing, the PyODBC driver is not able to return a rowcount when
OUTPUT INSERTED is used.  This impacts the SQLAlchemy ORM's versioning feature
in many cases where server-side value generators are in use in that while the
versioning operations can succeed, the ORM cannot always check that an UPDATE
or DELETE statement matched the number of rows expected, which is how it
verifies that the version identifier matched.   When this condition occurs, a
warning will be emitted but the operation will proceed.

The use of OUTPUT INSERTED can be disabled by setting the
:paramref:`.Table.implicit_returning` flag to ``False`` on a particular
:class:`.Table`, which in declarative looks like::

    class MyTable(Base):
        __tablename__ = 'mytable'
        id = Column(Integer, primary_key=True)
        stuff = Column(String(10))
        timestamp = Column(TIMESTAMP(), default=text('DEFAULT'))
        __mapper_args__ = {
            'version_id_col': timestamp,
            'version_id_generator': False,
        }
        __table_args__ = {
            'implicit_returning': False
        }

Enabling Snapshot Isolation
---------------------------

SQL Server has a default transaction
isolation mode that locks entire tables, and causes even mildly concurrent
applications to have long held locks and frequent deadlocks.
Enabling snapshot isolation for the database as a whole is recommended
for modern levels of concurrency support.  This is accomplished via the
following ALTER DATABASE commands executed at the SQL prompt::

    ALTER DATABASE MyDatabase SET ALLOW_SNAPSHOT_ISOLATION ON

    ALTER DATABASE MyDatabase SET READ_COMMITTED_SNAPSHOT ON

Background on SQL Server snapshot isolation is available at
http://msdn.microsoft.com/en-us/library/ms175095.aspx.

i����Ni(tinformation_schemai(tengine(texc(tschema(tsql(ttypes(tutil(tdefault(t
reflection(tcompiler(t
expression(tquoted_name(tBIGINT(tBINARY(tCHAR(tDATE(tDATETIME(tDECIMAL(tFLOAT(tINTEGER(tNCHAR(tNUMERIC(tNVARCHAR(tSMALLINT(tTEXT(tVARCHAR(tupdate_wrapperi
iii
i	itaddtalltaltertandtanytastasct
authorizationtbackuptbegintbetweentbreaktbrowsetbulktbytcascadetcasetcheckt
checkpointtcloset	clusteredtcoalescetcollatetcolumntcommittcomputet
constrainttcontainst
containstabletcontinuetconverttcreatetcrosstcurrenttcurrent_datetcurrent_timetcurrent_timestamptcurrent_usertcursortdatabasetdbcct
deallocatetdeclareRtdeletetdenytdesctdisktdistincttdistributedtdoubletdroptdumptelsetendterrlvltescapetexcepttexectexecutetexiststexittexternaltfetchtfilet
fillfactortfortforeigntfreetextt
freetexttabletfromtfulltfunctiontgototgranttgroupthavingtholdlocktidentitytidentity_inserttidentitycoltiftintindextinnertinsertt	intersecttintotistjointkeytkilltlefttliketlinenotloadtmergetnationaltnochecktnonclusteredtnottnulltnulliftoftofftoffsetstontopentopendatasourcet	openqueryt
openrowsettopenxmltoptiontortordertoutertovertpercenttpivottplant	precisiontprimarytprinttproct	proceduretpublict	raiserrortreadtreadtexttreconfiguret
referencestreplicationtrestoretrestricttreturntreverttrevoketrighttrollbacktrowcountt
rowguidcoltruletsaveRt
securityaudittselecttsession_usertsettsetusertshutdowntsomet
statisticstsystem_userttablettablesamplettextsizetthenttottopttranttransactionttriggerttruncatettsequaltuniontuniquetunpivottupdatet
updatetexttusetusertvaluestvaryingtviewtwaitfortwhentwheretwhiletwitht	writetexttREALcBseZdZd�ZRS(R�cKs*|jdd�tt|�j|�dS(NR�i(t
setdefaulttsuperR�t__init__(tselftkw((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR�|s(t__name__t
__module__t__visit_name__R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR�ystTINYINTcBseZdZRS(R�(R�R�R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��st_MSDatecBs)eZd�Zejd�Zd�ZRS(cCs
d�}|S(NcSs9t|�tjkr1tj|j|j|j�S|SdS(N(ttypetdatetimetdatetyeartmonthtday(tvalue((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytprocess�s((R�tdialectR�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytbind_processor�s	s(\d+)-(\d+)-(\d+)cs�fd�}|S(Ncs�t|tj�r|j�St|tj�r��jj|�}|s\td|f��ntjg|j�D]}t	|p�d�^qo�S|SdS(Ns"could not parse %r as a date valuei(
t
isinstanceR�R�Rtstring_typest_regtmatcht
ValueErrortgroupstint(R�tmtx(R�(sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��s
2((R�R�tcoltypeR�((R�sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytresult_processor�s
(R�R�R�tretcompileR�R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��s		tTIMEcBsJeZdd�Zejddd�Zd�Zej	d�Z
d�ZRS(cKs ||_tt|�j�dS(N(R�R�R�R�(R�R�tkwargs((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��s	ilics�fd�}|S(Ncsdt|tj�r3tjj�j|j��}n-t|tj�r`tjj�j|�}n|S(N(R�R�tcombinet_TIME__zero_datettime(R�(R�(sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��s	((R�R�R�((R�sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��s	s!(\d+):(\d+):(\d+)(?:\.(\d{0,6}))?cs�fd�}|S(Ncs�t|tj�r|j�St|tj�r��jj|�}|s\td|f��ntjg|j�D]}t	|p�d�^qo�S|SdS(Ns"could not parse %r as a time valuei(
R�R�R�RR�R�R�R�R�R�(R�R�R�(R�(sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��s
2((R�R�R�R�((R�sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��s
N(R�R�tNoneR�R�R�R�R�R�R�R�R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��s
	t
_DateTimeBasecBseZd�ZRS(cCs
d�}|S(NcSs9t|�tjkr1tj|j|j|j�S|SdS(N(R�R�R�R�R�R�(R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��s((R�R�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��s	(R�R�R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��st_MSDateTimecBseZRS((R�R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��st
SMALLDATETIMEcBseZdZRS(R�(R�R�R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��st	DATETIME2cBseZdZdd�ZRS(R�cKs#tt|�j|�||_dS(N(R�R�R�R�(R�R�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��sN(R�R�R�R�R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��stDATETIMEOFFSETcBseZdZdd�ZRS(R�cKs
||_dS(N(R�(R�R�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��sN(R�R�R�R�R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��st_UnicodeLiteralcBseZd�ZRS(cs�fd�}|S(Ncs;|jdd�}�jjr3|jdd�}nd|S(Nt's''t%s%%sN'%s'(treplacetidentifier_preparert_double_percents(R�(R�(sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��s((R�R�R�((R�sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytliteral_processor�s	(R�R�R(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��st
_MSUnicodecBseZRS((R�R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyRst_MSUnicodeTextcBseZRS((R�R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR	st	TIMESTAMPcBs/eZdZdZdZed�Zd�ZRS(sBImplement the SQL Server TIMESTAMP type.

    Note this is **completely different** than the SQL Standard
    TIMESTAMP type, which is not supported by SQL Server.  It
    is a read-only datatype that does not support INSERT of values.

    .. versionadded:: 1.2

    .. seealso::

        :class:`.mssql.ROWVERSION`

    RcCs
||_dS(s�Construct a TIMESTAMP or ROWVERSION type.

        :param convert_int: if True, binary integer values will
         be converted to integers on read.

        .. versionadded:: 1.2

        N(tconvert_int(R�R((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR�!s	cs?tt|�j||��|jr7�fd�}|S�SdS(Ncs:�|�}|dk	r6ttj|d�d�}n|S(Nthexi(R�R�tcodecstencode(R�(tsuper_(sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR�0s(R�RR�R(R�R�R�R�((RsQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR�,s
	N(	R�R�t__doc__R�R�tlengthtFalseR�R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR
s

t
ROWVERSIONcBseZdZdZRS(s(Implement the SQL Server ROWVERSION type.

    The ROWVERSION datatype is a SQL Server synonym for the TIMESTAMP
    datatype, however current SQL Server documentation suggests using
    ROWVERSION for new datatypes going forward.

    The ROWVERSION datatype does **not** reflect (e.g. introspect) from the
    database as itself; the returned datatype will be
    :class:`.mssql.TIMESTAMP`.

    This is a read-only datatype that does not support INSERT of values.

    .. versionadded:: 1.2

    .. seealso::

        :class:`.mssql.TIMESTAMP`

    R(R�R�R	R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR<stNTEXTcBseZdZdZRS(sMMSSQL NTEXT type, for variable-length unicode text up to 2^30
    characters.R
(R�R�R	R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR
Tst	VARBINARYcBseZdZdZRS(sGThe MSSQL VARBINARY type.

    This type is present to support "deprecate_large_types" mode where
    either ``VARBINARY(max)`` or IMAGE is rendered.   Otherwise, this type
    object is redundant vs. :class:`.types.VARBINARY`.

    .. versionadded:: 1.0.0

    .. seealso::

        :ref:`mssql_large_type_deprecation`



    R(R�R�R	R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR\stIMAGEcBseZdZRS(R(R�R�R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyRpstXMLcBseZdZdZRS(s"MSSQL XML type.

    This is a placeholder type for reflection purposes that does not include
    any Python-side datatype support.   It also does not currently support
    additional arguments, such as "CONTENT", "DOCUMENT",
    "xml_schema_collection".

    .. versionadded:: 1.1.11

    R(R�R�R	R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyRts
tBITcBseZdZRS(R(R�R�R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR�stMONEYcBseZdZRS(R(R�R�R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR�st
SMALLMONEYcBseZdZRS(R(R�R�R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR�stUNIQUEIDENTIFIERcBseZdZRS(R(R�R�R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR�stSQL_VARIANTcBseZdZRS(R(R�R�R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR�sR�tbiginttsmallintttinyinttvarchartnvarchartchartncharttexttntexttdecimaltnumerictfloatR�t	datetime2tdatetimeoffsetR�R�t
smalldatetimetbinaryt	varbinarytbittrealtimagetxmlt	timestamptmoneyt
smallmoneytuniqueidentifiertsql_varianttMSTypeCompilercBseZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z RS(cCs�t|dd�r"d|j}nd}|s:|j}n|rQ|d|}ndjg||fD]}|dk	rd|^qd�S(sYExtend a string-type declaration with standard SQL
        COLLATE annotations.

        t	collations
COLLATE %ss(%s)t N(tgetattrR�R1R
Rs(R�tspecttype_R
R1tc((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyt_extend�scKs5t|dd�}|dkr"dSdi|d6SdS(NR�RsFLOAT(%(precision)s)(R3R�(R�R5R�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_FLOAT�scKsdS(NR�((R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyt
visit_TINYINT�scKs"|jdk	rd|jSdSdS(NsDATETIMEOFFSET(%s)R�(R�R�(R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_DATETIMEOFFSET�scKs.t|dd�}|dk	r&d|SdSdS(NR�sTIME(%s)R�(R3R�(R�R5R�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyt
visit_TIME�scKsdS(NR((R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_TIMESTAMP�scKsdS(NR((R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_ROWVERSION�scKs.t|dd�}|dk	r&d|SdSdS(NR�s
DATETIME2(%s)R�(R3R�(R�R5R�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_DATETIME2scKsdS(NR�((R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_SMALLDATETIME	scKs|j||�S(N(tvisit_NVARCHAR(R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyt
visit_unicodescKs0|jjr|j||�S|j||�SdS(N(R�tdeprecate_large_typest
visit_VARCHARt
visit_TEXT(R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyt
visit_textscKs0|jjr|j||�S|j||�SdS(N(R�RBR@tvisit_NTEXT(R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_unicode_textscKs|jd|�S(NR
(R7(R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyRFscKs|jd|�S(NR(R7(R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyRDscKs|jd|d|jpd�S(NRR
tmax(R7R
(R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyRC!scKs|jd|�S(NR(R7(R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyt
visit_CHAR$scKs|jd|�S(NR(R7(R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_NCHAR'scKs|jd|d|jpd�S(NRR
RH(R7R
(R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR@*scKs6|jjtkr"|j||�S|j||�SdS(N(R�tserver_version_infotMS_2008_VERSIONtvisit_DATETIMEt
visit_DATE(R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyt
visit_date-scKs6|jjtkr"|j||�S|j||�SdS(N(R�RKRLRMR;(R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyt
visit_time3scKs0|jjr|j||�S|j||�SdS(N(R�RBtvisit_VARBINARYtvisit_IMAGE(R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_large_binary9scKsdS(NR((R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyRR?scKsdS(NR((R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyt	visit_XMLBscKs|jd|d|jpd�S(NRR
RH(R7R
(R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyRQEscKs
|j|�S(N(t	visit_BIT(R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyt
visit_booleanHscKsdS(NR((R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyRUKscKsdS(NR((R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_MONEYNscKsdS(NR((R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_SMALLMONEYQscKsdS(NR((R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_UNIQUEIDENTIFIERTscKsdS(NR((R�R5R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_SQL_VARIANTWsN(!R�R�R�R7R8R9R:R;R<R=R>R?RARERGRFRDRCRIRJR@RORPRSRRRTRQRVRURWRXRYRZ(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR0�s<																												tMSExecutionContextcBsVeZeZeZdZdZd�Zd�Z	d�Z
d�Zd�Zd�Z
RS(cCs(|jjs |jj|�dS|SdS(Ni(R�tsupports_unicode_statementst_encoder(R�t	statement((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyt_opt_encodeascCsj|jrf|jjj}|j}|dk	}|r�|j|jdkp�|jjjo�|jjj	r�|j|jjjdkp�||jjjdkp�|jjj	o�|j|jjjkp�||jjjk|_
n	t|_
|jjo|o|jj
o|j
o|j|_|j
rf|jj|j|jd|jjj|��d|�qfndS(s#Activate IDENTITY_INSERT if needed.isSET IDENTITY_INSERT %s ONN((tisinserttcompiledR^R�t_autoincrement_columnR�Rttcompiled_parameterst
parameterst_has_multi_parameterst_enable_identity_insertRtinlinet	returningtexecutemanyt_select_lastrowidtroot_connectiont_cursor_executeRAR_R�R�tformat_table(R�ttblt
seq_columntinsert_has_sequence((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytpre_execgs>			



		cCs|j}|jr||jjr:|j|jdd|�n|j|jdd|�|jj�d}t|d�|_n|j	s�|j
s�|jr�|jj
r�tj|�|_n|jr|j|j|jd|jjj|jjj��d|�ndS(	s#Disable IDENTITY_INSERT if enabled.s$SELECT scope_identity() AS lastrowidsSELECT @@identity AS lastrowidisSET IDENTITY_INSERT %s OFFN((((RkRjR�tuse_scope_identityRlRAtfetchallR�t
_lastrowidR`tisupdatetisdeleteRaRhRtFullyBufferedResultProxyt
_result_proxyRfR_R�RmR^R�(R�tconntrow((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyt	post_exec�s0		
	cCs|jS(N(Rt(R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyt
get_lastrowid�scCs]|jrYy9|jj|jd|jjj|jjj	���WqYt
k
rUqYXndS(NsSET IDENTITY_INSERT %s OFF(RfRARUR_R�R�RmRaR^R�t	Exception(R�te((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pythandle_dbapi_exception�s		
cCs!|jr|jStj|�SdS(N(RxRtResultProxy(R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytget_result_proxy�s	N(R�R�RRfRjR�RxRtR_RqR{R|RR�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR[[s		8	&		t
MSSQLCompilercBs}eZeZejejjidd6dd6dd6dd6�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Ze
eed��Ze
d��Ze
d(d��Zd�Zd�Zd�Zd�Z d�Z!d�Z"d �Z#d!�Z$d"�Z%d#�Z&d$�Z'd%�Z(d&�Z)d'�Z*RS()t	dayofyeartdoytweekdaytdowtmillisecondtmillisecondstmicrosecondtmicrosecondscOs&i|_tt|�j||�dS(N(ttablealiasesR�R�R�(R�targsR�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��s	cs�fd�}|S(NcsH|jjr�|||�Sttt|��j�}|||�SdS(N(R�tlegacy_schema_aliasingR3R�R�R�(R�targR�R(tfn(sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytdecorate�s((R�R�((R�sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyt_with_legacy_schema_aliasing�scKsdS(NtCURRENT_TIMESTAMP((R�R�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_now_func�scKsdS(Ns	GETDATE()((R�R�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_current_date_func�scKsd|j||�S(NsLEN%s(tfunction_argspec(R�R�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_length_func�scKsd|j||�S(NsLEN%s(R�(R�R�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_char_length_funcscKs,d|j|j|�|j|j|�fS(Ns%s + %s(R�RvR�(R�R%toperatorR�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_concat_op_binaryscKsdS(Nt1((R�texprR�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyt
visit_true
scKsdS(Nt0((R�R�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_false
scKs,d|j|j|�|j|j|�fS(NsCONTAINS (%s, %s)(R�RvR�(R�R%R�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_match_op_binaryscKsgd}|jr|d7}n|jrC|jrC|d|j7}n|rM|Stjj|||�SdS(s- MS-SQL puts TOP, it's version of LIMIT here ts	DISTINCT sTOP %d N(t	_distinctt_simple_int_limitt_offsett_limitR	tSQLCompilertget_select_precolumns(R�R�R�ts((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR�s	
	cCs|S(N((R�R�R((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytget_from_hint_text*scCs|S(N((R�R�R((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytget_crud_hint_text-scKsdS(NR�((R�R�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytlimit_clause0sc
Ks�|jr|jdk	s;|jdk	r2|js;|jr�t|dd�r�|jjslt	j
d��ng|jjD]}tj|�^qy}|j}|j}||d<|j
�}t|_|jtjj�jd|�jd��jd�j�}tjd�}tjg|jD]}|jdkr |^q �}	|dk	r�|	j||k�|dk	r�|	j|||k�q�n|	j||k�|j|	|�Stjj|||�SdS(s�Look for ``LIMIT`` and OFFSET in a select statement, and if
        so tries to wrap it in a subquery with ``row_number()`` criterion.

        t_mssql_visitsLMSSQL requires an order_by when using an OFFSET or a non-simple LIMIT clausetselect_wraps_fortorder_bytmssql_rnN( R�t
_limit_clauseR�t_offset_clauset_simple_int_offsetR�R3t_order_by_clausetclausesRtCompileErrortsql_utiltunwrap_label_referencet	_generatetTrueR�R2Rtfunct
ROW_NUMBERR�tlabelR�taliasR�R6Rttappend_whereclauseR�R	R�tvisit_select(
R�R�R�telemt_order_by_clausesR�t
offset_clauseR�R6tlimitselect((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR�4s>
	%		
		.cKsy||ks|r+tt|�j||�S|j|�}|dk	r\|j|d||�Stt|�j||�SdS(Nt
mssql_aliased(R�R�tvisit_tablet_schema_aliased_tableR�R�(R�R�R�tiscrudR�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR�nscKs&|j|d<tt|�j||�S(NR�(toriginalR�R�tvisit_alias(R�R�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR�zs
cKs�|jdk	r#|jr#|js/|j�r�|j|j�}|dk	r�tj||�}|dk	r�||j|j||j|j	f|j
�ntt|�j
||�Sntt|�j
|d||�S(Ntadd_to_result_map(R�R�RuRvtis_subqueryR�R
t_corresponding_column_or_errortnameRtR�R�R�tvisit_column(R�R2R�R�ttt	converted((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��s 
cCsPt|dd�dk	rH||jkr=|j�|j|<n|j|SdSdS(NR(R3R�R�R�(R�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��s
cKs8|jj|j|j�}d||j|j|�fS(NsDATEPART(%s, %s)(textract_maptgettfieldR�R�(R�textractR�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyt
visit_extract�scCsd|jj|�S(NsSAVE TRANSACTION %s(tpreparertformat_savepoint(R�tsavepoint_stmt((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_savepoint�scCsd|jj|�S(NsROLLBACK TRANSACTION %s(R�R�(R�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_rollback_to_savepoint�scKs~t|jtj�re|jtjkret|jtj�re|jtj|j|j|j�|�St	t
|�j||�S(s]Move bind parameters to the right-hand side of an operator, where
        possible.

        (R�RvR
t
BindParameterR�teqR�R�tBinaryExpressionR�R�tvisit_binary(R�R%R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��scCs�|js|jr'|jjd�}n|jjd�}tj|�}gtj|�D]*}|jd|j
|�tti�^qX}ddj
|�S(NtinsertedtdeletedsOUTPUT s, (R`RuR�R�R�t
ClauseAdapterR
t_select_iterablest_label_select_columnR�ttraverseR�RRs(R�tstmttreturning_colsttargettadapterR6tcolumns((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytreturning_clause�s=cCsdS(NtWITH((R�t	recursive((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytget_cte_preamble�scCs?t|tj�r|jd�Stt|�j|||�SdS(N(R�R
tFunctionR�R�R�R�tlabel_select_column(R�R�R2tasfrom((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��s
cCsdS(NR�((R�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytfor_update_clause�scKsE|j�r|jrdS|j|j|�}|r=d|SdSdS(NR�s
 ORDER BY (R�R�R�R�(R�R�R�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytorder_by_clause�scs.ddj���fd�|g|D��S(sRender the UPDATE..FROM clause specific to MSSQL.

        In MSSQL, if the UPDATE statement involves an alias of the table to
        be updated, then the table itself must be added to the FROM list as
        well. Otherwise, it is optional. Here, we add it regardless.

        sFROM s, c3s-|]#}|j�dtd���VqdS(R�t	fromhintsN(t_compiler_dispatchR�(t.0R�(t
from_hintsR�R�(sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pys	<genexpr>s(Rs(R�tupdate_stmtt
from_tabletextra_fromsR�R�((R�R�R�sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytupdate_from_clause�s
	cCs4t}|rt}n|j|dtdtd|�S(s=If we have extra froms make sure we render any alias as hint.R�R�tashint(RR�R�(R�tdelete_stmtR�R�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytdelete_table_clauses
	cs.ddj���fd�|g|D��S(sjRender the DELETE .. FROM clause specific to MSSQL.

        Yes, it has the FROM keyword twice.

        sFROM s, c3s-|]#}|j�dtd���VqdS(R�R�N(R�R�(R�R�(R�R�R�(sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pys	<genexpr>s(Rs(R�R�R�R�R�R�((R�R�R�sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytdelete_extra_from_clauses	cCsdS(NsSELECT 1 WHERE 1!=1((R�R5((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_empty_set_exprsN(+R�R�R�treturning_precedes_valuesRtupdate_copyR	R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�RR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��sT	
		
													:														
tMSSQLStrictCompilercBs/eZdZeZd�Zd�Zd�ZRS(s�A subclass of MSSQLCompiler which disables the usage of bind
    parameters where not allowed natively by MS-SQL.

    A dialect may use this compiler on a platform where native
    binds are used.

    cKs6t|d<d|j|j|�|j|j|�fS(Nt
literal_bindss%s IN %s(R�R�RvR�(R�R%R�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_in_op_binary-s
cKs6t|d<d|j|j|�|j|j|�fS(NRs%s NOT IN %s(R�R�RvR�(R�R%R�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_notin_op_binary4s
cCsGtt|�tj�r*dt|�dStt|�j||�SdS(s5
        For date and datetime values, convert to a string
        format acceptable to MSSQL. That seems to be the
        so-called ODBC canonical date format which looks
        like this:

            yyyy-mm-dd hh:mi:ss.mmm(24h)

        For other data types, call the base class implementation.
        R�N(t
issubclassR�R�R�tstrR�Rtrender_literal_value(R�R�R5((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR;s(R�R�R	R�tansi_bind_rulesRRR(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR!s
		t
MSDDLCompilercBs8eZd�Zed�Zd�Zd�Zd�ZRS(cKs�|jj|�d|jjj|jd|�}|jdk	r�|jsx|jsxt	|j
tj�sx|j
tkr�|d7}q�|d7}n|jdkr�tjd��nt	|j
tj�r^|j
jdk	s�|j
jdk	s�||jjk	rtjd�n|j
jdkr)d}n|j
jp8d}|d	||j
jpSdf7}n�||jjks|j
tkr�|jd
d}|jd
d}|d	||f7}n,|j|�}|dk	r�|d
|7}n|S(NR2ttype_expressions	 NOT NULLs NULLs;mssql requires Table-bound columns in order to generate DDLs
Use of Sequence with SQL Server in order to affect the parameters of the IDENTITY value is deprecated, as Sequence will correspond to an actual SQL Server CREATE SEQUENCE in a future release.  Please use the mssql_identity_start and mssql_identity_increment parameters.iis IDENTITY(%s,%s)tmssqltidentity_starttidentity_increments	 DEFAULT (R�t
format_columnR�t
type_compilerR�R�tnullableR�tprimary_keyR�Rt	sa_schematSequencet
autoincrementR�R�RR�tstartt	incrementRbRtwarn_deprecatedtdialect_optionstget_column_default_string(R�R2R�tcolspecRRR((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytget_column_specificationQsB
	


	cs�|j}�j|��j}d}|jr;|d7}n|jdd}|dk	rx|rk|d7}qx|d7}n|d�j|d|�|j|j�d	j	�fd
�|j
D��f7}|jdd}|dk	r�jj|dt
d
t�}|d|7}n|jddr�g|jddD].}	t|	tj�r]|jj|	n|	^q5}
|dd	j	g|
D]}|j|j�^q|�7}n|S(NsCREATE sUNIQUE RR/s
CLUSTERED s
NONCLUSTERED sINDEX %s ON %s (%s)tinclude_schemas, c3s-|]#}�jj|dtdt�VqdS(t
include_tableRN(tsql_compilerR�RR�(R�R�(R�(sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pys	<genexpr>�sR�RRs WHERE tincludes
 INCLUDE (%s)(telementt_verify_index_tableR�R�RR�t_prepared_index_nameRmR�RstexpressionsRR�RR�R�RR�R6tquoteR�(R�R:RRmR�RR/twhereclausetwhere_compiledtcolt
inclusionsR6((R�sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_create_index�s8	
		


	C-cCs2d|j|jdt�|jj|jj�fS(Ns
DROP INDEX %s ON %sR(R"R RR�RmR�(R�RM((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_drop_index�scs�t|�dkrdSd}|jdk	rH|d�jj|�7}n|d7}|jdd}|dk	r�|r�|d7}q�|d7}n|d	d
j�fd�|D��7}|�j|�7}|S(NiR�sCONSTRAINT %s sPRIMARY KEY RR/s
CLUSTERED s
NONCLUSTERED s(%s)s, c3s$|]}�jj|j�VqdS(N(R�R$R�(R�R6(R�(sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pys	<genexpr>�s(tlenR�R�R�tformat_constraintRRstdefine_constraint_deferrability(R�R5RR/((R�sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_primary_key_constraint�s 


cs�t|�dkrdSd}|jdk	rH|d�jj|�7}n|d7}|jdd}|dk	r�|r�|d7}q�|d7}n|d	d
j�fd�|D��7}|�j|�7}|S(NiR�sCONSTRAINT %s sUNIQUE RR/s
CLUSTERED s
NONCLUSTERED s(%s)s, c3s$|]}�jj|j�VqdS(N(R�R$R�(R�R6(R�(sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pys	<genexpr>�s(R+R�R�R�R,RRsR-(R�R5RR/((R�sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytvisit_unique_constraint�s 


(R�R�RRR)R*R.R/(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR	Ps
	C2		tMSIdentifierPreparercBs,eZeZd�Zd�Zdd�ZRS(cCs,tt|�j|dddddt�dS(Nt
initial_quotet[tfinal_quotet]tquote_case_sensitive_collations(R�R0R�R(R�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��s
cCs|S(N((R�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyt_escape_identifierscCs{|dk	rtjd�nt|�\}}|rYd|j|�|j|�f}n|rq|j|�}nd}|S(s'Prepare a quoted table and schema name.s�The IdentifierPreparer.quote_schema.force parameter is deprecated and will be removed in a future release.  This flag has no effect on the behavior of the IdentifierPreparer.quote method; please refer to quoted_name().s%s.%sR�N(R�RRt_schema_elementsR$(R�Rtforcetdbnametownertresult((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytquote_schema	s
%N(R�R�tRESERVED_WORDStreserved_wordsR�R6R�R<(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR0�s		csd�fd�}t|��S(Nc
s7t||�\}}t||�||||||�S(N(t_owner_plus_dbt
_switch_db(R�t
connectionRR�R9R:(R�(sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytwrap$s(R�R(R�RB((R�sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyt_db_plus_owner_listing#scsd�fd�}t|��S(Ncs:t||�\}}t||�|||||||�	S(N(R?R@(R�RAt	tablenameRR�R9R:(R�(sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyRB6s(R�R(R�RB((R�sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyt_db_plus_owner5scOs\|r)|jd�}|jd|�nz|||�SWd|rW|jd|�nXdS(Nsselect db_name()suse %s(tscalarRU(R9RAR�R�R�t
current_db((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR@HscCs7|sd|jfSd|kr)t|�Sd|fSdS(Nt.(R�tdefault_schema_nameR7(R�R((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR?Ss


cCst|t�r"|jr"d|fSg}d}t}x�tjd|�D]o}|sYqGn|dkrnt}qG|dkr�t}qG|r�|dkr�|j|�d}qG||7}qGW|r�|j|�nt	|�dkr�|ddj
|d�fSt	|�rd|dfSdSdS(	NR�s
(\[|\]|\.)R2R4RHii(NN(R�RR$R�RR�tsplitR�tappendR+Rs(Rtpushtsymboltbracketttoken((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR7\s.
		
	t	MSDialectcBsxeZdZeZeZeZeZ	dZ
dZiee
j6ee
j6ee
j6ee
j6ee
j6Zejjjdejfg�ZeZeZeZ eZ!eZ"d!Z#e$Z%e&Z'e(Z)e*Z+e,j-id"d6fe,j/id"d6fe,j0id"d6d"d6d"d6fe,j1idd6dd	6fgZ2d"ed"dd"d"ed
�Z3d�Z4d�Z5e6d
ddddg�Z7d�Z8d�Z9d�Z:d�Z;d�Z<d�Z=e>d��Z?e@jAd��ZBe@jAeCd���ZDe@jAeCd���ZEe@jAe>d���ZFe@jAe>d���ZGe@jAe>d���ZHe@jAe>d���ZIe@jAe>d ���ZJRS(#Ri�tdboR�R/RR�iRR
c	Kszt|pd�|_||_||_t|p3d�p?|j|_||_||_tt|�j	|�||_
dS(Ni(R�t
query_timeouttschema_nameRrtmax_identifier_lengthRBR�R�RPR�tisolation_level(	R�RRRrRTRSRURBR�topts((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyR��s				cCs*|jd�tt|�j||�dS(Ns$IF @@TRANCOUNT = 0 BEGIN TRANSACTION(RUR�RPtdo_savepoint(R�RAR�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyRW�s
cCsdS(N((R�RAR�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytdo_release_savepoint�stSERIALIZABLEsREAD UNCOMMITTEDsREAD COMMITTEDsREPEATABLE READtSNAPSHOTcCs�|jdd�}||jkrOtjd||jdj|j�f��n|j�}|jd|�|j�|dkr�|j	�ndS(Nt_R2sLInvalid value '%s' for isolation_level. Valid isolation levels for %s are %ss, s"SET TRANSACTION ISOLATION LEVEL %sRZ(
R�t_isolation_lookupRt
ArgumentErrorR�RsRARUR.R3(R�RAtlevelRA((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytset_isolation_level�s%
cCs�|jtkrtd��nd}d}x�|D]x}|j�}zXy%|jd|�|j�d}Wn"|jjk
r�}|}w1nX|j	�SWd|j
�Xq1Wtjd||f�td��dS(	Ns4Can't fetch isolation level prior to SQL Server 2005ssys.dm_exec_sessionsssys.dm_pdw_nodes_exec_sessionss�
                  SELECT CASE transaction_isolation_level
                    WHEN 0 THEN NULL
                    WHEN 1 THEN 'READ UNCOMMITTED'
                    WHEN 2 THEN 'READ COMMITTED'
                    WHEN 3 THEN 'REPEATABLE READ'
                    WHEN 4 THEN 'SERIALIZABLE'
                    WHEN 5 THEN 'SNAPSHOT' END AS TRANSACTION_ISOLATION_LEVEL
                    FROM %s
                    where session_id = @@SPID
                  isQCould not fetch transaction isolation level, tried views: %s; final error was: %ssACan't fetch isolation level on this particular SQL Server version(ssys.dm_exec_sessionsssys.dm_pdw_nodes_exec_sessions(
RKtMS_2005_VERSIONtNotImplementedErrorR�RARUtfetchonetdbapitErrortupperR.Rtwarn(R�RAt
last_errortviewsR�RAtvalterr((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytget_isolation_level�s.
cCs$tt|�j|�|j�dS(N(R�RPt
initializet_setup_version_attributes(R�RA((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyRl	scs*�jdk	r"�fd�}|SdSdS(Ncs�j|�j�dS(N(R_RU(Ry(R�(sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytconnect	s(RUR�(R�Rn((R�sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyt
on_connect	scCs�|jdttdd��krLtjddjd�|jD���n|jtkrvd|jkrvt|_	n|jt
kr�t|_n|jdkr�|jtk|_ndS(Niiis[Unrecognized server version info '%s'.  Some SQL Server features may not function properly.RHcss|]}t|�VqdS(N(R(R�R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pys	<genexpr>	stimplicit_returning(RKtlisttrangeRRfRsR`t__dict__R�RpRLtsupports_multivalues_insertRBR�tMS_2012_VERSION(R�((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyRm	s"!cCsX|jtkr|jStjd�}|j|�}|dk	rMtj|�S|jSdS(NsSELECT schema_name()(	RKR`RSRRRFR�Rt	text_type(R�RAtqueryRI((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyt_get_default_schema_name,	s
c
Csvtj}|jj|k}|rBtj||jj|k�}ntj|g|�}|j|�}	|	j	�dk	S(N(tischemaR�R6t
table_nameRtand_ttable_schemaR�RUtfirstR�(
R�RARDR9R:RR�R%R�R6((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyt	has_table7	s	cKsWtjtjjjgdtjjjg�}g|j|�D]}|d^q=}|S(NR�i(RR�RytschemataR6RSRU(R�RAR�R�trtschema_names((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytget_schema_namesE	s
&c
Ks�tj}tj|jjgtj|jj|k|jjdk�d|jjg�}g|j	|�D]}|d^qg}	|	S(Ns
BASE TABLER�i(
RyttablesRR�R6RzR{R|t
table_typeRU(
R�RAR9R:RR�R�R�R�ttable_names((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytget_table_namesN	s	&c
Ks�tj}tj|jjgtj|jj|k|jjdk�d|jjg�}g|j	|�D]}|d^qg}	|	S(NtVIEWR�i(
RyR�RR�R6RzR{R|R�RU(
R�RAR9R:RR�R�R�R�t
view_names((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytget_view_names]	s	$&c
Ksl|jtkrgS|jtjd�jtjd|tj��tjd|tj���j	dt
j���}i}x?|D]7}	i|	dd6|	ddkd6gd6||	d	<q�W|jtjd
�jtjd|tj��tjd|tj���j	dt
j���}x>|D]6}	|	d	|kr"||	d	dj|	d�q"q"Wt
|j��S(Nsselect ind.index_id, ind.is_unique, ind.name from sys.indexes as ind join sys.tables as tab on ind.object_id=tab.object_id join sys.schemas as sch on sch.schema_id=tab.schema_id where tab.name = :tabname and sch.name=:schname and ind.is_primary_key=0 and ind.type != 0ttabnametschnameR�t	is_uniqueiR�tcolumn_namestindex_idsRselect ind_col.index_id, ind_col.object_id, col.name from sys.columns as col join sys.tables as tab on tab.object_id=col.object_id join sys.index_columns as ind_col on (ind_col.column_id=col.column_id and ind_col.object_id=tab.object_id) join sys.schemas as sch on sch.schema_id=tab.schema_id where tab.name=:tabname and sch.name=:schname(RKR`RURRt
bindparamst	bindparamRyt
CoerceUnicodeR�tsqltypestUnicodeRKRqR�(
R�RARDR9R:RR�trptindexesRz((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytget_indexesk	s0		!
	!
$c	Ksh|jtjd�jtjd|tj��tjd|tj����}|rd|j�}|SdS(Ns�select definition from sys.sql_modules as mod, sys.views as views, sys.schemas as sch where mod.object_id=views.object_id and views.schema_id=sch.schema_id and views.name=:viewname and sch.name=:schnametviewnameR�(RURRR�R�RyR�RF(	R�RAR�R9R:RR�R�tview_def((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytget_view_definition�	s	!c
Ks�tj}|r<tj|jj|k|jj|k�}n|jj|k}tj|g|d|jjg�}	|j	|	�}
g}x�t
rd|
j�}|dkr�Pn||jj
||jj||jjdk||jj||jj||jj||jj||jjf\}
}}}}}}}|jj|d�}i}|tttttttttj f	kr�|dkr�d}n||d<|r�||d<q�n|dkr�t!j"d||
f�tj#}nJt$|tj%�r||d<t$|tj&�s||d<qn||�}i|
d	6|d
6|d6|d6t'd
6}|j(|�q�Wi}x|D]}|||d	<qrW|j	d||f�}d}x�t
r5|j�}|dkr�Pn|d|d}}|j)d�r�||kr�|}t
||d
<idd6dd6||d<Pq�q�W|j*�|dk	r�|j+t,kr�d||f}|j	d||f�}|j-�}|dk	r�|ddk	r�||dj.it/|d�d6t/|d�d6�q�n|S(NR�tYESi����R
R1s*Did not recognize type '%s' of column '%s'R�tscaleR�R�RRRs2sp_columns @table_name = '%s', @table_owner = '%s'iiRhitmssql_identity_starttmssql_identity_incrementRs%s.%ss)select ident_seed('%s'), ident_incr('%s')i(0RyR�RR{R6RzR|R�tordinal_positionRUR�RbR�tcolumn_namet	data_typetis_nullabletcharacter_maximum_lengthtnumeric_precisiont
numeric_scaletcolumn_defaulttcollation_namet
ischema_namesR�tMSStringtMSChart
MSNVarchartMSNChartMSTexttMSNTexttMSBinarytMSVarBinaryR�tLargeBinaryRRftNULLTYPERtNumerictFloatRRKtendswithR.RKR`R}R�R�(R�RARDR9R:RR�R�R%R�R6tcolsRzR�R5RtcharlentnumericprectnumericscaleRR1R�R�tcdicttcolmapR'RAtictcol_namet	type_namettable_fullname((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytget_columns�	s�		





+	



	
cKs#g}tj}tjjd�}	tj|	jj|jj|	jj	gtj
|jj	|	jj	k|jj|	jjk|	jj|k|	jj|k��}
|j
|
�}d}x]|D]U}
d|
|jjjkr�|j|
d�|dkr
|
|	jj	j}q
q�q�Wi|d6|d6S(NtCtPRIMARYitconstrained_columnsR�(Rytconstraintstkey_constraintsR�RR�R6R�tconstraint_typetconstraint_nameR{R|RzRUR�R�RK(R�RARDR9R:RR�tpkeystTCR�R�R6R�Rz((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytget_pk_constraint7
s$	
cKs.tj}tjjd�}tjjd�}	tj|jj|	jj|	jj	|	jj|jj
|jj|jj|jj
gtj|jj	|k|jj|k|jj|jjk|jj
|jj
k|	jj
|jjk|	jj|jjk|jj|	jjk�d|jj
|	jjg�}
g}d�}tj|�}x�|j|
�j�D]�}
|
\}}}}}}}}||}||d<|ds�||d<|dk	s�||kr�|r�|d|}n||d<q�n|d	|d
}}|j|�|j|�q`Wt|j��S(NR�tRR�cSs'idd6gd6dd6dd6gd6S(NR�R�treferred_schematreferred_tabletreferred_columns(R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytfkey_recw
sR�R�RHR�R�R�(Rytref_constraintsR�R�RR�R6R�R|RzR�tmatch_optiontupdate_ruletdelete_ruleR{tconstraint_schematunique_constraint_nametunique_constraint_schemaR�RtdefaultdictRURsR�RKRqR�(R�RARDR9R:RR�tRRR�R�R�tfkeysR�R�tscoltrschematrtbltrcoltrfknmtfkmatchtfkuprulet	fkdelruletrect
local_colstremote_cols((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pytget_foreign_keysS
sN										




(N(KR�R�R�R�tsupports_default_valuesRtsupports_empty_insertR[texecution_ctx_clsRrRTRSR�R�tDateTimeR�tDateR�tTimeRR�RtUnicodeTexttcolspecsRtDefaultDialecttengine_config_typesR�RtasboolR�tsupports_native_booleant#non_native_boolean_check_constrainttsupports_unicode_bindstpostfetch_lastrowidRKR�tstatement_compilerR	tddl_compilerR0RR0R�RtPrimaryKeyConstraintR�tUniqueConstrainttIndextColumntconstruct_argumentsR�RWRXR�R\R_RkRlRoRmRxRER~RtcacheR�RCR�R�R�R�R�R�R�(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyRPys�




! 				.		
			
6|(xR	RR�R�R�R�RRyRRRRRRR�RRRR	R
RR�RR
RRRRRRRRRRRRRtMS_2016_VERSIONtMS_2014_VERSIONRuRLR`tMS_2000_VERSIONR�R=R�tIntegerR�R�R�R�t_MSTimetobjectR�R�R�R�R�t
TypeEngineR�R�R�RR�Rt_BinaryRRR
RR�RtTextRRRRRRt
MSDateTimetMSDatetMSRealt
MSTinyIntegertMSTimetMSSmallDateTimetMSDateTime2tMSDateTimeOffsetR�R�R�R�R�R�R�R�tMSImagetMSBittMSMoneytMSSmallMoneytMSUniqueIdentifiert	MSVariantR�tGenericTypeCompilerR0tDefaultExecutionContextR[R�R�RtDDLCompilerR	tIdentifierPreparerR0RCRER@R?R7R�RP(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mssql/base.pyt<module>�sj						
&	/
���E/�(						

Zerion Mini Shell 1.0