%PDF- %PDF-
Mini Shell

Mini Shell

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

�
��4]c@s�dZddlZddlZddlmZddlmZddlmZddlmZdd	lm	Z	dd
lm
ZddlmZddlm
Zdd
lmZddlmZddlmZddlmZddlmZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
mZddl
m Z de!fd��YZ"d e"ej#fd!��YZ$d"e"ej%fd#��YZ&d$e"ej'fd%��YZ(ie&ej%6e$ej#6eej6eejj6eejj6e(ej'6Z)iej*d&6ejd'6ejd(6ejd)6ejd*6ej&d"6ej&d+6ej$d 6ej$d,6ejd-6ejd.6ejd/6ejd06ejd16ed26ejd36ejd46ejd56ejd66ej(d$6ej(d76ejd86ej d96ej+d:6ej,d;6Z-d<ej.fd=��YZ/d>ej0fd?��YZ1d@ej2fdA��YZ3dBej4fdC��YZ5dDej6fdE��YZ7dFej8fdG��YZ9dS(Hs�Q
.. dialect:: sqlite
    :name: SQLite

.. _sqlite_datetime:

Date and Time Types
-------------------

SQLite does not have built-in DATE, TIME, or DATETIME types, and pysqlite does
not provide out of the box functionality for translating values between Python
`datetime` objects and a SQLite-supported format. SQLAlchemy's own
:class:`~sqlalchemy.types.DateTime` and related types provide date formatting
and parsing functionality when SQLite is used. The implementation classes are
:class:`~.sqlite.DATETIME`, :class:`~.sqlite.DATE` and :class:`~.sqlite.TIME`.
These types represent dates and times as ISO formatted strings, which also
nicely support ordering. There's no reliance on typical "libc" internals for
these functions so historical dates are fully supported.

Ensuring Text affinity
^^^^^^^^^^^^^^^^^^^^^^

The DDL rendered for these types is the standard ``DATE``, ``TIME``
and ``DATETIME`` indicators.    However, custom storage formats can also be
applied to these types.   When the
storage format is detected as containing no alpha characters, the DDL for
these types is rendered as ``DATE_CHAR``, ``TIME_CHAR``, and ``DATETIME_CHAR``,
so that the column continues to have textual affinity.

.. seealso::

    `Type Affinity <http://www.sqlite.org/datatype3.html#affinity>`_ -
    in the SQLite documentation

.. _sqlite_autoincrement:

SQLite Auto Incrementing Behavior
----------------------------------

Background on SQLite's autoincrement is at: http://sqlite.org/autoinc.html

Key concepts:

* SQLite has an implicit "auto increment" feature that takes place for any
  non-composite primary-key column that is specifically created using
  "INTEGER PRIMARY KEY" for the type + primary key.

* SQLite also has an explicit "AUTOINCREMENT" keyword, that is **not**
  equivalent to the implicit autoincrement feature; this keyword is not
  recommended for general use.  SQLAlchemy does not render this keyword
  unless a special SQLite-specific directive is used (see below).  However,
  it still requires that the column's type is named "INTEGER".

Using the AUTOINCREMENT Keyword
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

To specifically render the AUTOINCREMENT keyword on the primary key column
when rendering DDL, add the flag ``sqlite_autoincrement=True`` to the Table
construct::

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

Allowing autoincrement behavior SQLAlchemy types other than Integer/INTEGER
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

SQLite's typing model is based on naming conventions.  Among other things, this
means that any type name which contains the substring ``"INT"`` will be
determined to be of "integer affinity".  A type named ``"BIGINT"``,
``"SPECIAL_INT"`` or even ``"XYZINTQPR"``, will be considered by SQLite to be
of "integer" affinity.  However, **the SQLite autoincrement feature, whether
implicitly or explicitly enabled, requires that the name of the column's type
is exactly the string "INTEGER"**.  Therefore, if an application uses a type
like :class:`.BigInteger` for a primary key, on SQLite this type will need to
be rendered as the name ``"INTEGER"`` when emitting the initial ``CREATE
TABLE`` statement in order for the autoincrement behavior to be available.

One approach to achieve this is to use :class:`.Integer` on SQLite
only using :meth:`.TypeEngine.with_variant`::

    table = Table(
        "my_table", metadata,
        Column("id", BigInteger().with_variant(Integer, "sqlite"), primary_key=True)
    )

Another is to use a subclass of :class:`.BigInteger` that overrides its DDL
name to be ``INTEGER`` when compiled against SQLite::

    from sqlalchemy import BigInteger
    from sqlalchemy.ext.compiler import compiles

    class SLBigInteger(BigInteger):
        pass

    @compiles(SLBigInteger, 'sqlite')
    def bi_c(element, compiler, **kw):
        return "INTEGER"

    @compiles(SLBigInteger)
    def bi_c(element, compiler, **kw):
        return compiler.visit_BIGINT(element, **kw)


    table = Table(
        "my_table", metadata,
        Column("id", SLBigInteger(), primary_key=True)
    )

.. seealso::

    :meth:`.TypeEngine.with_variant`

    :ref:`sqlalchemy.ext.compiler_toplevel`

    `Datatypes In SQLite Version 3 <http://sqlite.org/datatype3.html>`_

.. _sqlite_concurrency:

Database Locking Behavior / Concurrency
---------------------------------------

SQLite is not designed for a high level of write concurrency. The database
itself, being a file, is locked completely during write operations within
transactions, meaning exactly one "connection" (in reality a file handle)
has exclusive access to the database during this period - all other
"connections" will be blocked during this time.

The Python DBAPI specification also calls for a connection model that is
always in a transaction; there is no ``connection.begin()`` method,
only ``connection.commit()`` and ``connection.rollback()``, upon which a
new transaction is to be begun immediately.  This may seem to imply
that the SQLite driver would in theory allow only a single filehandle on a
particular database file at any time; however, there are several
factors both within SQLite itself as well as within the pysqlite driver
which loosen this restriction significantly.

However, no matter what locking modes are used, SQLite will still always
lock the database file once a transaction is started and DML (e.g. INSERT,
UPDATE, DELETE) has at least been emitted, and this will block
other transactions at least at the point that they also attempt to emit DML.
By default, the length of time on this block is very short before it times out
with an error.

This behavior becomes more critical when used in conjunction with the
SQLAlchemy ORM.  SQLAlchemy's :class:`.Session` object by default runs
within a transaction, and with its autoflush model, may emit DML preceding
any SELECT statement.   This may lead to a SQLite database that locks
more quickly than is expected.   The locking mode of SQLite and the pysqlite
driver can be manipulated to some degree, however it should be noted that
achieving a high degree of write-concurrency with SQLite is a losing battle.

For more information on SQLite's lack of write concurrency by design, please
see
`Situations Where Another RDBMS May Work Better - High Concurrency
<http://www.sqlite.org/whentouse.html>`_ near the bottom of the page.

The following subsections introduce areas that are impacted by SQLite's
file-based architecture and additionally will usually require workarounds to
work when using the pysqlite driver.

.. _sqlite_isolation_level:

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

SQLite supports "transaction isolation" in a non-standard way, along two
axes.  One is that of the
`PRAGMA read_uncommitted <http://www.sqlite.org/pragma.html#pragma_read_uncommitted>`_
instruction.   This setting can essentially switch SQLite between its
default mode of ``SERIALIZABLE`` isolation, and a "dirty read" isolation
mode normally referred to as ``READ UNCOMMITTED``.

SQLAlchemy ties into this PRAGMA statement using the
:paramref:`.create_engine.isolation_level` parameter of :func:`.create_engine`.
Valid values for this parameter when used with SQLite are ``"SERIALIZABLE"``
and ``"READ UNCOMMITTED"`` corresponding to a value of 0 and 1, respectively.
SQLite defaults to ``SERIALIZABLE``, however its behavior is impacted by
the pysqlite driver's default behavior.

The other axis along which SQLite's transactional locking is impacted is
via the nature of the ``BEGIN`` statement used.   The three varieties
are "deferred", "immediate", and "exclusive", as described at
`BEGIN TRANSACTION <http://sqlite.org/lang_transaction.html>`_.   A straight
``BEGIN`` statement uses the "deferred" mode, where the database file is
not locked until the first read or write operation, and read access remains
open to other transactions until the first write operation.  But again,
it is critical to note that the pysqlite driver interferes with this behavior
by *not even emitting BEGIN* until the first write operation.

.. warning::

    SQLite's transactional scope is impacted by unresolved
    issues in the pysqlite driver, which defers BEGIN statements to a greater
    degree than is often feasible. See the section :ref:`pysqlite_serializable`
    for techniques to work around this behavior.

SAVEPOINT Support
----------------------------

SQLite supports SAVEPOINTs, which only function once a transaction is
begun.   SQLAlchemy's SAVEPOINT support is available using the
:meth:`.Connection.begin_nested` method at the Core level, and
:meth:`.Session.begin_nested` at the ORM level.   However, SAVEPOINTs
won't work at all with pysqlite unless workarounds are taken.

.. warning::

    SQLite's SAVEPOINT feature is impacted by unresolved
    issues in the pysqlite driver, which defers BEGIN statements to a greater
    degree than is often feasible. See the section :ref:`pysqlite_serializable`
    for techniques to work around this behavior.

Transactional DDL
----------------------------

The SQLite database supports transactional :term:`DDL` as well.
In this case, the pysqlite driver is not only failing to start transactions,
it also is ending any existing transaction when DDL is detected, so again,
workarounds are required.

.. warning::

    SQLite's transactional DDL is impacted by unresolved issues
    in the pysqlite driver, which fails to emit BEGIN and additionally
    forces a COMMIT to cancel any transaction when DDL is encountered.
    See the section :ref:`pysqlite_serializable`
    for techniques to work around this behavior.

.. _sqlite_foreign_keys:

Foreign Key Support
-------------------

SQLite supports FOREIGN KEY syntax when emitting CREATE statements for tables,
however by default these constraints have no effect on the operation of the
table.

Constraint checking on SQLite has three prerequisites:

* At least version 3.6.19 of SQLite must be in use
* The SQLite library must be compiled *without* the SQLITE_OMIT_FOREIGN_KEY
  or SQLITE_OMIT_TRIGGER symbols enabled.
* The ``PRAGMA foreign_keys = ON`` statement must be emitted on all
  connections before use.

SQLAlchemy allows for the ``PRAGMA`` statement to be emitted automatically for
new connections through the usage of events::

    from sqlalchemy.engine import Engine
    from sqlalchemy import event

    @event.listens_for(Engine, "connect")
    def set_sqlite_pragma(dbapi_connection, connection_record):
        cursor = dbapi_connection.cursor()
        cursor.execute("PRAGMA foreign_keys=ON")
        cursor.close()

.. warning::

    When SQLite foreign keys are enabled, it is **not possible**
    to emit CREATE or DROP statements for tables that contain
    mutually-dependent foreign key constraints;
    to emit the DDL for these tables requires that ALTER TABLE be used to
    create or drop these constraints separately, for which SQLite has
    no support.

.. seealso::

    `SQLite Foreign Key Support <http://www.sqlite.org/foreignkeys.html>`_
    - on the SQLite web site.

    :ref:`event_toplevel` - SQLAlchemy event API.

    :ref:`use_alter` - more information on SQLAlchemy's facilities for handling
     mutually-dependent foreign key constraints.

.. _sqlite_on_conflict_ddl:

ON CONFLICT support for constraints
-----------------------------------

SQLite supports a non-standard clause known as ON CONFLICT which can be applied
to primary key, unique, check, and not null constraints.   In DDL, it is
rendered either within the "CONSTRAINT" clause or within the column definition
itself depending on the location of the target constraint.    To render this
clause within DDL, the extension parameter ``sqlite_on_conflict`` can be
specified with a string conflict resolution algorithm within the
:class:`.PrimaryKeyConstraint`, :class:`.UniqueConstraint`,
:class:`.CheckConstraint` objects.  Within the :class:`.Column` object, there
are individual parameters ``sqlite_on_conflict_not_null``,
``sqlite_on_conflict_primary_key``, ``sqlite_on_conflict_unique`` which each
correspond to the three types of relevant constraint types that can be
indicated from a :class:`.Column` object.

.. seealso::

    `ON CONFLICT <https://www.sqlite.org/lang_conflict.html>`_ - in the SQLite
    documentation

.. versionadded:: 1.3


The ``sqlite_on_conflict`` parameters accept a  string argument which is just
the resolution name to be chosen, which on SQLite can be one of ROLLBACK,
ABORT, FAIL, IGNORE, and REPLACE.   For example, to add a UNIQUE constraint
that specifies the IGNORE algorithm::

    some_table = Table(
        'some_table', metadata,
        Column('id', Integer, primary_key=True),
        Column('data', Integer),
        UniqueConstraint('id', 'data', sqlite_on_conflict='IGNORE')
    )

The above renders CREATE TABLE DDL as::

    CREATE TABLE some_table (
        id INTEGER NOT NULL,
        data INTEGER,
        PRIMARY KEY (id),
        UNIQUE (id, data) ON CONFLICT IGNORE
    )


When using the :paramref:`.Column.unique` flag to add a UNIQUE constraint
to a single column, the ``sqlite_on_conflict_unique`` parameter can
be added to the :class:`.Column` as well, which will be added to the
UNIQUE constraint in the DDL::

    some_table = Table(
        'some_table', metadata,
        Column('id', Integer, primary_key=True),
        Column('data', Integer, unique=True,
               sqlite_on_conflict_unique='IGNORE')
    )

rendering::

    CREATE TABLE some_table (
        id INTEGER NOT NULL,
        data INTEGER,
        PRIMARY KEY (id),
        UNIQUE (data) ON CONFLICT IGNORE
    )

To apply the FAIL algorithm for a NOT NULL constraint,
``sqlite_on_conflict_not_null`` is used::

    some_table = Table(
        'some_table', metadata,
        Column('id', Integer, primary_key=True),
        Column('data', Integer, nullable=False,
               sqlite_on_conflict_not_null='FAIL')
    )

this renders the column inline ON CONFLICT phrase::

    CREATE TABLE some_table (
        id INTEGER NOT NULL,
        data INTEGER NOT NULL ON CONFLICT FAIL,
        PRIMARY KEY (id)
    )


Similarly, for an inline primary key, use ``sqlite_on_conflict_primary_key``::

    some_table = Table(
        'some_table', metadata,
        Column('id', Integer, primary_key=True,
               sqlite_on_conflict_primary_key='FAIL')
    )

SQLAlchemy renders the PRIMARY KEY constraint separately, so the conflict
resolution algorithm is applied to the constraint itself::

    CREATE TABLE some_table (
        id INTEGER NOT NULL,
        PRIMARY KEY (id) ON CONFLICT FAIL
    )

.. _sqlite_type_reflection:

Type Reflection
---------------

SQLite types are unlike those of most other database backends, in that
the string name of the type usually does not correspond to a "type" in a
one-to-one fashion.  Instead, SQLite links per-column typing behavior
to one of five so-called "type affinities" based on a string matching
pattern for the type.

SQLAlchemy's reflection process, when inspecting types, uses a simple
lookup table to link the keywords returned to provided SQLAlchemy types.
This lookup table is present within the SQLite dialect as it is for all
other dialects.  However, the SQLite dialect has a different "fallback"
routine for when a particular type name is not located in the lookup map;
it instead implements the SQLite "type affinity" scheme located at
http://www.sqlite.org/datatype3.html section 2.1.

The provided typemap will make direct associations from an exact string
name match for the following types:

:class:`~.types.BIGINT`, :class:`~.types.BLOB`,
:class:`~.types.BOOLEAN`, :class:`~.types.BOOLEAN`,
:class:`~.types.CHAR`, :class:`~.types.DATE`,
:class:`~.types.DATETIME`, :class:`~.types.FLOAT`,
:class:`~.types.DECIMAL`, :class:`~.types.FLOAT`,
:class:`~.types.INTEGER`, :class:`~.types.INTEGER`,
:class:`~.types.NUMERIC`, :class:`~.types.REAL`,
:class:`~.types.SMALLINT`, :class:`~.types.TEXT`,
:class:`~.types.TIME`, :class:`~.types.TIMESTAMP`,
:class:`~.types.VARCHAR`, :class:`~.types.NVARCHAR`,
:class:`~.types.NCHAR`

When a type name does not match one of the above types, the "type affinity"
lookup is used instead:

* :class:`~.types.INTEGER` is returned if the type name includes the
  string ``INT``
* :class:`~.types.TEXT` is returned if the type name includes the
  string ``CHAR``, ``CLOB`` or ``TEXT``
* :class:`~.types.NullType` is returned if the type name includes the
  string ``BLOB``
* :class:`~.types.REAL` is returned if the type name includes the string
  ``REAL``, ``FLOA`` or ``DOUB``.
* Otherwise, the :class:`~.types.NUMERIC` type is used.

.. versionadded:: 0.9.3 Support for SQLite type affinity rules when reflecting
   columns.


.. _sqlite_partial_index:

Partial Indexes
---------------

A partial index, e.g. one which uses a WHERE clause, can be specified
with the DDL system using the argument ``sqlite_where``::

    tbl = Table('testtbl', m, Column('data', Integer))
    idx = Index('test_idx1', tbl.c.data,
                sqlite_where=and_(tbl.c.data > 5, tbl.c.data < 10))

The index will be rendered at create time as::

    CREATE INDEX test_idx1 ON testtbl (data)
    WHERE data > 5 AND data < 10

.. versionadded:: 0.9.9

.. _sqlite_dotted_column_names:

Dotted Column Names
-------------------

Using table or column names that explicitly have periods in them is
**not recommended**.   While this is generally a bad idea for relational
databases in general, as the dot is a syntactically significant character,
the SQLite driver up until version **3.10.0** of SQLite has a bug which
requires that SQLAlchemy filter out these dots in result sets.

.. versionchanged:: 1.1

    The following SQLite issue has been resolved as of version 3.10.0
    of SQLite.  SQLAlchemy as of **1.1** automatically disables its internal
    workarounds based on detection of this version.

The bug, entirely outside of SQLAlchemy, can be illustrated thusly::

    import sqlite3

    assert sqlite3.sqlite_version_info < (3, 10, 0), "bug is fixed in this version"

    conn = sqlite3.connect(":memory:")
    cursor = conn.cursor()

    cursor.execute("create table x (a integer, b integer)")
    cursor.execute("insert into x (a, b) values (1, 1)")
    cursor.execute("insert into x (a, b) values (2, 2)")

    cursor.execute("select x.a, x.b from x")
    assert [c[0] for c in cursor.description] == ['a', 'b']

    cursor.execute('''
        select x.a, x.b from x where a=1
        union
        select x.a, x.b from x where a=2
    ''')
    assert [c[0] for c in cursor.description] == ['a', 'b'], \
        [c[0] for c in cursor.description]

The second assertion fails::

    Traceback (most recent call last):
      File "test.py", line 19, in <module>
        [c[0] for c in cursor.description]
    AssertionError: ['x.a', 'x.b']

Where above, the driver incorrectly reports the names of the columns
including the name of the table, which is entirely inconsistent vs.
when the UNION is not present.

SQLAlchemy relies upon column names being predictable in how they match
to the original statement, so the SQLAlchemy dialect has no choice but
to filter these out::


    from sqlalchemy import create_engine

    eng = create_engine("sqlite://")
    conn = eng.connect()

    conn.execute("create table x (a integer, b integer)")
    conn.execute("insert into x (a, b) values (1, 1)")
    conn.execute("insert into x (a, b) values (2, 2)")

    result = conn.execute("select x.a, x.b from x")
    assert result.keys() == ["a", "b"]

    result = conn.execute('''
        select x.a, x.b from x where a=1
        union
        select x.a, x.b from x where a=2
    ''')
    assert result.keys() == ["a", "b"]

Note that above, even though SQLAlchemy filters out the dots, *both
names are still addressable*::

    >>> row = result.first()
    >>> row["a"]
    1
    >>> row["x.a"]
    1
    >>> row["b"]
    1
    >>> row["x.b"]
    1

Therefore, the workaround applied by SQLAlchemy only impacts
:meth:`.ResultProxy.keys` and :meth:`.RowProxy.keys()` in the public API. In
the very specific case where an application is forced to use column names that
contain dots, and the functionality of :meth:`.ResultProxy.keys` and
:meth:`.RowProxy.keys()` is required to return these dotted names unmodified,
the ``sqlite_raw_colnames`` execution option may be provided, either on a
per-:class:`.Connection` basis::

    result = conn.execution_options(sqlite_raw_colnames=True).execute('''
        select x.a, x.b from x where a=1
        union
        select x.a, x.b from x where a=2
    ''')
    assert result.keys() == ["x.a", "x.b"]

or on a per-:class:`.Engine` basis::

    engine = create_engine("sqlite://", execution_options={"sqlite_raw_colnames": True})

When using the per-:class:`.Engine` execution option, note that
**Core and ORM queries that use UNION may not function properly**.

i����Ni(tJSON(t
JSONIndexType(tJSONPathTypei(texc(t
processors(tschema(tsql(ttypes(tutil(tdefault(t
reflection(t
ColumnElement(tcompiler(tBLOB(tBOOLEAN(tCHAR(tDECIMAL(tFLOAT(tINTEGER(tNUMERIC(tREAL(tSMALLINT(tTEXT(t	TIMESTAMP(tVARCHARt_DateTimeMixincBsDeZdZdZddd�Zed��Zd�Zd�Z	RS(cKsStt|�j|�|dk	r7tj|�|_n|dk	rO||_ndS(N(tsuperRt__init__tNonetretcompilet_regt_storage_format(tselftstorage_formattregexptkw((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR^s
cCsT|jidd6dd6dd6dd6dd6dd6dd6}ttjd	|��S(
s`return True if the storage format will automatically imply
        a TEXT affinity.

        If the storage format contains no non-numeric characters,
        it will imply a NUMERIC storage format on SQLite; in this case,
        the type will generate its DDL as DATE_CHAR, DATETIME_CHAR,
        TIME_CHAR.

        .. versionadded:: 1.0.0

        ityeartmonthtdaythourtminutetsecondtmicroseconds[^0-9](R tboolRtsearch(R!tspec((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytformat_is_text_affinityes
	cKs]t|t�rD|jr(|j|d<n|jrD|j|d<qDntt|�j||�S(NR"R#(t
issubclassRR RRtadapt(R!tclsR$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR1}s		cs"|j|���fd�}|S(Ncsd�|�S(Ns'%s'((tvalue(tbp(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytprocess�s(tbind_processor(R!tdialectR5((R4sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytliteral_processor�sN(
t__name__t
__module__RRR RtpropertyR/R1R8(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRZs	tDATETIMEcBs/eZdZdZd�Zd�Zd�ZRS(s�Represent a Python datetime object in SQLite using a string.

    The default string storage format is::

        "%(year)04d-%(month)02d-%(day)02d %(hour)02d:%(min)02d:%(second)02d.%(microsecond)06d"

    e.g.::

        2011-03-15 12:05:57.10558

    The storage format can be customized to some degree using the
    ``storage_format`` and ``regexp`` parameters, such as::

        import re
        from sqlalchemy.dialects.sqlite import DATETIME

        dt = DATETIME(storage_format="%(year)04d/%(month)02d/%(day)02d "
                                     "%(hour)02d:%(min)02d:%(second)02d",
                      regexp=r"(\d+)/(\d+)/(\d+) (\d+)-(\d+)-(\d+)"
        )

    :param storage_format: format string which will be applied to the dict
     with keys year, month, day, hour, minute, second, and microsecond.

    :param regexp: regular expression which will be applied to incoming result
     rows. If the regexp contains named groups, the resulting match dict is
     applied to the Python datetime() constructor as keyword arguments.
     Otherwise, if positional groups are used, the datetime() constructor
     is called with positional arguments via
     ``*map(int, match_obj.groups(0))``.

    sW%(year)04d-%(month)02d-%(day)02d %(hour)02d:%(minute)02d:%(second)02d.%(microsecond)06dcOsA|jdt�}tt|�j||�|r=d|_ndS(Nttruncate_microsecondssE%(year)04d-%(month)02d-%(day)02d %(hour)02d:%(minute)02d:%(second)02d(tpoptFalseRR<RR (R!targstkwargsR=((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR�s
cs4tj�tj�|j����fd�}|S(Ncs�|dkrdSt|��rm�i|jd6|jd6|jd6|jd6|jd6|jd6|jd6St|��r��i|jd6|jd6|jd6dd6dd6dd6dd6St	d	��dS(
NR%R&R'R(R)R*R+isLSQLite DateTime type only accepts Python datetime and date objects as input.(
Rt
isinstanceR%R&R'R(R)R*R+t	TypeError(R3(t
datetime_datetdatetime_datetimetformat_(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR5�s,








	(tdatetimetdateR (R!R7R5((RDRERFsR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR6�s
			cCs*|jrtj|jtj�StjSdS(N(RRt!str_to_datetime_processor_factoryRGtstr_to_datetime(R!R7tcoltype((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytresult_processor�s	(R9R:t__doc__R RR6RL(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR<�s
 		$tDATEcBs&eZdZdZd�Zd�ZRS(sRepresent a Python date object in SQLite using a string.

    The default string storage format is::

        "%(year)04d-%(month)02d-%(day)02d"

    e.g.::

        2011-03-15

    The storage format can be customized to some degree using the
    ``storage_format`` and ``regexp`` parameters, such as::

        import re
        from sqlalchemy.dialects.sqlite import DATE

        d = DATE(
                storage_format="%(month)02d/%(day)02d/%(year)04d",
                regexp=re.compile("(?P<month>\d+)/(?P<day>\d+)/(?P<year>\d+)")
            )

    :param storage_format: format string which will be applied to the
     dict with keys year, month, and day.

    :param regexp: regular expression which will be applied to
     incoming result rows. If the regexp contains named groups, the
     resulting match dict is applied to the Python date() constructor
     as keyword arguments. Otherwise, if positional groups are used, the
     date() constructor is called with positional arguments via
     ``*map(int, match_obj.groups(0))``.
    s %(year)04d-%(month)02d-%(day)02dcs(tj�|j���fd�}|S(NcsU|dkrdSt|��rE�i|jd6|jd6|jd6Std��dS(NR%R&R's;SQLite Date type only accepts Python date objects as input.(RRBR%R&R'RC(R3(RDRF(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR5s

(RGRHR (R!R7R5((RDRFsR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR6s		cCs*|jrtj|jtj�StjSdS(N(RRRIRGRHtstr_to_date(R!R7RK((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRL+s	(R9R:RMR R6RL(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRN�s	tTIMEcBs/eZdZdZd�Zd�Zd�ZRS(sZRepresent a Python time object in SQLite using a string.

    The default string storage format is::

        "%(hour)02d:%(minute)02d:%(second)02d.%(microsecond)06d"

    e.g.::

        12:05:57.10558

    The storage format can be customized to some degree using the
    ``storage_format`` and ``regexp`` parameters, such as::

        import re
        from sqlalchemy.dialects.sqlite import TIME

        t = TIME(storage_format="%(hour)02d-%(minute)02d-"
                                "%(second)02d-%(microsecond)06d",
                 regexp=re.compile("(\d+)-(\d+)-(\d+)-(?:-(\d+))?")
        )

    :param storage_format: format string which will be applied to the dict
     with keys hour, minute, second, and microsecond.

    :param regexp: regular expression which will be applied to incoming result
     rows. If the regexp contains named groups, the resulting match dict is
     applied to the Python time() constructor as keyword arguments. Otherwise,
     if positional groups are used, the time() constructor is called with
     positional arguments via ``*map(int, match_obj.groups(0))``.
    s6%(hour)02d:%(minute)02d:%(second)02d.%(microsecond)06dcOsA|jdt�}tt|�j||�|r=d|_ndS(NR=s$%(hour)02d:%(minute)02d:%(second)02d(R>R?RRPRR (R!R@RAR=((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRVs	cs(tj�|j���fd�}|S(Ncs_|dkrdSt|��rO�i|jd6|jd6|jd6|jd6Std��dS(NR(R)R*R+s;SQLite Time type only accepts Python time objects as input.(RRBR(R)R*R+RC(R3(t
datetime_timeRF(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR5hs


(RGttimeR (R!R7R5((RQRFsR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR6ds		cCs*|jrtj|jtj�StjSdS(N(RRRIRGRRtstr_to_time(R!R7RK((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRLzs	(R9R:RMR RR6RL(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRP4s
		tBIGINTR
tBOOLRRt	DATE_CHARt
DATETIME_CHARtDOUBLERRtINTRRRRRRt	TIME_CHARRRtNVARCHARtNCHARtSQLiteCompilercBs�eZejejji
dd6dd6dd6dd6dd	6d
d6dd
6dd6dd6dd6�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d�Zd�Zd�Zd�Zd�Zd �Zd!�ZRS("s%mR&s%dR's%YR%s%SR*s%HR(s%jtdoys%MR)s%stepochs%wtdows%WtweekcKsdS(NtCURRENT_TIMESTAMP((R!tfnR$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytvisit_now_func�scKsdS(Ns(DATETIME(CURRENT_TIMESTAMP, "localtime")((R!tfuncR$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytvisit_localtimestamp_func�scKsdS(Nt1((R!texprR$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt
visit_true�scKsdS(Nt0((R!RhR$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytvisit_false�scKsd|j|�S(Nslength%s(tfunction_argspec(R!RcR$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytvisit_char_length_func�scKs<|jjr%tt|�j||�S|j|j|�SdS(N(R7t
supports_castRR]t
visit_castR5tclause(R!tcastRA((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRo�scKsYy+d|j|j|j|j|�fSWn'tk
rTtjd|j��nXdS(Ns#CAST(STRFTIME('%s', %s) AS INTEGER)s#%s is not a valid extract argument.(textract_maptfieldR5RhtKeyErrorRtCompileError(R!textractR$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt
visit_extract�s

cKs�d}|jdk	r5|d|j|j|�7}n|jdk	r�|jdkrv|d|jtjd��7}n|d|j|j|�7}n#|d|jtjd�|�7}|S(Nts
 LIMIT i����s OFFSET i(t
_limit_clauseRR5t_offset_clauseRtliteral(R!tselectR$ttext((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytlimit_clause�s # #cKsdS(NRx((R!R|R$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytfor_update_clause�scKs&d|j|j�|j|j�fS(Ns%s IS NOT %s(R5tlefttright(R!tbinarytoperatorR$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytvisit_is_distinct_from_binary�scKs&d|j|j�|j|j�fS(Ns%s IS %s(R5R�R�(R!R�R�R$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt visit_isnot_distinct_from_binary�scKs,d|j|j|�|j|j|�fS(Ns JSON_QUOTE(JSON_EXTRACT(%s, %s))(R5R�R�(R!R�R�R$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytvisit_json_getitem_op_binary�scKs,d|j|j|�|j|j|�fS(Ns JSON_QUOTE(JSON_EXTRACT(%s, %s))(R5R�R�(R!R�R�R$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt!visit_json_path_getitem_op_binary�scCsLddjd�|pt�gD��djd�|p@t�gD��fS(Ns%SELECT %s FROM (SELECT %s) WHERE 1!=1s, css|]}dVqdS(RgN((t.0ttype_((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pys	<genexpr>scss|]}dVqdS(RgN((R�R�((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pys	<genexpr>s(tjoinR(R!t
element_types((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytvisit_empty_set_exprs"(R9R:Rtupdate_copyRtSQLCompilerRrRdRfRiRkRmRoRwR~RR�R�R�R�R�(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR]�s6	
													tSQLiteDDLCompilercBsVeZd�Zd�Zd�Zd�Zd�Zd�Zd�Ze	e
d�ZRS(cKs�|jjj|jd|�}|jj|�d|}|j|�}|dk	r�t|j	j
t�ryd|d}n|d|7}n|js�|d7}|j
dd}|dk	r�|d	|7}q�n|jr�|jtkrt|jjj�d
krtjd��n|jj
ddr�t|jjj�d
kr�t|jjtj�r�|jr�|d
7}|j
dd}|dk	r�|d	|7}n|d7}q�n|S(Nttype_expressiont t(t)s	 DEFAULT s	 NOT NULLtsqliteton_conflict_not_nulls
 ON CONFLICT is@SQLite does not support autoincrement for composite primary keyst
autoincrements PRIMARY KEYton_conflict_primary_keys AUTOINCREMENT(R7t
type_compilerR5ttypetpreparert
format_columntget_column_default_stringRRBtserver_defaulttargRtnullabletdialect_optionstprimary_keyR�tTruetlenttabletcolumnsRRuR0t_type_affinitytsqltypestIntegertforeign_keys(R!tcolumnRARKtcolspecR	ton_conflict_clause((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_column_specification
s<	

	


cCs�t|j�dkrkt|�d}|jrk|jjddrkt|jjt	j
�rk|jrkdSnt
t|�j|�}|jdd}|dkr�t|j�dkr�t|�djdd}n|dk	r�|d|7}n|S(NiiR�R�ton_conflictR�s
 ON CONFLICT (R�R�tlistR�R�R�R0R�R�R�R�R�RRR�tvisit_primary_key_constraint(R!t
constrainttcR}R�((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR�:s"	
	
!
cCs�tt|�j|�}|jdd}|dkrht|j�dkrht|�djdd}n|dk	r�|d|7}n|S(NR�R�iiton_conflict_uniques
 ON CONFLICT (RR�tvisit_unique_constraintR�RR�R�R�(R!R�R}R�((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR�Ys	
!
cCsJtt|�j|�}|jdd}|dk	rF|d|7}n|S(NR�R�s
 ON CONFLICT (RR�tvisit_check_constraintR�R(R!R�R}R�((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR�ks	
cCsEtt|�j|�}|jdddk	rAtjd��n|S(NR�R�sFSQLite does not support on conflict clause for column check constraint(RR�tvisit_column_check_constraintR�RRRu(R!R�R}((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR�ys	cCsV|jdjj}|jdjj}|j|jkr<dStt|�j|�SdS(Ni(	telementstparentR�R�RRRR�tvisit_foreign_key_constraint(R!R�tlocal_tabletremote_table((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR��scCs|j|dt�S(s=Format the remote table clause of a CREATE CONSTRAINT clause.t
use_schema(tformat_tableR?(R!R�R�R�((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytdefine_constraint_remote_table�sc	s�|j}�j|��j}d}|jr;|d7}n|d�j|dt�|j|jdt�dj	�fd�|j
D��f7}|jdd	}|dk	r��j
j|d
tdt�}|d|7}n|S(
NsCREATE sUNIQUE sINDEX %s ON %s (%s)tinclude_schemaR�s, c3s-|]#}�jj|dtdt�VqdS(t
include_tablet
literal_bindsN(tsql_compilerR5R?R�(R�Rh(R!(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pys	<genexpr>�sR�twhereR�R�s WHERE (telementt_verify_index_tableR�tuniquet_prepared_index_nameR�R�R�R?R�texpressionsR�RR�R5(	R!tcreateR�tinclude_table_schematindexR�R}twhereclausetwhere_compiled((R!sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytvisit_create_index�s$	
		
	(R9R:R�R�R�R�R�R�R�R?R�R�(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR�	s	0				
		tSQLiteTypeCompilercBs5eZd�Zd�Zd�Zd�Zd�ZRS(cKs
|j|�S(N(t
visit_BLOB(R!R�R$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytvisit_large_binary�scKs7t|t�s|jr/tt|�j|�SdSdS(NRW(RBRR/RR�tvisit_DATETIME(R!R�R$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR��s	cKs7t|t�s|jr/tt|�j|�SdSdS(NRV(RBRR/RR�t
visit_DATE(R!R�R$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR��s	cKs7t|t�s|jr/tt|�j|�SdSdS(NRZ(RBRR/RR�t
visit_TIME(R!R�R$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR��s	cKsdS(NR((R!R�R$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt
visit_JSON�s(R9R:R�R�R�R�R�(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR��s
							tSQLiteIdentifierPreparercuBspeZedddddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsgt�ZRS(ttaddtaftertalltaltertanalyzetandtastasctattachR�tbeforetbegintbetweentbytcascadetcaseRqtchecktcollateR�tcommittconflictR�R�tcrosstcurrent_datetcurrent_timetcurrent_timestamptdatabaseR	t
deferrabletdeferredtdeletetdesctdetachtdistincttdropteachtelsetendtescapetexceptt	exclusivetexplaintfalsetfailtfortforeigntfromtfulltglobtgroupthavingtiftignoret	immediatetinR�tindexedt	initiallytinnertinserttinsteadt	intersecttintotistisnullR�tkeyR�tliketlimittmatchtnaturaltnottnotnulltnulltoftoffsettontortordertoutertplantpragmatprimarytquerytraiset
referencestreindextrenametreplacetrestrictR�trollbacktrowR|tsetR�ttempt	temporarytthenttottransactionttriggerttruetunionR�tupdatetusingtvacuumtvaluestviewtvirtualtwhenR�(R9R:R-treserved_words(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR��s�tSQLiteExecutionContextcBs#eZejd��Zd�ZRS(cCs |jjp|jjdt�S(Ntsqlite_raw_colnames(R7t_broken_dotted_colnamestexecution_optionstgetR?(R!((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt_preserve_raw_colnamesWs
cCs;|jr-d|kr-|jd�d|fS|dfSdS(Nt.i����(RCtsplitR(R!tcolname((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt_translate_colname^s(R9R:Rtmemoized_propertyRCRG(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR>Vst
SQLiteDialectcBskeZdZeZeZeZeZeZ	eZ
eZeZdZ
eZeZeZeZeZeZeZd"ZeZ
eZejied6fejid"d6fejid"d6d"d6d"d6fej id"d6fgZ!eZ"eZ#d"ed"d"d�Z$id	d
6dd6Z%d
�Z&d�Z'd�Z(e)j*d��Z+e)j*d"d��Z,e)j*d��Z-e)j*d��Z.d"d�Z/e)j*d"d��Z0e)j*d"d��Z1e)j*d"d��Z2d�Z3d�Z4e)j*d"d��Z5e)j*d"d��Z6d�Z7e)j*d"d��Z8e)j*d"d��Z9e)j*d"d��Z:e)j*d"d ��Z;d"d!�Z<RS(#R�tqmarkR�R�R�R�R�R�cKs�tjj||�||_||_||_||_|jdk	r�|jj	dk|_
|jj	dk|_|jj	d
k|_|jj	dk|_
|jj	dk|_|jj	dk|_ndS(Niiii
iiiiii(iii(ii
i(iii(iii(iii(iii(R	tDefaultDialectRtisolation_levelt_json_serializert_json_deserializertnative_datetimetdbapiRtsqlite_version_infotsupports_right_nested_joinsR@tsupports_default_valuesRntsupports_multivalues_insertt_broken_fk_pragma_quotes(R!RLRORMRNRA((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR�s,								isREAD UNCOMMITTEDitSERIALIZABLEcCs�y|j|jdd�}Wn<tk
r[tjd||jdj|j�f��nX|j�}|jd|�|j	�dS(Nt_R�sLInvalid value '%s' for isolation_level. Valid isolation levels for %s are %ss, sPRAGMA read_uncommitted = %d(
t_isolation_lookupR)RtRt
ArgumentErrortnameR�tcursortexecutetclose(R!t
connectiontlevelRLR[((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytset_isolation_level�s
&cCsl|j�}|jd�|j�}|r8|d}nd}|j�|dkrXdS|dkrhdSdS(NsPRAGMA read_uncommittediRVisREAD UNCOMMITTED(R[R\tfetchoneR](R!R^R[tresR3((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_isolation_level�s


cs*�jdk	r"�fd�}|SdSdS(Ncs�j|�j�dS(N(R`RL(tconn(R!(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytconnect�s(RLR(R!Re((R!sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt
on_connect�scKs@d}|j|�}g|D] }|ddkr|d^qS(NsPRAGMA database_listiR.(R\(R!R^R$tstdltdb((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_schema_names�sc	Ksh|dk	r+|jj|�}d|}nd}d|f}|j|�}g|D]}|d^qTS(Ns%s.sqlite_mastert
sqlite_masters4SELECT name FROM %s WHERE type='table' ORDER BY namei(Rtidentifier_preparertquote_identifierR\(	R!R^RR$tqschematmasterRgtrsR,((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_table_names�s

cKs0d}|j|�}g|D]}|d^qS(NsESELECT name FROM sqlite_temp_master WHERE type='table' ORDER BY name i(R\(R!R^R$RgRpR,((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_temp_table_namesscKs0d}|j|�}g|D]}|d^qS(NsDSELECT name FROM sqlite_temp_master WHERE type='view' ORDER BY name i(R\(R!R^R$RgRpR,((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_temp_view_namesscCs%|j|d|d|�}t|�S(Nt
table_infoR(t_get_table_pragmaR,(R!R^t
table_nameRtinfo((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt	has_tablesc	Ksh|dk	r+|jj|�}d|}nd}d|f}|j|�}g|D]}|d^qTS(Ns%s.sqlite_masterRks3SELECT name FROM %s WHERE type='view' ORDER BY namei(RRlRmR\(	R!R^RR$RnRoRgRpR,((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_view_names!s

c
Ks�|dk	rJ|jj|�}d|}d||f}|j|�}nMyd|}|j|�}Wn-tjk
r�d|}|j|�}nX|j�}	|	r�|	djSdS(Ns%s.sqlite_masters3SELECT sql FROM %s WHERE name = '%s'AND type='view's}SELECT sql FROM  (SELECT * FROM sqlite_master UNION ALL   SELECT * FROM sqlite_temp_master) WHERE name = '%s' AND type='view's?SELECT sql FROM sqlite_master WHERE name = '%s' AND type='view'i(RRlRmR\Rt
DBAPIErrortfetchallR(
R!R^t	view_nameRR$RnRoRgRptresult((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_view_definition/s$

c
Ks�|j|d|d|�}g}xo|D]g}|d|dj�|d|d|df\}}	}
}}|j|j||	|
||��q(W|S(NRtRiiiii(Rutuppertappendt_get_column_info(
R!R^RvRR$RwR�R,RZR�R�R	R�((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_columnsNs

cCs[|j|�}|dk	r-tj|�}ni|d6|d6|d6|d6dd6|d6S(NRZR�R�R	tautoR�R�(t_resolve_type_affinityRRt	text_type(R!RZR�R�R	R�RK((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR�escCs�tjd|�}|r9|jd�}|jd�}nd}d}||jkrd|j|}n�d|kr|tj}n�d|ks�d|ks�d|kr�tj}nXd	|ks�|r�tj}n9d
|ks�d|ks�d|kr�tj}n	tj	}|dk	r�tjd
|�}y)|g|D]}t|�^q/�}Wq�t
k
r~tjd||f�|�}q�Xn	|�}|S(sZReturn a data type from a reflected column, using affinity tules.

        SQLite's goal for universal compatibility introduces some complexity
        during reflection, as a column's defined type might not actually be a
        type that SQLite understands - or indeed, my not be defined *at all*.
        Internally, SQLite handles this with a 'data type affinity' for each
        column definition, mapping to one of 'TEXT', 'NUMERIC', 'INTEGER',
        'REAL', or 'NONE' (raw bits). The algorithm that determines this is
        listed in http://www.sqlite.org/datatype3.html section 2.1.

        This method allows SQLAlchemy to support that algorithm, while still
        providing access to smarter reflection utilities by regcognizing
        column definitions that SQLite only supports through affinity (like
        DATE and DOUBLE).

        s([\w ]+)(\(.*?\))?iiRxRYRtCLOBRR
RtFLOAtDOUBs(\d+)sNCould not instantiate type %s with reflected arguments %s; using no arguments.N(RRRt
ischema_namesR�RRtNullTypeRRRtfindalltintRCRtwarn(R!R�RRKR@ta((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR�ts8$$	)
	cKs�d}|j||d|�}|r`d}tj||tj�}|rW|jd�nd}n|j||||�}	g}
x,|	D]$}|dr�|
j|d�q�q�Wi|
d6|d6S(NRsCONSTRAINT (\w+) PRIMARY KEYiR�RZtconstrained_columns(Rt_get_table_sqlRR-tIRR�R�(R!R^RvRR$tconstraint_namet
table_datat
PK_PATTERNR}tcolstpkeystcol((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_pk_constraint�s

cs#�j|d|d|�}i}x�|D]�}|d|d|d|df\}}	}
}|dkrq|
}n�jr�tjdd|	�}	n||kr�||}nBidd	6gd
6|d6|	d6gd
6id6}||<|||<|d
j|
�|d
j|�q(Wd��t�fd�|j�D��}
�j||d|���dkrfgS��fd�}g}x�|�D]�\}}}}}�|||�}||
kr�t	j
d||f�q�n|
j|�}||d	<||d<|j|�q�W|j|
j��|S(Ntforeign_key_listRiiiis^[\"\[`\']|[\"\]`\']$RxRZR�treferred_schematreferred_tabletreferred_columnstoptionscSst|�|ft|�S(N(ttuple(R�R�R�((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytfk_sig�sc3s3|])}�|d|d|d�|fVqdS(R�R�R�N((R�tfk(R�(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pys	<genexpr>�sc
3s+d}xtj|�tj�D]}|jdddddd�\}}}}}}t�j|��}|sy|}nt�j|��}|p�|}i}xltjd|j��D]R}	|	jd	�r�|	dj	�|d
<q�|	jd�r�|	dj	�|d<q�q�W|||||fVqWdS(
Ns�(?:CONSTRAINT (\w+) +)?FOREIGN KEY *\( *(.+?) *\) +REFERENCES +(?:(?:"(.+?)")|([a-z0-9_]+)) *\((.+?)\) *((?:ON (?:DELETE|UPDATE) (?:SET NULL|SET DEFAULT|CASCADE|RESTRICT|NO ACTION) *)*)iiiiiis
 *\bON\b *tDELETEtondeletetUPDATEtonupdate(
RtfinditerR�RR�t_find_cols_in_sigRERt
startswithtstrip(
t
FK_PATTERNRR�R�treferred_quoted_namet
referred_nameR�tonupdatedeleteR�ttoken(R!R�(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt	parse_fks�s*0	shWARNING: SQL-parsed foreign key constraint '%s' could not be located in PRAGMA foreign_keys for table %s(
RuRRURtsubR�tdictR9R�RR�R>textend(R!R^RvRR$t
pragma_fkstfksR,tnumerical_idtrtbltlcoltrcolR�tkeys_by_signatureR�tfkeysR�R�R�R�R�tsigR((R�R!R�sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_foreign_keys�sX
.		

	*

ccsDx=tjd|tj�D]#}|jd�p:|jd�VqWdS(Ns(?:"(.+?)")|([a-z0-9_]+)ii(RR�R�R(R!R�R((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR�?sc
s	i}x\�j||d|dt|�D]9}|djd�sGq(nt|d�}|||<q(W�j||d||���s�gSg}��fd�}	x`|	�D]U\}
}t|�}||kr�|j|�i|
d6|d6}|j|�q�q�W|S(NRtinclude_auto_indexesRZtsqlite_autoindextcolumn_namesc3s�d}d}xRtj|�tj�D]8}|jdd�\}}|t�j|��fVq%WxXtj|�tj�D]>}t�j|jd�p�|jd���}d|fVqzWdS(Ns,(?:CONSTRAINT "?(.+?)"? +)?UNIQUE *\((.+?)\)s-(?:(".+?")|([a-z0-9]+)) +[a-z0-9_ ]+? +UNIQUEii(RR�R�RR�R�R(tUNIQUE_PATTERNtINLINE_UNIQUE_PATTERNRRZR�(R!R�(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt	parse_uqs]s*(tget_indexesR�R�R�R�R>R�(
R!R^RvRR$tauto_index_by_sigtidxR�tunique_constraintsR�RZR�tparsed_constraint((R!R�sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_unique_constraintsCs0	

c	Ks�|j||d||�}|s%gSd}g}xMtj||tj�D]3}|ji|jd�d6|jd�d6�qJW|S(NRs.(?:CONSTRAINT (\w+) +)?CHECK *\( *(.+) *\),? *itsqltextiRZ(R�RR�R�R�R(	R!R^RvRR$R�t
CHECK_PATTERNtcheck_constraintsR((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_check_constraintszs+c
Ks|j|d|d|�}g}|jdt�}xX|D]P}|r`|djd�r`q:n|jtd|ddgd|d	��q:Wx�t|�D]{}	|j|d
|	d�}
xY|
D]Q}|d	dkr�tj	d|	d�|j
|	�Pq�|	dj|d	�q�Wq�W|S(Nt
index_listRR�iR�RZR�R�it
index_infos;Skipped unsupported reflection of expression-based index %s(RuR>R?R�R�R�R�RRR�tremove(R!R^RvRR$tpragma_indexestindexesR�R,R�tpragma_index((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR��s*
	.

cKs�|rd|jj|�}nd}y+di|d6|d6}|j|�}Wn;tjk
r�di|d6|d6}|j|�}nX|j�S(Ns%s.Rxs�SELECT sql FROM  (SELECT * FROM %(schema)ssqlite_master UNION ALL   SELECT * FROM %(schema)ssqlite_temp_master) WHERE name = '%(table)s' AND type = 'table'RR�sSSELECT sql FROM %(schema)ssqlite_master WHERE name = '%(table)s' AND type = 'table'(RlRmR\RRztscalar(R!R^RvRR$tschema_exprRgRp((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR��sc
Cs�|jj}|dk	r+d||�}nd}||�}d|||f}|j|�}|jsw|j�}	ng}	|	S(Ns
PRAGMA %s.sPRAGMA s%s%s(%s)(RlRmRR\t_soft_closedR{(
R!R^R"RvRtquotet	statementtqtableR[R}((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRu�s	N(=R9R:RZR?tsupports_alterR�tsupports_unicode_statementstsupports_unicode_bindsRStsupports_empty_insertRnRTttuple_in_valuestdefault_paramstyleR>texecution_ctx_clsR]tstatement_compilerR�tddl_compilerR�R�R�R�R�tcolspecsRRLt	sa_schematTabletIndextColumnt
Constrainttconstruct_argumentsRUR@RRXR`RcRfR
tcacheRjRqRrRsRxRyR~R�R�R�R�R�R�R�R�R�R�Ru(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRIls�
*	
		



		6�	5"(:RMRGRtjsonRRRRxRRRR�RRR�RtengineR	R
RRR
RRRRRRRRRRRtobjectRtDateTimeR<tDateRNtTimeRPR�RTR[R\R�R�R]tDDLCompilerR�tGenericTypeCompilerR�tIdentifierPreparerR�tDefaultExecutionContextR>RKRI(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt<module>:s�4eAO





























`�&{

Zerion Mini Shell 1.0