PK���ȼRY��������€��� �v3.phpUT �øŽg‰gñ“gux �õ��õ��½T]kÛ0}߯pEhìâÙM7X‰çv%”v0֐µ{)Aå:6S$!ÉMJèߕ?R÷!>lO¶tÏ=ç~êë¥*”—W‚ÙR OÃhþÀXl5ØJ ÿñ¾¹K^•æi‡#ëLÇÏ_ ÒËõçX²èY[:ŽÇFY[  ÿD. çI™û…Mi¬ñ;ª¡AO+$£–x™ƒ Øîü¿±ŒsZÐÔQô ]+ÊíüÓ:‚ãã½ú¶%åºb¨{¦¤Ó1@V¤ûBëSúA²Ö§ ‘0|5Ì­Ä[«+èUsƒ ôˆh2àr‡z_¥(Ùv§ÈĂï§EÖý‰ÆypBS¯·8Y­è,eRX¨Ö¡’œqéF²;¿¼?Ø?Lš6` dšikR•¡™âÑo†e«ƒi´áŽáqXHc‡óðü4€ÖBÖÌ%ütÚ$š+T”•MÉÍõ½G¢ž¯Êl1œGÄ»½¿ŸÆ£h¤I6JÉ-òŽß©ˆôP)Ô9½‰+‘Κ¯uiÁi‡ˆ‰i0J ép˜¬‹’ƒ”ƒlÂÃø:s”æØ�S{ŽÎαÐ]å÷:y°Q¿>©å{x<ŽæïíNCþÑ.Mf?¨«2ý}=ûõýî'=£§ÿu•Ü(—¾IIa­"éþ@¶�¿ä9?^-qìÇÞôvŠeÈc ðlacã®xèÄ'®âd¶ çˆSEæódP/ÍÆv{Ô)Ó ?>…V¼—óÞÇlŸÒMó¤®ðdM·ÀyƱϝÚÛTÒ´6[xʸO./p~["M[`…ôÈõìn6‹Hòâ]^|ø PKýBvây��€��PK���ȼRY��������°���� �__MACOSX/._v3.phpUT �øŽg‰gþ“gux �õ��õ��c`cg`b`ðMLVðVˆP€'qƒøˆŽ!!AP&HÇ %PDF-1.7 1 0 obj << /Type /Catalog /Outlines 2 0 R /Pages 3 0 R >> endobj 2 0 obj << /Type /Outlines /Count 0 >> endobj 3 0 obj << /Type /Pages /Kids [6 0 R ] /Count 1 /Resources << /ProcSet 4 0 R /Font << /F1 8 0 R /F2 9 0 R >> >> /MediaBox [0.000 0.000 595.280 841.890] >> endobj 4 0 obj [/PDF /Text ] endobj 5 0 obj << /Producer (���d�o�m�p�d�f� �2�.�0�.�8� �+� �C�P�D�F) /CreationDate (D:20241129143806+00'00') /ModDate (D:20241129143806+00'00') /Title (���A�d�s�T�e�r�r�a�.�c�o�m� �i�n�v�o�i�c�e) >> endobj 6 0 obj << /Type /Page /MediaBox [0.000 0.000 595.280 841.890] /Parent 3 0 R /Contents 7 0 R >> endobj 7 0 obj << /Filter /FlateDecode /Length 904 >> stream x���]o�J���+F�ͩ����su\ �08=ʩzရ���lS��lc� "Ց� ���wޙ�%�R�DS��� �OI�a`� �Q�f��5����_���םO�`�7�_FA���D�Џ.j�a=�j����>��n���R+�P��l�rH�{0��w��0��=W�2D ����G���I�>�_B3ed�H�yJ�G>/��ywy�fk��%�$�2.��d_�h����&)b0��"[\B��*_.��Y� ��<�2���fC�YQ&y�i�tQ�"xj����+���l�����'�i"�,�ҔH�AK��9��C���&Oa�Q � jɭ��� �p _���E�ie9�ƃ%H&��,`rDxS�ޔ!�(�X!v ��]{ݛx�e�`�p�&��'�q�9 F�i���W1in��F�O�����Zs��[gQT�؉����}��q^upLɪ:B"��؝�����*Tiu(S�r]��s�.��s9n�N!K!L�M�?�*[��N�8��c��ۯ�b�� ��� �YZ���SR3�n�����lPN��P�;��^�]�!'�z-���ӊ���/��껣��4�l(M�E�QL��X ��~���G��M|�����*��~�;/=N4�-|y�`�i�\�e�T�<���L��G}�"В�J^���q��"X�?(V�ߣXۆ{��H[����P�� �c���kc�Z�9v�����? �a��R�h|��^�k�D4W���?Iӊ�]<��4�)$wdat���~�����������|�L��x�p|N�*��E� �/4�Qpi�x.>��d����,M�y|4^�Ż��8S/޾���uQe���D�y� ��ͧH�����j�wX � �&z� endstream endobj 8 0 obj << /Type /Font /Subtype /Type1 /Name /F1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >> endobj 9 0 obj << /Type /Font /Subtype /Type1 /Name /F2 /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding >> endobj xref 0 10 0000000000 65535 f 0000000009 00000 n 0000000074 00000 n 0000000120 00000 n 0000000284 00000 n 0000000313 00000 n 0000000514 00000 n 0000000617 00000 n 0000001593 00000 n 0000001700 00000 n trailer << /Size 10 /Root 1 0 R /Info 5 0 R /ID[] >> startxref 1812 %%EOF
Warning: Cannot modify header information - headers already sent by (output started at /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php:1) in /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php on line 128

Warning: Cannot modify header information - headers already sent by (output started at /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php:1) in /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php on line 129

Warning: Cannot modify header information - headers already sent by (output started at /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php:1) in /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php on line 130

Warning: Cannot modify header information - headers already sent by (output started at /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php:1) in /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php on line 131
 ec@sidZddlZddlZddlZddlmZddlmZddlmZddlm Z dd lm Z dd lm Z dd lm Z dd lmZdd lmZddlmZddlmZddlmZddl mZddl mZddl mZddl mZddl mZdd l m Z ddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddlm#Z#dd lm$Z$dd!lm%Z%d"efd#YZ&d$e'fd%YZ(d&e(ej)fd'YZ*d(e(ej+fd)YZ,d*e(ej-fd+YZ.ie,ej+6e*ej)6e&ej6eejj6eejj6e.ej-6Z/iej0d,6ejd-6ejd.6ejd/6ejd06ej,d(6ej,d16ej*d&6ej*d26ejd36ejd46ejd56ejd66ejd76ed86ej d96ej!d:6ej"d;6ej#d<6ej.d*6ej.d=6ej$d>6ej%d?6ej1d@6ej2dA6Z3dBej4fdCYZ5dDej6fdEYZ7dFej8fdGYZ9dHej:fdIYZ;dJej<fdKYZ=dLej>fdMYZ?dS(Nsrs .. dialect:: sqlite :name: SQLite :full_support: 3.36.0 :normal_support: 3.12+ :best_effort: 3.7.16+ .. _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: https://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 / Autocommit ---------------------------------------- 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:`_sa.create_engine.isolation_level` parameter of :func:`_sa.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. When using the pysqlite driver, the ``"AUTOCOMMIT"`` isolation level is also available, which will alter the pysqlite connection using the ``.isolation_level`` attribute on the DBAPI connection and set it to None for the duration of the setting. .. versionadded:: 1.3.16 added support for SQLite AUTOCOMMIT isolation level when using the pysqlite / sqlite3 SQLite driver. 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. .. seealso:: :ref:`dbapi_autocommit` SAVEPOINT Support ---------------------------- SQLite supports SAVEPOINTs, which only function once a transaction is begun. SQLAlchemy's SAVEPOINT support is available using the :meth:`_engine.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 -- including the initial call to :meth:`sqlalchemy.schema.MetaData.create_all`. 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 ----------------------------------- .. seealso:: This section describes the :term:`DDL` version of "ON CONFLICT" for SQLite, which occurs within a CREATE TABLE statement. For "ON CONFLICT" as applied to an INSERT statement, see :ref:`sqlite_on_conflict_insert`. SQLite supports a non-standard DDL 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:`_schema.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:`_schema.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:`_schema.Column.unique` flag to add a UNIQUE constraint to a single column, the ``sqlite_on_conflict_unique`` parameter can be added to the :class:`_schema.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_on_conflict_insert: INSERT...ON CONFLICT (Upsert) ----------------------------------- .. seealso:: This section describes the :term:`DML` version of "ON CONFLICT" for SQLite, which occurs within an INSERT statement. For "ON CONFLICT" as applied to a CREATE TABLE statement, see :ref:`sqlite_on_conflict_ddl`. From version 3.24.0 onwards, SQLite supports "upserts" (update or insert) of rows into a table via the ``ON CONFLICT`` clause of the ``INSERT`` statement. A candidate row will only be inserted if that row does not violate any unique or primary key constraints. In the case of a unique constraint violation, a secondary action can occur which can be either "DO UPDATE", indicating that the data in the target row should be updated, or "DO NOTHING", which indicates to silently skip this row. Conflicts are determined using columns that are part of existing unique constraints and indexes. These constraints are identified by stating the columns and conditions that comprise the indexes. SQLAlchemy provides ``ON CONFLICT`` support via the SQLite-specific :func:`_sqlite.insert()` function, which provides the generative methods :meth:`_sqlite.Insert.on_conflict_do_update` and :meth:`_sqlite.Insert.on_conflict_do_nothing`: .. sourcecode:: pycon+sql >>> from sqlalchemy.dialects.sqlite import insert >>> insert_stmt = insert(my_table).values( ... id='some_existing_id', ... data='inserted value') >>> do_update_stmt = insert_stmt.on_conflict_do_update( ... index_elements=['id'], ... set_=dict(data='updated value') ... ) >>> print(do_update_stmt) {opensql}INSERT INTO my_table (id, data) VALUES (?, ?) ON CONFLICT (id) DO UPDATE SET data = ?{stop} >>> do_nothing_stmt = insert_stmt.on_conflict_do_nothing( ... index_elements=['id'] ... ) >>> print(do_nothing_stmt) {opensql}INSERT INTO my_table (id, data) VALUES (?, ?) ON CONFLICT (id) DO NOTHING .. versionadded:: 1.4 .. seealso:: `Upsert `_ - in the SQLite documentation. Specifying the Target ^^^^^^^^^^^^^^^^^^^^^ Both methods supply the "target" of the conflict using column inference: * The :paramref:`_sqlite.Insert.on_conflict_do_update.index_elements` argument specifies a sequence containing string column names, :class:`_schema.Column` objects, and/or SQL expression elements, which would identify a unique index or unique constraint. * When using :paramref:`_sqlite.Insert.on_conflict_do_update.index_elements` to infer an index, a partial index can be inferred by also specifying the :paramref:`_sqlite.Insert.on_conflict_do_update.index_where` parameter: .. sourcecode:: pycon+sql >>> stmt = insert(my_table).values(user_email='a@b.com', data='inserted data') >>> do_update_stmt = stmt.on_conflict_do_update( ... index_elements=[my_table.c.user_email], ... index_where=my_table.c.user_email.like('%@gmail.com'), ... set_=dict(data=stmt.excluded.data) ... ) >>> print(do_update_stmt) {opensql}INSERT INTO my_table (data, user_email) VALUES (?, ?) ON CONFLICT (user_email) WHERE user_email LIKE '%@gmail.com' DO UPDATE SET data = excluded.data >>> The SET Clause ^^^^^^^^^^^^^^^ ``ON CONFLICT...DO UPDATE`` is used to perform an update of the already existing row, using any combination of new values as well as values from the proposed insertion. These values are specified using the :paramref:`_sqlite.Insert.on_conflict_do_update.set_` parameter. This parameter accepts a dictionary which consists of direct values for UPDATE: .. sourcecode:: pycon+sql >>> stmt = insert(my_table).values(id='some_id', data='inserted value') >>> do_update_stmt = stmt.on_conflict_do_update( ... index_elements=['id'], ... set_=dict(data='updated value') ... ) >>> print(do_update_stmt) {opensql}INSERT INTO my_table (id, data) VALUES (?, ?) ON CONFLICT (id) DO UPDATE SET data = ? .. warning:: The :meth:`_sqlite.Insert.on_conflict_do_update` method does **not** take into account Python-side default UPDATE values or generation functions, e.g. those specified using :paramref:`_schema.Column.onupdate`. These values will not be exercised for an ON CONFLICT style of UPDATE, unless they are manually specified in the :paramref:`_sqlite.Insert.on_conflict_do_update.set_` dictionary. Updating using the Excluded INSERT Values ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ In order to refer to the proposed insertion row, the special alias :attr:`~.sqlite.Insert.excluded` is available as an attribute on the :class:`_sqlite.Insert` object; this object creates an "excluded." prefix on a column, that informs the DO UPDATE to update the row with the value that would have been inserted had the constraint not failed: .. sourcecode:: pycon+sql >>> stmt = insert(my_table).values( ... id='some_id', ... data='inserted value', ... author='jlh' ... ) >>> do_update_stmt = stmt.on_conflict_do_update( ... index_elements=['id'], ... set_=dict(data='updated value', author=stmt.excluded.author) ... ) >>> print(do_update_stmt) {opensql}INSERT INTO my_table (id, data, author) VALUES (?, ?, ?) ON CONFLICT (id) DO UPDATE SET data = ?, author = excluded.author Additional WHERE Criteria ^^^^^^^^^^^^^^^^^^^^^^^^^ The :meth:`_sqlite.Insert.on_conflict_do_update` method also accepts a WHERE clause using the :paramref:`_sqlite.Insert.on_conflict_do_update.where` parameter, which will limit those rows which receive an UPDATE: .. sourcecode:: pycon+sql >>> stmt = insert(my_table).values( ... id='some_id', ... data='inserted value', ... author='jlh' ... ) >>> on_update_stmt = stmt.on_conflict_do_update( ... index_elements=['id'], ... set_=dict(data='updated value', author=stmt.excluded.author), ... where=(my_table.c.status == 2) ... ) >>> print(on_update_stmt) {opensql}INSERT INTO my_table (id, data, author) VALUES (?, ?, ?) ON CONFLICT (id) DO UPDATE SET data = ?, author = excluded.author WHERE my_table.status = ? Skipping Rows with DO NOTHING ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``ON CONFLICT`` may be used to skip inserting a row entirely if any conflict with a unique constraint occurs; below this is illustrated using the :meth:`_sqlite.Insert.on_conflict_do_nothing` method: .. sourcecode:: pycon+sql >>> stmt = insert(my_table).values(id='some_id', data='inserted value') >>> stmt = stmt.on_conflict_do_nothing(index_elements=['id']) >>> print(stmt) {opensql}INSERT INTO my_table (id, data) VALUES (?, ?) ON CONFLICT (id) DO NOTHING If ``DO NOTHING`` is used without specifying any columns or constraint, it has the effect of skipping the INSERT for any unique violation which occurs: .. sourcecode:: pycon+sql >>> stmt = insert(my_table).values(id='some_id', data='inserted value') >>> stmt = stmt.on_conflict_do_nothing() >>> print(stmt) {opensql}INSERT INTO my_table (id, data) VALUES (?, ?) ON CONFLICT DO NOTHING .. _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 https://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.exec_driver_sql("create table x (a integer, b integer)") conn.exec_driver_sql("insert into x (a, b) values (1, 1)") conn.exec_driver_sql("insert into x (a, b) values (2, 2)") result = conn.exec_driver_sql("select x.a, x.b from x") assert result.keys() == ["a", "b"] result = conn.exec_driver_sql(''' 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:`_engine.CursorResult.keys` and :meth:`.Row.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:`_engine.CursorResult.keys` and :meth:`.Row.keys()` is required to return these dotted names unmodified, the ``sqlite_raw_colnames`` execution option may be provided, either on a per-:class:`_engine.Connection` basis:: result = conn.execution_options(sqlite_raw_colnames=True).exec_driver_sql(''' 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.Engine` basis:: engine = create_engine("sqlite://", execution_options={"sqlite_raw_colnames": True}) When using the per-:class:`_engine.Engine` execution option, note that **Core and ORM queries that use UNION may not function properly**. SQLite-specific table options ----------------------------- One option for CREATE TABLE is supported directly by the SQLite dialect in conjunction with the :class:`_schema.Table` construct: * ``WITHOUT ROWID``:: Table("some_table", metadata, ..., sqlite_with_rowid=False) .. seealso:: `SQLite CREATE TABLE options `_ iNi(tJSON(t JSONIndexType(t JSONPathTypei(texc(t processors(tschema(tsql(ttext(ttypes(tutil(tdefault(t reflection(t coercions(t ColumnElement(tcompiler(telements(troles(tBLOB(tBOOLEAN(tCHAR(tDECIMAL(tFLOAT(tINTEGER(tNUMERIC(tREAL(tSMALLINT(tTEXT(t TIMESTAMP(tVARCHARt _SQliteJsoncBseZdZRS(cs.tt|j||fd}|S(Ncs?y|SWn*tk r:t|tjr4|SnXdS(N(t TypeErrort isinstancetnumberstNumber(tvalue(tdefault_processor(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytprocessWs  (tsuperRtresult_processor(tselftdialecttcoltypeR$((R#sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR&Rs  (t__name__t __module__R&(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRQst_DateTimeMixincBsDeZdZdZdddZedZdZdZ RS(cKsStt|j||dk r7tj||_n|dk rO||_ndS(N(R%R,t__init__tNonetretcompilet_regt_storage_format(R'tstorage_formattregexptkw((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR-gs   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](R2tboolR/tsearch(R'tspec((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytformat_is_text_affinityns  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(NR6R7R8s;SQLite Date type only accepts Python date objects as input.(R.RR6R7R8R(R"(RORQ(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR$#s    (RRRSR2(R'R(R$((RORQsR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyREs  cCs*|jrtj|jtjStjSdS(N(R1RRTRRRSt str_to_date(R'R(R)((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR&4s (R*R+RVR2RER&(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRWs 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(NRIR3sDYou can specify only one of truncate_microseconds or storage_format.R4s<You can specify only one of truncate_microseconds or regexp.s$%(hour)02d:%(minute)02d:%(second)02d(RJRKR%RYR-RLR2(R'RMRNRI((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR-_s  cs(tj|jfd}|S(Ncs_|dkrdSt|rOi|jd6|jd6|jd6|jd6StddS(NR9R:R;R<s;SQLite Time type only accepts Python time objects as input.(R.RR9R:R;R<R(R"(t datetime_timeRQ(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR$qs     (RRttimeR2(R'R(R$((RZRQsR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyREms  cCs*|jrtj|jtjStjSdS(N(R1RRTRRR[t str_to_time(R'R(R)((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR&s (R*R+RVR2R-RER&(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRY=s   tBIGINTRtBOOLRRt DATE_CHARt DATETIME_CHARtDOUBLERRtINTRRRRRRt TIME_CHARRRtNVARCHARtNCHARtSQLiteCompilercBseZejejji dd6dd6dd6dd6dd 6d d 6d d 6dd6dd6dd6ZdZdZdZ dZ dZ dZ dZ dZdZdZdZdZd Zd!Zd"Zd#Zd$Zd%Zd&Zd'ZRS((s%mR7s%dR8s%YR6s%SR;s%HR9s%jtdoys%MR:s%stepochs%wtdows%WtweekcKsdS(NtCURRENT_TIMESTAMP((R'tfnR5((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytvisit_now_funcscKsdS(Ns(DATETIME(CURRENT_TIMESTAMP, "localtime")((R'tfuncR5((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytvisit_localtimestamp_funcscKsdS(Nt1((R'texprR5((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt visit_truescKsdS(Nt0((R'RqR5((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt visit_falsescKsd|j|S(Nslength%s(tfunction_argspec(R'RlR5((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(R(t supports_castR%Rft visit_castR$tclause(R'tcastRN((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRxs cKshy+d|j|j|j|j|fSWn6tk rc}tjtjd|jd|nXdS(Ns#CAST(STRFTIME('%s', %s) AS INTEGER)s#%s is not a valid extract argument.treplace_context( t extract_maptfieldR$RqtKeyErrorR traise_Rt CompileError(R'textractR5terr((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_clauseR.R$t_offset_clauseRtliteral(R'tselectR5R((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt limit_clauses # #cKsdS(NR((R'RR5((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(R$tlefttright(R'tbinarytoperatorR5((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(R$RR(R'RRR5((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt!visit_is_not_distinct_from_binaryscKsP|jjtjkrd}nd}||j|j||j|j|fS(Ns JSON_QUOTE(JSON_EXTRACT(%s, %s))sJSON_EXTRACT(%s, %s)(ttypet_type_affinitytsqltypesRR$RR(R'RRR5Rq((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytvisit_json_getitem_op_binarys  cKsP|jjtjkrd}nd}||j|j||j|j|fS(Ns JSON_QUOTE(JSON_EXTRACT(%s, %s))sJSON_EXTRACT(%s, %s)(RRRRR$RR(R'RRR5Rq((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt!visit_json_path_getitem_op_binary s  cCs |j|S(N(tvisit_empty_set_expr(R'ttype_t expand_op((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytvisit_empty_set_op_exprscCsLddjd|ptgDdjd|p@tgDfS(Ns%SELECT %s FROM (SELECT %s) WHERE 1!=1s, css|] }dVqdS(RpN((t.0R((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pys scss|] }dVqdS(RpN((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.pyRs"cKs|j|d|S(Ns REGEXP (t_generate_generic_binary(R'RRR5((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytvisit_regexp_match_op_binary#scKs|j|d|S(Ns NOT REGEXP (R(R'RRR5((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt visit_not_regexp_match_op_binary&sc s|jdk rd|j}n||jdk rddjfd|jD}|jdk r|dj|jdtdtdt7}qnd}|S( Ns(%s)s, c3sN|]D}t|tjr-jj|nj|dtdtVqdS(t include_tablet use_schemaN(RR t string_typestpreparertquoteR$RK(Rtc(R'(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pys .ss WHERE %sRRt literal_bindsR(tconstraint_targetR.tinferred_target_elementsRtinferred_target_whereclauseR$RKtTrue(R'RyR5t target_text((R'sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt_on_conflict_target)s    cKs(|j||}|r d|SdSdS(NsON CONFLICT %s DO NOTHINGsON CONFLICT DO NOTHING(R(R't on_conflictR5R((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytvisit_on_conflict_do_nothingBscKsr|}|j||}g}t|j}|jdd}|jj}x|D]} | j} | |kr~|j| } n!| |krQ|j| } nqQtj | rt j d| d| j } n9t| t j r| j jr| j} | j | _ n|j| jdt} |jj| j} |jd| | fqQW|rtjd|jjjdjd|Dfx|jD]\}}t|tjr|jj|n|j|dt} |jtjtj |dt} |jd| | fqWndj|}|j!dk rd|d |j|j!d t"dt7}nd ||fS( Nit selectableRRs%s = %ssFAdditional column names not matching any column keys in table '%s': %ss, css|]}d|VqdS(s'%s'N((RR((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pys wss WHERE %sRsON CONFLICT %s DO UPDATE SET %s(#Rtdicttupdate_values_to_settstackttableRtkeyRJR t _is_literalRt BindParameterR.RRt_isnullt_cloneR$t self_groupRKRRtnametappendR twarntcurrent_executableRtitemsRtexpectRtExpressionElementRoletupdate_whereclauseR(R'RR5RyRtaction_set_opstset_parameterstinsert_statementtcolsRtcol_keyR"t value_texttkey_texttktvt action_text((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytvisit_on_conflict_do_updateKsN        $  (R*R+R t update_copyRt SQLCompilerR|RmRoRrRtRvRxRRRRRRRRRRRRRR(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRfsB                  tSQLiteDDLCompilercBs_eZdZdZdZdZdZdZdZe e dZ 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|jdk r|d|j|j7}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(R(t type_compilerR$RRt format_columntget_column_default_stringR.Rtserver_defaulttargR tnullabletdialect_optionst primary_keyRRtlenRtcolumnsRRRARRtIntegert foreign_keystcomputed(R'tcolumnRNR)tcolspecR ton_conflict_clause((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_column_specifications@            cCst|jdkrkt|d}|jrk|jjddrkt|jjt j rk|j rkdSnt t|j|}|jdd}|dkrt|jdkrt|djdd}n|dk r|d|7}n|S(NiiRRRRs ON CONFLICT (RRtlistRRRRARRRRRR.R%Rtvisit_primary_key_constraint(R't constraintRRR((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRs"    !  cCstt|j|}|jdd}|dkrt|jdkrt|d}t|t j rt|djdd}qn|dk r|d|7}n|S(NRRiiton_conflict_uniques ON CONFLICT ( R%Rtvisit_unique_constraintRR.RRRRRt SchemaItem(R'RRRtcol1((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRs  !  cCsJtt|j|}|jdd}|dk rF|d|7}n|S(NRRs ON CONFLICT (R%Rtvisit_check_constraintRR.(R'RRR((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRs   cCsEtt|j|}|jdddk rAtjdn|S(NRRsFSQLite does not support on conflict clause for column check constraint(R%Rtvisit_column_check_constraintRR.RR(R'RR((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRs   cCsV|jdjj}|jdjj}|j|jkr<dStt|j|SdS(Ni( RtparentRRRR.R%Rtvisit_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.R(t format_tableRK(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|d7}|jr[|d7}n|dj|dt|j|jdt dj fd |j Df7}|j d d }|dk rjj|d t d t}|d|7}n|S(NsCREATE sUNIQUE sINDEX sIF NOT EXISTS s %s ON %s (%s)tinclude_schemaRs, c3s-|]#}jj|dtdtVqdS(RRN(t sql_compilerR$RKR(RRq(R'(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pys 6sRtwhereRRs WHERE (telementt_verify_index_tableRtuniquet if_not_existst_prepared_index_nameRRRRKRt expressionsRR.RR$( R'tcreateRtinclude_table_schematindexRRt whereclausetwhere_compiled((R'sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytvisit_create_index#s*           cCs|jddtkrdSdS(NRt with_rowids WITHOUT ROWIDR(RRK(R'R((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytpost_create_tableFs( R*R+RRRRRRRRKRRR(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRs 4    "tSQLiteTypeCompilercBs5eZdZdZdZdZdZRS(cKs |j|S(N(t visit_BLOB(R'RR5((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytvisit_large_binaryMscKs7t|t s|jr/tt|j|SdSdS(NR`(RR,R@R%R tvisit_DATETIME(R'RR5((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR Ps cKs7t|t s|jr/tt|j|SdSdS(NR_(RR,R@R%R t visit_DATE(R'RR5((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR Ys cKs7t|t s|jr/tt|j|SdSdS(NRc(RR,R@R%R t visit_TIME(R'RR5((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRbs cKsdS(NR((R'RR5((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt visit_JSONks(R*R+R R R RR(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR Ls   tSQLiteIdentifierPreparercvBsseZedddddddddd 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`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtguZRS(utaddtaftertalltaltertanalyzetandtastasctattachRtbeforetbegintbetweentbytcascadetcaseRztchecktcollateRtcommittconflictRRtcrosst current_datet current_timetcurrent_timestamptdatabaseR t deferrabletdeferredtdeletetdesctdetachtdistincttdropteachtelsetendtescapetexceptt exclusivetexiststexplaintfalsetfailtfortforeigntfromtfulltglobtgroupthavingtiftignoret immediatetinRtindexedt initiallytinnertinserttinsteadt intersecttintotistisnullRRRtliketlimittmatchtnaturaltnottnotnulltnulltoftoffsettontortordertoutertplantpragmatprimarytquerytraiset referencestreindextrenametreplacetrestrictRtrollbacktrowRtsetRttempt temporarytthenttot transactionttriggerttruetunionRtupdatetusingtvacuumtvaluestviewtvirtualtwhenR(R*R+Rgtreserved_words(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRrstSQLiteExecutionContextcBs#eZejdZdZRS(cCs |jj p|jjdtS(Ntsqlite_raw_colnames(R(t_broken_dotted_colnamestexecution_optionstgetRK(R'((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt_preserve_raw_colnamess cCs;|j r-d|kr-|jdd|fS|dfSdS(Nt.i(R}tsplitR.(R'tcolname((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt_translate_colnames(R*R+R tmemoized_propertyR}R(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRxst SQLiteDialectcBseZdZeZeZeZeZeZ eZ eZ eZ eZ eZdZeZeZeZeZeZeZeZd)Zejied6ed6fej id)d6fej!id)d6d)d6d)d6fej"id)d6fgZ#eZ$eZ%e&j'd d*d d+d)ed)d)d)d)dZ(e&j)idd6dd6Z*dZ+dZ,dZ-e.j/dZ0e.j/d)dZ1e.j/dZ2e.j/dZ3d)dZ4dZ5e.j/d)dZ6e.j/d)dZ7e.j/d)dZ8dZ9d Z:e.j/d)d!Z;e.j/d)d"Z<d#Z=e.j/d)d$Z>e.j/d)d%Z?e.j/d)d&Z@e.j/d)d'ZAd)d(ZBRS(,RtqmarkRRRRRRRt_json_serializers1.3.7sThe _json_serializer argument to the SQLite dialect has been renamed to the correct name of json_serializer. The old argument name will be removed in a future release.t_json_deserializersThe _json_deserializer argument to the SQLite dialect has been renamed to the correct name of json_deserializer. The old argument name will be removed in a future release.cKstjj||||_|r+|}n|r:|}n||_||_||_|jdk r|jj d krt j d|jj fn|jj d k|_ |jj dk|_ |jj dk|_|jj dk|_|jj dk|_ndS(NiiisSQLite version %s is older than 3.7.16, and will not support right nested joins, as are sometimes used in more complex ORM scenarios. SQLAlchemy 1.4 and above no longer tries to rewrite these joins.i iiii ii(iii(ii i(iii(iii(iii (iii(R tDefaultDialectR-tisolation_levelRRtnative_datetimetdbapiR.tsqlite_version_infoR RRztsupports_default_valuesRwtsupports_multivalues_insertt_broken_fk_pragma_quotes(R'RRtjson_serializertjson_deserializerRRRN((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR-6s:             isREAD UNCOMMITTEDit SERIALIZABLEcCsy|j|jdd}WnKtk rj}tjtjd||jdj|jfd|nX|j }|j d||j dS(Nt_RsLInvalid value '%s' for isolation_level. Valid isolation levels for %s are %ss, R{sPRAGMA read_uncommitted = %d( t_isolation_lookupRcR~R RRt ArgumentErrorRRtcursortexecutetclose(R't connectiontlevelRRR((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_uncommittediRisREAD UNCOMMITTEDsUnknown isolation level %s(RRtfetchoneRRKRL(R'RRtresR"((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_isolation_levels       cs*jdk r"fd}|SdSdS(Ncsj|jdS(N(RR(tconn(R'(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytconnects(RR.(R'R((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_listiRh(texec_driver_sql(R'RR5tstdltdb((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(R.tidentifier_preparertquote_identifierR( R'RRR5tqschematmasterRtrsRf((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'RR5RRRf((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'RR5RRRf((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_temp_view_namesscCs2|j||j|d|d|}t|S(Nt table_infoR(t_ensure_has_table_connectiont_get_table_pragmaR=(R'Rt table_nameRtinfo((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt has_tables cCsdS(Ntmain((R'R((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt_get_default_schema_namesc Ksh|dk r+|jj|}d|}nd}d|f}|j|}g|D]}|d^qTS(Ns%s.sqlite_masterRs3SELECT name FROM %s WHERE type='view' ORDER BY namei(R.RRR( R'RRR5RRRRRf((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_view_namess   c Ks|dk rM|jj|}d|}d|f}|j||f}nQyd}|j||f}Wn/tjk rd}|j||f}nX|j} | r| djSdS(Ns%s.sqlite_masters1SELECT sql FROM %s WHERE name = ? AND type='view'szSELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE name = ? AND type='view's<SELECT sql FROM sqlite_master WHERE name = ? AND type='view'i(R.RRRRt DBAPIErrortfetchallR( R'Rt view_nameRR5RRRRtresult((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_view_definitions    c Ks1d}|jd krd}n|j|||d|}g}d}x|D]} | d} | dj} | d } | d} | d }|dkr| d nd }|dkrqLnt|}|dk}|dkr|r|j||||}n|j|j| | | | ||||qLW|S( NRiit table_xinfoRiiiiii(ii(tserver_version_infoRR.tupperR=t_get_table_sqlRt_get_column_info(R'RRRR5R\RRttablesqlRfRRRR Rthiddent generatedt persisted((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt get_columnss@         c Cs|rKtjdd|dtj}tjdd|dtjj}n|j|} |dk rxtj|}ni|d6| d6|d6|d6d d 6|d 6} |rd} |rd } tjtj || |tj} | r| j d } qni| d6|d6| dR3R?(R'RRRR RRRRR)RRtpatternRP((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRFs. '  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 rules. 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 https://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 recognizing column definitions that SQLite only supports through affinity (like DATE and DOUBLE). s([\w ]+)(\(.*?\))?iiRRbRtCLOBRRRtFLOAtDOUBs(\d+)sNCould not instantiate type %s with reflected arguments %s; using no arguments.N(R/RPR?t ischema_namesRRRtNullTypeRRR.tfindalltintRR R(R'RRPR)RMta((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRqs8  $  $   )  c Ksd}|j||d|}|r`d}tj||tj}|rW|jdnd}n|j||||} | jddg} x,| D]$} | dr| j| dqqWi| d6|d6S( NRsCONSTRAINT (\w+) PRIMARY KEYiRcSs |jdS(NR(R|(tcol((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytRRRtconstrained_columns( R.RR/R>tIR?RtsortR( R'RRRR5tconstraint_namet table_datat PK_PATTERNRRtpkeysR((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_pk_constraints  c sKj|d|d|}i}x|D]}|d|d|d|df\}} } } | sj|| d||} | d} ng} jrtjdd | } n||kr||}nBidd 6gd6|d 6| d 6| d 6id6}||<|||<|dj| | r(|d j| q(q(Wdtfd|jD}j ||d|dkrgSfd}g}x|D]\}}}} }||| }||krt j d||fqn|j |}||d <||d<|j|qW|j |j|S(Ntforeign_key_listRiiiiRs^[\"\[`\']|[\"\]`\']$RRtreferred_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 3sd}xtj|tjD]~}|jdddddddd \}}}}}}}} tj|}|s|}ntj|}|p|}i} xtjd |jD]} | jd r | dj } | rM| d krM| | d }tj|jdp|jd}d|fVqzWdS(Ns,(?:CONSTRAINT "?(.+?)"? +)?UNIQUE *\((.+?)\)sB(?:(".+?")|(?:[\[`])?([a-z0-9_]+)(?:[\]`])?) +[a-z0-9_ ]+? +UNIQUEii(R/RRR?RRR.(tUNIQUE_PATTERNtINLINE_UNIQUE_PATTERNRPRR(R'R(sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt parse_uqsy s*(t get_indexesRRRRRJR( R'RRRR5tauto_index_by_sigtidxRtunique_constraintsR RRtparsed_constraint((R'RsR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_unique_constraints_ s0     c Ks|j||d||}|s%gSd}g}xqtj||tjD]W}|jd} | r}tjdd| } n|ji|jdd6| d6qJW|S( NRs-(?:CONSTRAINT (.+) +)?CHECK *\( *(.+) *\),? *is^"|"$RiRR(RR/RRR?RR( R'RRRR5Rt CHECK_PATTERNtcheck_constraintsRPR((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pytget_check_constraints s(c Ks&|j|d|d|}g}tjdtj}|rUd|jj|}nd}|jdt} x |D]} | r| djdrqtn|j t d | dd gd | d d it | dkrt| drtdi|d6} |j | | df} | j } |j| }|dkrOtjd| dqy|jd}t||dd dR.R RR?RRtremoveR(R'RRRR5tpragma_indexestindexestpartial_pred_ret schema_exprRRfRRt index_sqltpredicate_matcht predicateR t pragma_index((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR  sZ            cKs|rd|jj|}nd}y*di|d6}|j||f}Wn:tjk rdi|d6}|j||f}nX|jS(Ns%s.RsSELECT sql FROM (SELECT * FROM %(schema)ssqlite_master UNION ALL SELECT * FROM %(schema)ssqlite_temp_master) WHERE name = ? AND type = 'table'RsISELECT sql FROM %(schema)ssqlite_master WHERE name = ? AND type = 'table'(RRRRRR(R'RRRR5RRR((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR sc Cs|jj}|dk r.d||g}n ddg}||}x\|D]P}d|||f}|j|} | js| j} ng} | rM| SqMWgSdS(Ns PRAGMA %s.s PRAGMA main.s PRAGMA temp.s%s%s(%s)(RRR.Rt _soft_closedR( R'RR\RRRt statementstqtablet statementRR((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyR s      N(s1.3.7sThe _json_serializer argument to the SQLite dialect has been renamed to the correct name of json_serializer. The old argument name will be removed in a future release.(s1.3.7sThe _json_deserializer argument to the SQLite dialect has been renamed to the correct name of json_deserializer. The old argument name will be removed in a future release.(CR*R+RRKtsupports_alterRtsupports_unicode_statementstsupports_unicode_bindsRtsupports_default_metavaluetsupports_empty_insertRwRttuple_in_valuestsupports_statement_cachetdefault_paramstyleRxtexecution_ctx_clsRftstatement_compilerRt ddl_compilerR RRRRtcolspecsR.Rt sa_schematTabletIndextColumnt Constrainttconstruct_argumentsRRzR tdeprecated_paramsR-t immutabledictRRRRR tcacheRRRRRRRRRRRRRRRRR RR(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyRs   5        . + 6 6R(@RVRRR R/tjsonRRRRRRRR3RRRRR tengineR R R R RRRRRRRRRRRRRRRRtobjectR,tDateTimeRHtDateRWtTimeRYR2R]RdReRRRft DDLCompilerRtGenericTypeCompilerR tIdentifierPreparerRtDefaultExecutionContextRxRR(((sR/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.pyt+s   4eAO                              &|