ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ 4]c@sdZddlZddlZddlmZddlmZddlmZddlmZdd lm Z dd lm Z dd lm Z dd lm Zdd lmZddlmZddlmZddl mZddl mZddl mZddl mZddl mZddl mZddl mZddl mZddl mZddl mZddl mZddl mZddl mZddl m Z de!fdYZ"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@ej2fdAYZ3dBej4fdCYZ5dDej6fdEYZ7dFej8fdGYZ9dS(HsQ .. 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 `_ - 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 `_ .. _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 `_ 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 `_ 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 `_. 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 `_ - 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 `_ - 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 [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**. iNi(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_DateTimeMixincBsDeZdZdZdddZedZdZdZ 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 ityeartmonthtdaythourtminutetsecondt microseconds[^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|trD|jr(|j|d\d+)/(?P\d+)/(?P\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|jfd}|S(NcsU|dkrdSt|rEi|jd6|jd6|jd6StddS(NR%R&R's;SQLite Date type only accepts Python date objects as input.(RRCR%R&R'RD(R3(RERG(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR5s    (RHRIR (R!R7R5((RERGsR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR6s  cCs*|jrtj|jtjStjSdS(N(RRRJRHRIt str_to_date(R!R7RL((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRM+s (R9R:RNR R6RM(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyROs tTIMEcBs/eZdZdZdZdZdZRS(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)06dcOsq|jdt}tt|j|||rmd|ksItdd|ksatdd|_ndS(NR=R"sDYou can specify only one of truncate_microseconds or storage_format.R#s<You can specify only one of truncate_microseconds or regexp.s$%(hour)02d:%(minute)02d:%(second)02d(R>R?RRQRR@R (R!RARBR=((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRVs  cs(tj|jfd}|S(Ncs_|dkrdSt|rOi|jd6|jd6|jd6|jd6StddS(NR(R)R*R+s;SQLite Time type only accepts Python time objects as input.(RRCR(R)R*R+RD(R3(t datetime_timeRG(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR5hs     (RHttimeR (R!R7R5((RRRGsR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR6ds  cCs*|jrtj|jtjStjSdS(N(RRRJRHRSt str_to_time(R!R7RL((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRMzs (R9R:RNR RR6RM(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRQ4s   tBIGINTR tBOOLRRt DATE_CHARt DATETIME_CHARtDOUBLERRtINTRRRRRRt TIME_CHARRRtNVARCHARtNCHARtSQLiteCompilercBseZejejji dd6dd6dd6dd6dd 6d d 6d d 6dd6dd6dd6ZdZdZdZ dZ dZ dZ dZ dZdZdZdZdZd 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_funcscKsdS(Ns(DATETIME(CURRENT_TIMESTAMP, "localtime")((R!tfuncR$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytvisit_localtimestamp_funcscKsdS(Nt1((R!texprR$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt visit_truescKsdS(Nt0((R!RiR$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt visit_falsescKsd|j|S(Nslength%s(tfunction_argspec(R!RdR$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytvisit_char_length_funcscKs<|jjr%tt|j||S|j|j|SdS(N(R7t supports_castRR^t visit_castR5tclause(R!tcastRB((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRps cKsYy+d|j|j|j|j|fSWn'tk rTtjd|jnXdS(Ns#CAST(STRFTIME('%s', %s) AS INTEGER)s#%s is not a valid extract argument.(t extract_maptfieldR5RitKeyErrorRt CompileError(R!textractR$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt visit_extracts  cKsd}|jdk r5|d|j|j|7}n|jdk r|jdkrv|d|jtjd7}n|d|j|j|7}n#|d|jtjd|7}|S(Nts LIMIT is 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_clauses # #cKsdS(NRy((R!R}R$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytfor_update_clausescKs&d|j|j|j|jfS(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_binaryscKs&d|j|j|j|jfS(Ns%s IS %s(R5RR(R!RRR$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt visit_isnot_distinct_from_binaryscKs,d|j|j||j|j|fS(Ns JSON_QUOTE(JSON_EXTRACT(%s, %s))(R5RR(R!RRR$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytvisit_json_getitem_op_binaryscKs,d|j|j||j|j|fS(Ns JSON_QUOTE(JSON_EXTRACT(%s, %s))(R5RR(R!RRR$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt!visit_json_path_getitem_op_binaryscCsLddjd|ptgDdjd|p@tgDfS(Ns%SELECT %s FROM (SELECT %s) WHERE 1!=1s, css|] }dVqdS(RhN((t.0ttype_((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pys scss|] }dVqdS(RhN((RR((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pys s(tjoinR(R!t element_types((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytvisit_empty_set_exprs"(R9R:Rt update_copyR t SQLCompilerRsReRgRjRlRnRpRxRRRRRRR(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR^s6             tSQLiteDDLCompilercBsVeZdZdZdZdZdZdZdZe e dZ RS(cKs|jjj|jd|}|jj|d|}|j|}|dk rt|j j t ryd|d}n|d|7}n|j s|d7}|j dd}|dk r|d |7}qn|jr|jtkrt|jjjd krtjd n|jj dd rt|jjjd krt|jjtjr|j r|d 7}|j dd}|dk r|d |7}n|d7}qn|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_stringRRCtserver_defaulttargR tnullabletdialect_optionst primary_keyRtTruetlenttabletcolumnsRRvR0t_type_affinitytsqltypestIntegert foreign_keys(R!tcolumnRBRLtcolspecR ton_conflict_clause((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_column_specification s<            cCst|jdkrkt|d}|jrk|jjddrkt|jjt j rk|j rkdSnt t|j|}|jdd}|dkrt|jdkrt|djdd}n|dk r|d|7}n|S(NiiRRt on_conflictRs ON CONFLICT (RRtlistRRRR0RRRRRRRRtvisit_primary_key_constraint(R!t constrainttcR~R((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR:s"    !  cCstt|j|}|jdd}|dkrht|jdkrht|djdd}n|dk r|d|7}n|S(NRRiiton_conflict_uniques ON CONFLICT (RRtvisit_unique_constraintRRRRR(R!RR~R((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRYs  !  cCsJtt|j|}|jdd}|dk rF|d|7}n|S(NRRs ON CONFLICT (RRtvisit_check_constraintRR(R!RR~R((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRks   cCsEtt|j|}|jdddk rAtjdn|S(NRRsFSQLite does not support on conflict clause for column check constraint(RRtvisit_column_check_constraintRRRRv(R!RR~((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRys   cCsV|jdjj}|jdjj}|j|jkr<dStt|j|SdS(Ni( telementstparentRRRRRRtvisit_foreign_key_constraint(R!Rt local_tablet remote_table((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRs cCs|j|dtS(s=Format the remote table clause of a CREATE CONSTRAINT clause.t use_schema(t format_tableR?(R!RRR((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytdefine_constraint_remote_tablesc s|j}j|j}d}|jr;|d7}n|dj|dt|j|jdtdj fd|j Df7}|j dd }|dk rj j|d td t}|d |7}n|S( NsCREATE sUNIQUE sINDEX %s ON %s (%s)tinclude_schemaRs, c3s-|]#}jj|dtdtVqdS(t include_tablet literal_bindsN(t sql_compilerR5R?R(RRi(R!(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pys sRtwhereRRs WHERE (telementt_verify_index_tableRtuniquet_prepared_index_nameRRRR?Rt expressionsRRRR5( R!tcreateRtinclude_table_schematindexRR~t whereclausetwhere_compiled((R!sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytvisit_create_indexs$        ( R9R:RRRRRRRR?RR(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR s 0    tSQLiteTypeCompilercBs5eZdZdZdZdZdZRS(cKs |j|S(N(t visit_BLOB(R!RR$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytvisit_large_binaryscKs7t|t s|jr/tt|j|SdSdS(NRX(RCRR/RRtvisit_DATETIME(R!RR$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRs cKs7t|t s|jr/tt|j|SdSdS(NRW(RCRR/RRt visit_DATE(R!RR$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRs cKs7t|t s|jr/tt|j|SdSdS(NR[(RCRR/RRt visit_TIME(R!RR$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRs cKsdS(NR((R!RR$((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt visit_JSONs(R9R:RRRRR(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRs   tSQLiteIdentifierPreparercuBspeZedddddddddd d d d 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`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsgtZRS(ttaddtaftertalltaltertanalyzetandtastasctattachRtbeforetbegintbetweentbytcascadetcaseRrtchecktcollateRtcommittconflictRRtcrosst current_datet current_timetcurrent_timestamptdatabaseR t deferrabletdeferredtdeletetdesctdetachtdistincttdropteachtelsetendtescapetexceptt exclusivetexplaintfalsetfailtfortforeigntfromtfulltglobtgroupthavingtiftignoret immediatetinRtindexedt initiallytinnertinserttinsteadt intersecttintotistisnullRtkeyRtliketlimittmatchtnaturaltnottnotnulltnulltoftoffsettontortordertoutertplantpragmatprimarytquerytraiset referencestreindextrenametreplacetrestrictRtrollbacktrowR}tsetRttempt temporarytthenttot transactionttriggerttruetunionRtupdatetusingtvacuumtvaluestviewtvirtualtwhenR(R9R:R.treserved_words(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRstSQLiteExecutionContextcBs#eZejdZdZRS(cCs |jj p|jjdtS(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-|jdd|fS|dfSdS(Nt.i(RDtsplitR(R!tcolname((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt_translate_colname^s(R9R:Rtmemoized_propertyRDRH(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR?Vst SQLiteDialectcBskeZdZeZeZeZeZeZ eZ eZ eZ dZ eZeZeZeZeZeZeZd"ZeZ eZejied6fejid"d6fejid"d6d"d6d"d6fej id"d6fgZ!eZ"eZ#d"ed"d"dZ$id d 6d d 6Z%d Z&dZ'dZ(e)j*dZ+e)j*d"dZ,e)j*dZ-e)j*dZ.d"dZ/e)j*d"dZ0e)j*d"dZ1e)j*d"dZ2dZ3dZ4e)j*d"dZ5e)j*d"dZ6dZ7e)j*d"dZ8e)j*d"dZ9e)j*d"dZ:e)j*d"d Z;d"d!Z<RS(#RtqmarkRRRRRRcKstjj||||_||_||_||_|jdk r|jj d k|_ |jj d k|_ |jj d k|_ |jj dk|_ |jj dk|_|jj dk|_ndS(Niiii iiii ii(iii(ii i(iii(iii(iii (iii(R tDefaultDialectRtisolation_levelt_json_serializert_json_deserializertnative_datetimetdbapiRtsqlite_version_infotsupports_right_nested_joinsRAtsupports_default_valuesRotsupports_multivalues_insertt_broken_fk_pragma_quotes(R!RMRPRNRORB((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRs,           isREAD UNCOMMITTEDit SERIALIZABLEcCsy|j|jdd}Wn<tk r[tjd||jdj|jfnX|j}|jd||j dS(Nt_RsLInvalid value '%s' for isolation_level. Valid isolation levels for %s are %ss, sPRAGMA read_uncommitted = %d( t_isolation_lookupR*RuRt ArgumentErrortnameRtcursortexecutetclose(R!t connectiontlevelRMR\((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytset_isolation_levels & cCs|j}|jd|j}|r8|d}nd}|j|dkrXdS|dkrhdSts~td|dS(NsPRAGMA read_uncommittediRWisREAD UNCOMMITTEDsUnknown isolation level %s(R\R]tfetchoneR^R?R@(R!R_R\tresR3((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_isolation_levels       cs*jdk r"fd}|SdSdS(Ncsj|jdS(N(RaRM(tconn(R!(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytconnects(RMR(R!Rf((R!sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt on_connectscKs@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_namessc 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$tqschematmasterRhtrsR-((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_table_namess   cKs0d}|j|}g|D]}|d^qS(NsESELECT name FROM sqlite_temp_master WHERE type='table' ORDER BY name i(R](R!R_R$RhRqR-((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$RhRqR-((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_masterRls3SELECT name FROM %s WHERE type='view' ORDER BY namei(RRmRnR]( R!R_RR$RoRpRhRqR-((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 rd|}|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(RRmRnR]Rt DBAPIErrortfetchallR( R!R_t view_nameRR$RoRpRhRqtresult((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(NRuRiiiii(Rvtuppertappendt_get_column_info( R!R_RwRR$RxRR-R[RRR R((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt get_columnsNs  cCs[|j|}|dk r-tj|}ni|d6|d6|d6|d6dd6|d6S(NR[RRR tautoRR(t_resolve_type_affinityRRt text_type(R!R[RRR RRL((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRes cCstjd|}|r9|jd}|jd}n d}d}||jkrd|j|}nd|kr|tj}nd|ksd|ksd|krtj}nXd |ks| rtj}n9d |ksd |ksd |krtj}n tj }|dk rtj d |}y)|g|D]}t |^q/}Wqt k r~tjd||f|}qXn |}|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 ]+)(\(.*?\))?iiRyRZRtCLOBRR RtFLOAtDOUBs(\d+)sNCould not instantiate type %s with reflected arguments %s; using no arguments.N(RRRt ischema_namesRRRtNullTypeRRRtfindalltintRDRtwarn(R!RRRLRAta((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRts8  $  $   )  c Ksd}|j||d|}|r`d}tj||tj}|rW|jdnd}n|j||||} g} x,| D]$} | dr| j| dqqWi| d6|d6S(NRsCONSTRAINT (\w+) PRIMARY KEYiRR[tconstrained_columns(Rt_get_table_sqlRR-tIRRR( R!R_RwRR$tconstraint_namet table_datat PK_PATTERNR~tcolstpkeystcol((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_pk_constraints  c s#j|d|d|}i}x|D]}|d|d|d|df\}} } } | dkrq| } njrtjdd| } n||kr||} nBidd 6gd 6|d 6| d 6gd 6id6} ||<| ||<| d j| | d j| q(Wdtfd|jD} j||d|dkrfgSfd}g}x|D]\}}}}}|||}|| krt j d||fqn| j |}||d <||d<|j|qW|j | j|S(Ntforeign_key_listRiiiis^[\"\[`\']|[\"\]`\']$RyR[Rtreferred_schematreferred_tabletreferred_columnstoptionscSst||ft|S(N(ttuple(RRR((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytfk_sigsc3s3|])}|d|d|d|fVqdS(RRRN((Rtfk(R(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pys sc 3s+d}xtj|tjD]}|jdddddd\}}}}}}tj|}|sy|}ntj|}|p|}i}xltjd|jD]R} | jd r| dj |d textend(R!R_RwRR$t pragma_fkstfksR-t numerical_idtrtbltlcoltrcolRtkeys_by_signatureRtfkeysRRRRRtsigR((RR!RsR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_foreign_keyssX .         *   ccsDx=tjd|tjD]#}|jdp:|jdVqWdS(Ns(?:"(.+?)")|([a-z0-9_]+)ii(RRRR(R!RR((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR?sc  s i}x\j||d|dt|D]9}|djdsGq(nt|d}|||}tj|jdp|jd}d|fVqzWdS(Ns,(?:CONSTRAINT "?(.+?)"? +)?UNIQUE *\((.+?)\)s-(?:(".+?")|([a-z0-9]+)) +[a-z0-9_ ]+? +UNIQUEii(RRRRRRR(tUNIQUE_PATTERNtINLINE_UNIQUE_PATTERNRR[R(R!R(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt parse_uqs]s*(t get_indexesRRRRR>R( R!R_RwRR$tauto_index_by_sigtidxRtunique_constraintsRR[Rtparsed_constraint((R!RsR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_unique_constraintsCs0     c Ks|j||d||}|s%gSd}g}xMtj||tjD]3}|ji|jdd6|jdd6qJW|S(NRs.(?:CONSTRAINT (\w+) +)?CHECK *\( *(.+) *\),? *itsqltextiR[(RRRRRR( R!R_RwRR$Rt 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`|djdr`q:n|jtd|ddgd|d q:Wxt|D]{} |j|d | d} xY| D]Q}|d dkrtj d | d|j | Pq| dj|d qWqW|S( Nt index_listRRiRR[RRit index_infos;Skipped unsupported reflection of expression-based index %s( RvR>R?RRRRRRRtremove( R!R_RwRR$tpragma_indexestindexesRR-Rt pragma_index((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRs*  .   cKs|rd|jj|}nd}y+di|d6|d6}|j|}Wn;tjk rdi|d6|d6}|j|}nX|jS(Ns%s.RysSELECT sql FROM (SELECT * FROM %(schema)ssqlite_master UNION ALL SELECT * FROM %(schema)ssqlite_temp_master) WHERE name = '%(table)s' AND type = 'table'RRsSSELECT sql FROM %(schema)ssqlite_master WHERE name = '%(table)s' AND type = 'table'(RmRnR]RR{tscalar(R!R_RwRR$t schema_exprRhRq((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRsc Cs|jj}|dk r+d||}nd}||}d|||f}|j|}|jsw|j} ng} | S(Ns PRAGMA %s.sPRAGMA s%s%s(%s)(RmRnRR]t _soft_closedR|( R!R_R#RwRtquotet statementtqtableR\R~((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRvs    N(=R9R:R[R?tsupports_alterRtsupports_unicode_statementstsupports_unicode_bindsRTtsupports_empty_insertRoRUttuple_in_valuestdefault_paramstyleR?texecution_ctx_clsR^tstatement_compilerRt ddl_compilerRRRRRtcolspecsRRMt sa_schematTabletIndextColumnt Constrainttconstruct_argumentsRVRARRYRaRdRgR tcacheRkRrRsRtRyRzRRRRRRRRRRRRv(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRJls  *        6 5"(:RNRHRtjsonRRRRyRRRRRRRRtengineR R R R R RRRRRRRRRRRtobjectRtDateTimeR<tDateROtTimeRQRRUR\R]RRR^t DDLCompilerRtGenericTypeCompilerRtIdentifierPreparerRtDefaultExecutionContextR?RLRJ(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt:s  4eAO                              `&{