ÿØÿà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@s dZddlmZddlmZddlZddlZddlmZ ddl m Z ddl m Z dd l mZdd l mZdd l mZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddlm#Z#ddlm$Z$ddlm%Z%dd lm&Z&dd!lm'Z'dd"lm(Z(dd#lm)Z)dd$lm*Z*dd%lm+Z+dd&lm,Z,dd'lm-Z-dd(lm.Z.dd)lm/Z/dd*lm0Z0d+d,lm1Z1d+d-lm2Z2d+d.lm3Z4d+d/lm5Z5d+d0lmZ6d+d1lm7Z7d+d2l8m9Z9d+dl8mZd+d3l5m:Z:d+d4l5m;Z;d+d5lm<Z<d+d6lm=Z=d+d7lm>Z>d+d8lm?Z?d+d9lm@Z@d+d:l7mAZAeBd;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d;dddddd!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLgZCejDdMejEejFBZGejDdNejEejFBZHe*ZIe ZJe ZKeZLe!ZMe,ZNe=ZOe<ZPe@ZQe$ZRe&ZSeZTe/ZUe ZVe#ZWe.ZXe)ZYe0ZZe+Z[eZ\e(Z]e-Z^e"Z_eZ`e%ZaeZbeZce'ZdeZeeZfi ee6ee6ee6e%e6jg6ee6jh6e*e6ji6e e6jj6ee6jk6ee6j6ee6jj6ee6jj6Zli#edF6e<dG6edO6e=dH6e>dP6edO6e?dQ6edR6edf6edq6e dS6edT6ed~6ed6ed6edU6ed6e d6e!d6e"d6e#d6e$dV6e&dW6e%d6e d6e(d6e)dX6e*dY6e+dZ6e,d6e-d6e.d6e@d6e/d6e0d[6Zmd\e9jnfd]YZod^e:jpfd_YZqd`e:jrfdaYZsdbe:jtfdcYZudde:jvfdeYZwe2jxdfe9jyfdgYZzdhe{fdiYZ|dS(jsm .. dialect:: mysql :name: MySQL Supported Versions and Features ------------------------------- SQLAlchemy supports MySQL starting with version 4.1 through modern releases. However, no heroic measures are taken to work around major missing SQL features - if your server version does not support sub-selects, for example, they won't work in SQLAlchemy either. See the official MySQL documentation for detailed information about features supported in any given server release. .. _mysql_connection_timeouts: Connection Timeouts and Disconnects ----------------------------------- MySQL features an automatic connection close behavior, for connections that have been idle for a fixed period of time, defaulting to eight hours. To circumvent having this issue, use the :paramref:`.create_engine.pool_recycle` option which ensures that a connection will be discarded and replaced with a new one if it has been present in the pool for a fixed number of seconds:: engine = create_engine('mysql+mysqldb://...', pool_recycle=3600) For more comprehensive disconnect detection of pooled connections, including accommodation of server restarts and network issues, a pre-ping approach may be employed. See :ref:`pool_disconnects` for current approaches. .. seealso:: :ref:`pool_disconnects` - Background on several techniques for dealing with timed out connections as well as database restarts. .. _mysql_storage_engines: CREATE TABLE arguments including Storage Engines ------------------------------------------------ MySQL's CREATE TABLE syntax includes a wide array of special options, including ``ENGINE``, ``CHARSET``, ``MAX_ROWS``, ``ROW_FORMAT``, ``INSERT_METHOD``, and many more. To accommodate the rendering of these arguments, specify the form ``mysql_argument_name="value"``. For example, to specify a table with ``ENGINE`` of ``InnoDB``, ``CHARSET`` of ``utf8mb4``, and ``KEY_BLOCK_SIZE`` of ``1024``:: Table('mytable', metadata, Column('data', String(32)), mysql_engine='InnoDB', mysql_charset='utf8mb4', mysql_key_block_size="1024" ) The MySQL dialect will normally transfer any keyword specified as ``mysql_keyword_name`` to be rendered as ``KEYWORD_NAME`` in the ``CREATE TABLE`` statement. A handful of these names will render with a space instead of an underscore; to support this, the MySQL dialect has awareness of these particular names, which include ``DATA DIRECTORY`` (e.g. ``mysql_data_directory``), ``CHARACTER SET`` (e.g. ``mysql_character_set``) and ``INDEX DIRECTORY`` (e.g. ``mysql_index_directory``). The most common argument is ``mysql_engine``, which refers to the storage engine for the table. Historically, MySQL server installations would default to ``MyISAM`` for this value, although newer versions may be defaulting to ``InnoDB``. The ``InnoDB`` engine is typically preferred for its support of transactions and foreign keys. A :class:`.Table` that is created in a MySQL database with a storage engine of ``MyISAM`` will be essentially non-transactional, meaning any INSERT/UPDATE/DELETE statement referring to this table will be invoked as autocommit. It also will have no support for foreign key constraints; while the ``CREATE TABLE`` statement accepts foreign key options, when using the ``MyISAM`` storage engine these arguments are discarded. Reflecting such a table will also produce no foreign key constraint information. For fully atomic transactions as well as support for foreign key constraints, all participating ``CREATE TABLE`` statements must specify a transactional engine, which in the vast majority of cases is ``InnoDB``. .. seealso:: `The InnoDB Storage Engine `_ - on the MySQL website. Case Sensitivity and Table Reflection ------------------------------------- MySQL has inconsistent support for case-sensitive identifier names, basing support on specific details of the underlying operating system. However, it has been observed that no matter what case sensitivity behavior is present, the names of tables in foreign key declarations are *always* received from the database as all-lower case, making it impossible to accurately reflect a schema where inter-related tables use mixed-case identifier names. Therefore it is strongly advised that table names be declared as all lower case both within SQLAlchemy as well as on the MySQL database itself, especially if database reflection features are to be used. .. _mysql_isolation_level: Transaction Isolation Level --------------------------- All MySQL dialects support setting of transaction isolation level both via a dialect-specific parameter :paramref:`.create_engine.isolation_level` accepted by :func:`.create_engine`, as well as the :paramref:`.Connection.execution_options.isolation_level` argument as passed to :meth:`.Connection.execution_options`. This feature works by issuing the command ``SET SESSION TRANSACTION ISOLATION LEVEL `` for each new connection. For the special AUTOCOMMIT isolation level, DBAPI-specific techniques are used. To set isolation level using :func:`.create_engine`:: engine = create_engine( "mysql://scott:tiger@localhost/test", isolation_level="READ UNCOMMITTED" ) To set using per-connection execution options:: connection = engine.connect() connection = connection.execution_options( isolation_level="READ COMMITTED" ) Valid values for ``isolation_level`` include: * ``READ COMMITTED`` * ``READ UNCOMMITTED`` * ``REPEATABLE READ`` * ``SERIALIZABLE`` * ``AUTOCOMMIT`` The special ``AUTOCOMMIT`` value makes use of the various "autocommit" attributes provided by specific DBAPIs, and is currently supported by MySQLdb, MySQL-Client, MySQL-Connector Python, and PyMySQL. Using it, the MySQL connection will return true for the value of ``SELECT @@autocommit;``. .. versionadded:: 1.1 - added support for the AUTOCOMMIT isolation level. AUTO_INCREMENT Behavior ----------------------- When creating tables, SQLAlchemy will automatically set ``AUTO_INCREMENT`` on the first :class:`.Integer` primary key column which is not marked as a foreign key:: >>> t = Table('mytable', metadata, ... Column('mytable_id', Integer, primary_key=True) ... ) >>> t.create() CREATE TABLE mytable ( id INTEGER NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) ) You can disable this behavior by passing ``False`` to the :paramref:`~.Column.autoincrement` argument of :class:`.Column`. This flag can also be used to enable auto-increment on a secondary column in a multi-column key for some storage engines:: Table('mytable', metadata, Column('gid', Integer, primary_key=True, autoincrement=False), Column('id', Integer, primary_key=True) ) .. _mysql_ss_cursors: Server Side Cursors ------------------- Server-side cursor support is available for the MySQLdb and PyMySQL dialects. From a MySQL point of view this means that the ``MySQLdb.cursors.SSCursor`` or ``pymysql.cursors.SSCursor`` class is used when building up the cursor which will receive results. The most typical way of invoking this feature is via the :paramref:`.Connection.execution_options.stream_results` connection execution option. Server side cursors can also be enabled for all SELECT statements unconditionally by passing ``server_side_cursors=True`` to :func:`.create_engine`. .. versionadded:: 1.1.4 - added server-side cursor support. .. _mysql_unicode: Unicode ------- Charset Selection ~~~~~~~~~~~~~~~~~ Most MySQL DBAPIs offer the option to set the client character set for a connection. This is typically delivered using the ``charset`` parameter in the URL, such as:: e = create_engine( "mysql+pymysql://scott:tiger@localhost/test?charset=utf8mb4") This charset is the **client character set** for the connection. Some MySQL DBAPIs will default this to a value such as ``latin1``, and some will make use of the ``default-character-set`` setting in the ``my.cnf`` file as well. Documentation for the DBAPI in use should be consulted for specific behavior. The encoding used for Unicode has traditionally been ``'utf8'``. However, for MySQL versions 5.5.3 on forward, a new MySQL-specific encoding ``'utf8mb4'`` has been introduced, and as of MySQL 8.0 a warning is emitted by the server if plain ``utf8`` is specified within any server-side directives, replaced with ``utf8mb3``. The rationale for this new encoding is due to the fact that MySQL's legacy utf-8 encoding only supports codepoints up to three bytes instead of four. Therefore, when communicating with a MySQL database that includes codepoints more than three bytes in size, this new charset is preferred, if supported by both the database as well as the client DBAPI, as in:: e = create_engine( "mysql+pymysql://scott:tiger@localhost/test?charset=utf8mb4") All modern DBAPIs should support the ``utf8mb4`` charset. In order to use ``utf8mb4`` encoding for a schema that was created with legacy ``utf8``, changes to the MySQL schema and/or server configuration may be required. .. seealso:: `The utf8mb4 Character Set \ `_ - \ in the MySQL documentation .. _mysql_binary_introducer: Dealing with Binary Data Warnings and Unicode ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MySQL versions 5.6, 5.7 and later (not MariaDB at the time of this writing) now emit a warning when attempting to pass binary data to the database, while a character set encoding is also in place, when the binary data itself is not valid for that encoding:: default.py:509: Warning: (1300, "Invalid utf8mb4 character string: 'F9876A'") cursor.execute(statement, parameters) This warning is due to the fact that the MySQL client library is attempting to interpret the binary string as a unicode object even if a datatype such as :class:`.LargeBinary` is in use. To resolve this, the SQL statement requires a binary "character set introducer" be present before any non-NULL value that renders like this:: INSERT INTO table (data) VALUES (_binary %s) These character set introducers are provided by the DBAPI driver, assuming the use of mysqlclient or PyMySQL (both of which are recommended). Add the query string parameter ``binary_prefix=true`` to the URL to repair this warning:: # mysqlclient engine = create_engine( "mysql+mysqldb://scott:tiger@localhost/test?charset=utf8mb4&binary_prefix=true") # PyMySQL engine = create_engine( "mysql+pymysql://scott:tiger@localhost/test?charset=utf8mb4&binary_prefix=true") The ``binary_prefix`` flag may or may not be supported by other MySQL drivers. SQLAlchemy itself cannot render this ``_binary`` prefix reliably, as it does not work with the NULL value, which is valid to be sent as a bound parameter. As the MySQL driver renders parameters directly into the SQL string, it's the most efficient place for this additional keyword to be passed. .. seealso:: `Character set introducers `_ - on the MySQL website ANSI Quoting Style ------------------ MySQL features two varieties of identifier "quoting style", one using backticks and the other using quotes, e.g. ```some_identifier``` vs. ``"some_identifier"``. All MySQL dialects detect which version is in use by checking the value of ``sql_mode`` when a connection is first established with a particular :class:`.Engine`. This quoting style comes into play when rendering table and column names as well as when reflecting existing database structures. The detection is entirely automatic and no special configuration is needed to use either quoting style. MySQL SQL Extensions -------------------- Many of the MySQL SQL extensions are handled through SQLAlchemy's generic function and operator support:: table.select(table.c.password==func.md5('plaintext')) table.select(table.c.username.op('regexp')('^[a-d]')) And of course any valid MySQL statement can be executed as a string as well. Some limited direct support for MySQL extensions to SQL is currently available. * INSERT..ON DUPLICATE KEY UPDATE: See :ref:`mysql_insert_on_duplicate_key_update` * SELECT pragma, use :meth:`.Select.prefix_with` and :meth:`.Query.prefix_with`:: select(...).prefix_with(['HIGH_PRIORITY', 'SQL_SMALL_RESULT']) * UPDATE with LIMIT:: update(..., mysql_limit=10) * optimizer hints, use :meth:`.Select.prefix_with` and :meth:`.Query.prefix_with`:: select(...).prefix_with("/*+ NO_RANGE_OPTIMIZATION(t4 PRIMARY) */") * index hints, use :meth:`.Select.with_hint` and :meth:`.Query.with_hint`:: select(...).with_hint(some_table, "USE INDEX xyz") .. _mysql_insert_on_duplicate_key_update: INSERT...ON DUPLICATE KEY UPDATE (Upsert) ------------------------------------------ MySQL allows "upserts" (update or insert) of rows into a table via the ``ON DUPLICATE KEY UPDATE`` clause of the ``INSERT`` statement. A candidate row will only be inserted if that row does not match an existing primary or unique key in the table; otherwise, an UPDATE will be performed. The statement allows for separate specification of the values to INSERT versus the values for UPDATE. SQLAlchemy provides ``ON DUPLICATE KEY UPDATE`` support via the MySQL-specific :func:`.mysql.dml.insert()` function, which provides the generative method :meth:`~.mysql.dml.Insert.on_duplicate_key_update`:: from sqlalchemy.dialects.mysql import insert insert_stmt = insert(my_table).values( id='some_existing_id', data='inserted value') on_duplicate_key_stmt = insert_stmt.on_duplicate_key_update( data=insert_stmt.inserted.data, status='U' ) conn.execute(on_duplicate_key_stmt) Unlike PostgreSQL's "ON CONFLICT" phrase, the "ON DUPLICATE KEY UPDATE" phrase will always match on any primary key or unique key, and will always perform an UPDATE if there's a match; there are no options for it to raise an error or to skip performing an UPDATE. ``ON DUPLICATE KEY 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 normally specified using keyword arguments passed to the :meth:`~.mysql.dml.Insert.on_duplicate_key_update` given column key values (usually the name of the column, unless it specifies :paramref:`.Column.key`) as keys and literal or SQL expressions as values:: on_duplicate_key_stmt = insert_stmt.on_duplicate_key_update( data="some data", updated_at=func.current_timestamp(), ) In a manner similar to that of :meth:`.UpdateBase.values`, other parameter forms are accepted, including a single dictionary:: on_duplicate_key_stmt = insert_stmt.on_duplicate_key_update( {"data": "some data", "updated_at": func.current_timestamp()}, ) as well as a list of 2-tuples, which will automatically provide a parameter-ordered UPDATE statement in a manner similar to that described at :ref:`updates_order_parameters`. Unlike the :class:`.Update` object, no special flag is needed to specify the intent since the argument form is this context is unambiguous:: on_duplicate_key_stmt = insert_stmt.on_duplicate_key_update( [ ("data", "some data"), ("updated_at", func.current_timestamp()), ], ) .. versionchanged:: 1.3 support for parameter-ordered UPDATE clause within MySQL ON DUPLICATE KEY UPDATE .. warning:: The :meth:`.Insert.on_duplicate_key_update` method does **not** take into account Python-side default UPDATE values or generation functions, e.g. e.g. those specified using :paramref:`.Column.onupdate`. These values will not be exercised for an ON DUPLICATE KEY style of UPDATE, unless they are manually specified explicitly in the parameters. In order to refer to the proposed insertion row, the special alias :attr:`~.mysql.dml.Insert.inserted` is available as an attribute on the :class:`.mysql.dml.Insert` object; this object is a :class:`.ColumnCollection` which contains all columns of the target table:: from sqlalchemy.dialects.mysql import insert stmt = insert(my_table).values( id='some_id', data='inserted value', author='jlh') do_update_stmt = stmt.on_duplicate_key_update( data="updated value", author=stmt.inserted.author ) conn.execute(do_update_stmt) When rendered, the "inserted" namespace will produce the expression ``VALUES()``. .. versionadded:: 1.2 Added support for MySQL ON DUPLICATE KEY UPDATE clause rowcount Support ---------------- SQLAlchemy standardizes the DBAPI ``cursor.rowcount`` attribute to be the usual definition of "number of rows matched by an UPDATE or DELETE" statement. This is in contradiction to the default setting on most MySQL DBAPI drivers, which is "number of rows actually modified/deleted". For this reason, the SQLAlchemy MySQL dialects always add the ``constants.CLIENT.FOUND_ROWS`` flag, or whatever is equivalent for the target dialect, upon connection. This setting is currently hardcoded. .. seealso:: :attr:`.ResultProxy.rowcount` CAST Support ------------ MySQL documents the CAST operator as available in version 4.0.2. When using the SQLAlchemy :func:`.cast` function, SQLAlchemy will not render the CAST token on MySQL before this version, based on server version detection, instead rendering the internal expression directly. CAST may still not be desirable on an early MySQL version post-4.0.2, as it didn't add all datatype support until 4.1.1. If your application falls into this narrow area, the behavior of CAST can be controlled using the :ref:`sqlalchemy.ext.compiler_toplevel` system, as per the recipe below:: from sqlalchemy.sql.expression import Cast from sqlalchemy.ext.compiler import compiles @compiles(Cast, 'mysql') def _check_mysql_version(element, compiler, **kw): if compiler.dialect.server_version_info < (4, 1, 0): return compiler.process(element.clause, **kw) else: return compiler.visit_cast(element, **kw) The above function, which only needs to be declared once within an application, overrides the compilation of the :func:`.cast` construct to check for version 4.1.0 before fully rendering CAST; else the internal element of the construct is rendered directly. .. _mysql_indexes: MySQL Specific Index Options ---------------------------- MySQL-specific extensions to the :class:`.Index` construct are available. Index Length ~~~~~~~~~~~~~ MySQL provides an option to create index entries with a certain length, where "length" refers to the number of characters or bytes in each value which will become part of the index. SQLAlchemy provides this feature via the ``mysql_length`` parameter:: Index('my_index', my_table.c.data, mysql_length=10) Index('a_b_idx', my_table.c.a, my_table.c.b, mysql_length={'a': 4, 'b': 9}) Prefix lengths are given in characters for nonbinary string types and in bytes for binary string types. The value passed to the keyword argument *must* be either an integer (and, thus, specify the same prefix length value for all columns of the index) or a dict in which keys are column names and values are prefix length values for corresponding columns. MySQL only allows a length for a column of an index if it is for a CHAR, VARCHAR, TEXT, BINARY, VARBINARY and BLOB. Index Prefixes ~~~~~~~~~~~~~~ MySQL storage engines permit you to specify an index prefix when creating an index. SQLAlchemy provides this feature via the ``mysql_prefix`` parameter on :class:`.Index`:: Index('my_index', my_table.c.data, mysql_prefix='FULLTEXT') The value passed to the keyword argument will be simply passed through to the underlying CREATE INDEX, so it *must* be a valid index prefix for your MySQL storage engine. .. versionadded:: 1.1.5 .. seealso:: `CREATE INDEX `_ - MySQL documentation Index Types ~~~~~~~~~~~~~ Some MySQL storage engines permit you to specify an index type when creating an index or primary key constraint. SQLAlchemy provides this feature via the ``mysql_using`` parameter on :class:`.Index`:: Index('my_index', my_table.c.data, mysql_using='hash') As well as the ``mysql_using`` parameter on :class:`.PrimaryKeyConstraint`:: PrimaryKeyConstraint("data", mysql_using='hash') The value passed to the keyword argument will be simply passed through to the underlying CREATE INDEX or PRIMARY KEY clause, so it *must* be a valid index type for your MySQL storage engine. More information can be found at: http://dev.mysql.com/doc/refman/5.0/en/create-index.html http://dev.mysql.com/doc/refman/5.0/en/create-table.html Index Parsers ~~~~~~~~~~~~~ CREATE FULLTEXT INDEX in MySQL also supports a "WITH PARSER" option. This is available using the keyword argument ``mysql_with_parser``:: Index( 'my_index', my_table.c.data, mysql_prefix='FULLTEXT', mysql_with_parser="ngram") .. versionadded:: 1.3 .. _mysql_foreign_keys: MySQL Foreign Keys ------------------ MySQL's behavior regarding foreign keys has some important caveats. Foreign Key Arguments to Avoid ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MySQL does not support the foreign key arguments "DEFERRABLE", "INITIALLY", or "MATCH". Using the ``deferrable`` or ``initially`` keyword argument with :class:`.ForeignKeyConstraint` or :class:`.ForeignKey` will have the effect of these keywords being rendered in a DDL expression, which will then raise an error on MySQL. In order to use these keywords on a foreign key while having them ignored on a MySQL backend, use a custom compile rule:: from sqlalchemy.ext.compiler import compiles from sqlalchemy.schema import ForeignKeyConstraint @compiles(ForeignKeyConstraint, "mysql") def process(element, compiler, **kw): element.deferrable = element.initially = None return compiler.visit_foreign_key_constraint(element, **kw) .. versionchanged:: 0.9.0 - the MySQL backend no longer silently ignores the ``deferrable`` or ``initially`` keyword arguments of :class:`.ForeignKeyConstraint` and :class:`.ForeignKey`. The "MATCH" keyword is in fact more insidious, and is explicitly disallowed by SQLAlchemy in conjunction with the MySQL backend. This argument is silently ignored by MySQL, but in addition has the effect of ON UPDATE and ON DELETE options also being ignored by the backend. Therefore MATCH should never be used with the MySQL backend; as is the case with DEFERRABLE and INITIALLY, custom compilation rules can be used to correct a MySQL ForeignKeyConstraint at DDL definition time. .. versionadded:: 0.9.0 - the MySQL backend will raise a :class:`.CompileError` when the ``match`` keyword is used with :class:`.ForeignKeyConstraint` or :class:`.ForeignKey`. Reflection of Foreign Key Constraints ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Not all MySQL storage engines support foreign keys. When using the very common ``MyISAM`` MySQL storage engine, the information loaded by table reflection will not include foreign keys. For these tables, you may supply a :class:`~sqlalchemy.ForeignKeyConstraint` at reflection time:: Table('mytable', metadata, ForeignKeyConstraint(['other_id'], ['othertable.other_id']), autoload=True ) .. seealso:: :ref:`mysql_storage_engines` .. _mysql_unique_constraints: MySQL Unique Constraints and Reflection --------------------------------------- SQLAlchemy supports both the :class:`.Index` construct with the flag ``unique=True``, indicating a UNIQUE index, as well as the :class:`.UniqueConstraint` construct, representing a UNIQUE constraint. Both objects/syntaxes are supported by MySQL when emitting DDL to create these constraints. However, MySQL does not have a unique constraint construct that is separate from a unique index; that is, the "UNIQUE" constraint on MySQL is equivalent to creating a "UNIQUE INDEX". When reflecting these constructs, the :meth:`.Inspector.get_indexes` and the :meth:`.Inspector.get_unique_constraints` methods will **both** return an entry for a UNIQUE index in MySQL. However, when performing full table reflection using ``Table(..., autoload=True)``, the :class:`.UniqueConstraint` construct is **not** part of the fully reflected :class:`.Table` construct under any circumstances; this construct is always represented by a :class:`.Index` with the ``unique=True`` setting present in the :attr:`.Table.indexes` collection. .. _mysql_timestamp_null: TIMESTAMP Columns and NULL -------------------------- MySQL historically enforces that a column which specifies the TIMESTAMP datatype implicitly includes a default value of CURRENT_TIMESTAMP, even though this is not stated, and additionally sets the column as NOT NULL, the opposite behavior vs. that of all other datatypes:: mysql> CREATE TABLE ts_test ( -> a INTEGER, -> b INTEGER NOT NULL, -> c TIMESTAMP, -> d TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -> e TIMESTAMP NULL); Query OK, 0 rows affected (0.03 sec) mysql> SHOW CREATE TABLE ts_test; +---------+----------------------------------------------------- | Table | Create Table +---------+----------------------------------------------------- | ts_test | CREATE TABLE `ts_test` ( `a` int(11) DEFAULT NULL, `b` int(11) NOT NULL, `c` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `e` timestamp NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 Above, we see that an INTEGER column defaults to NULL, unless it is specified with NOT NULL. But when the column is of type TIMESTAMP, an implicit default of CURRENT_TIMESTAMP is generated which also coerces the column to be a NOT NULL, even though we did not specify it as such. This behavior of MySQL can be changed on the MySQL side using the `explicit_defaults_for_timestamp `_ configuration flag introduced in MySQL 5.6. With this server setting enabled, TIMESTAMP columns behave like any other datatype on the MySQL side with regards to defaults and nullability. However, to accommodate the vast majority of MySQL databases that do not specify this new flag, SQLAlchemy emits the "NULL" specifier explicitly with any TIMESTAMP column that does not specify ``nullable=False``. In order to accommodate newer databases that specify ``explicit_defaults_for_timestamp``, SQLAlchemy also emits NOT NULL for TIMESTAMP columns that do specify ``nullable=False``. The following example illustrates:: from sqlalchemy import MetaData, Integer, Table, Column, text from sqlalchemy.dialects.mysql import TIMESTAMP m = MetaData() t = Table('ts_test', m, Column('a', Integer), Column('b', Integer, nullable=False), Column('c', TIMESTAMP), Column('d', TIMESTAMP, nullable=False) ) from sqlalchemy import create_engine e = create_engine("mysql://scott:tiger@localhost/test", echo=True) m.create_all(e) output:: CREATE TABLE ts_test ( a INTEGER, b INTEGER NOT NULL, c TIMESTAMP NULL, d TIMESTAMP NOT NULL ) .. versionchanged:: 1.0.0 - SQLAlchemy now renders NULL or NOT NULL in all cases for TIMESTAMP columns, to accommodate ``explicit_defaults_for_timestamp``. Prior to this version, it will not render "NOT NULL" for a TIMESTAMP column that is ``nullable=False``. i(tarray(t defaultdictNi(t reflection(tENUM(tSET(tJSON(t JSONIndexType(t JSONPathType(t _FloatType(t _IntegerType(t _MatchType(t _NumericType(t _StringType(tBIGINT(tBIT(tCHAR(tDATETIME(tDECIMAL(tDOUBLE(tFLOAT(tINTEGER(tLONGBLOB(tLONGTEXT(t MEDIUMBLOB(t MEDIUMINT(t MEDIUMTEXT(tNCHAR(tNUMERIC(tNVARCHAR(tREAL(tSMALLINT(tTEXT(tTIME(t TIMESTAMP(tTINYBLOB(tTINYINT(tTINYTEXT(tVARCHAR(tYEARi(texc(tlog(tschema(tsql(ttypes(tutil(tdefault(tcompiler(telements(tBINARY(tBLOB(tBOOLEAN(tDATE(t VARBINARY(t topologicalt accessibletaddtalltaltertanalyzetandtastasct asensitivetbeforetbetweentbiginttbinarytblobtbothtbytcalltcascadetcasetchangetchart charactertchecktcollatetcolumnt conditiont constrainttcontinuetconverttcreatetcrosst current_datet current_timetcurrent_timestampt current_usertcursortdatabaset databasestday_hourtday_microsecondt day_minutet day_secondtdectdecimaltdeclareR-tdelayedtdeletetdesctdescribet deterministictdistinctt distinctrowtdivtdoubletdroptdualteachtelsetelseiftenclosedtescapedtexiststexittexplaintfalsetfetchtfloattfloat4tfloat8tfortforcetforeigntfromtfulltexttgranttgroupthavingt high_prioritythour_microsecondt hour_minutet hour_secondtiftignoretintindextinfiletinnertinoutt insensitivetinserttinttint1tint2tint3tint4tint8tintegertintervaltintotistiteratetjointkeytkeystkilltleadingtleavetlefttliketlimittlineartlinestloadt localtimetlocaltimestamptlocktlongtlongblobtlongtexttloopt low_prioritytmaster_ssl_verify_server_certtmatcht mediumblobt mediumintt mediumtextt middleinttminute_microsecondt minute_secondtmodtmodifiestnaturaltnottno_write_to_binlogtnulltnumerictontoptimizetoptiont optionallytortordertouttoutertoutfilet precisiontprimaryt proceduretpurgetrangetreadtreadst read_onlyt read_writetrealt referencestregexptreleasetrenametrepeattreplacetrequiretrestricttreturntrevoketrighttrlikeR)tschemastsecond_microsecondtselectt sensitivet separatortsettshowtsmallinttspatialtspecificR*t sqlexceptiontsqlstatet sqlwarningtsql_big_resulttsql_calc_found_rowstsql_small_resulttssltstartingt straight_jointtablet terminatedtthenttinyblobttinyintttinytextttottrailingttriggerttruetundotuniontuniquetunlocktunsignedtupdatetusagetusetusingtutc_datetutc_timet utc_timestamptvaluest varbinarytvarchart varcharactertvaryingtwhentwheretwhiletwithtwritetx509txort year_monthtzerofilltcolumnstfieldst privilegestsonamettablestgeneraltignore_server_idstmaster_heartbeat_periodtmaxvaluetresignaltsignaltslowtgettio_after_gtidstio_before_gtidst master_bindtone_shott partitiontsql_after_gtidstsql_before_gtidst generatedtoptimizer_costststoredtvirtualtadmint cume_disttemptytexceptt first_valuetgroupingtfunctiontgroupst json_tablet last_valuet nth_valuetntiletoftovert percent_ranktpersistt persist_onlytrankt recursivetroletrowtrowst row_numbertsystemtwindows@\s*(?:UPDATE|INSERT|CREATE|DELETE|DROP|ALTER|LOAD +DATA|REPLACE)s%\s*SET\s+(?:(?:GLOBAL|SESSION)\s+)?\wtbittbooleantdatetdatetimetenumtfixedtjsontnchartnvarcharttextttimet timestamptyeartMySQLExecutionContextcBseZdZdZRS(cCs tj|S(N(t AUTOCOMMIT_RER(tselft statement((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytshould_autocommit_textscCs/|jjr"|jj|jjStdS(N(tdialecttsupports_server_side_cursorst_dbapi_connectionRYt _sscursortNotImplementedError(RT((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytcreate_server_side_cursors (t__name__t __module__RVR\(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyRRs t MySQLCompilercBs eZeZejjjZejidd6dZ dZ dZ dZ dZ dZdZd Zdd Zd Zd Zd ZdZdZedZdZdZdZdZdZdZdZ dZ!RS(t millisecondt millisecondscKsd|j|S(Nsrand%s(tfunction_argspec(RTtfntkw((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_random_funcscKsdS(Ns SYSDATE()((RTRcRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_sysdate_funcscKs,d|j|j||j|j|fS(NsJSON_EXTRACT(%s, %s)(tprocessRR(RTRBtoperatorRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_json_getitem_op_binaryscKs,d|j|j||j|j|fS(NsJSON_EXTRACT(%s, %s)(RgRR(RTRBRhRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt!visit_json_path_getitem_op_binarysc sjrgjD]}tj|^q}t|}g|D].}||jjjkrA|jjj|^qAg|jjjD]}|j|kr|^q}n|jjj}g}xUfd|DD]=} j| j} tj | r1tj d| d| j } |j | jdt} nt| tj r| j jr| j} | j | _ |j | jdt} n_t| tjr| jjkrd|jj| jd} n|j | jdt} |jj| j} |jd| | fqWtjtd|D} | rstjd|jjjd jd | Dfnd d j|S( Nc3s'|]}|jjkr|VqdS(N(RR(t.0tcol(t on_duplicate(sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pys sttype_t use_schemasVALUES(t)s%s = %scss|]}|jVqdS(N(R(Rktc((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pys ssFAdditional column names not matching any column keys in table '%s': %ss, css|]}d|VqdS(s'%s'N((RkRq((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pys ssON DUPLICATE KEY UPDATE (t_parameter_orderingR/t_column_as_keyRRURRqRRt _is_literalt BindParametertNonettypeRgt self_grouptFalset isinstancet_isnullt_clonet ColumnClausetinserted_aliastpreparertquotetnametappendR,twarnR(RTRmRdRtparameter_orderingt ordered_keysRqtcolstclausesRNtvalt value_textt name_textt non_matching((RmsQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_on_duplicate_key_updates@ "  +5   # !cKs,d|j|j||j|j|fS(Nsconcat(%s, %s)(RgRR(RTRBRhRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_concat_op_binaryscKs,d|j|j||j|j|fS(Ns'MATCH (%s) AGAINST (%s IN BOOLEAN MODE)(RgRR(RTRBRhRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_match_op_binaryscCs|S(N((RTRRN((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytget_from_hint_textscKsz|dkr$|jj|j}nt|tjrL|j||j|St|tj r{t |dt rtdSdSnt|tj rdSt|tj tjtjtjfr|jjj|St|tjrt|ttf rtj|}|jjj|St|tjr+dSt|tjrAdSt|tjrr|jjj|jddSdSdS( NRsUNSIGNED INTEGERsSIGNED INTEGERRR0RRR(RvRwt dialect_implRWRztsqltypest TypeDecoratortvisit_typeclausetimpltIntegertgetattrRyR!RtDateTimetDatetTimet type_compilerRgtStringRRRt_adapt_string_for_castt_BinaryRRR(RTt typeclauseRnRdtadapted((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyRs:  cKs|jjs2tjd|j|jj|S|j|j}|dkrtjd|jj j|jj |j|jj|Sd|j|j||fS(NsFCurrent MySQL version does not support CAST; the CAST will be skipped.sEDatatype %s does not support CAST on MySQL; the CAST will be skipped.sCAST(%s AS %s)( RWt_supports_castR,RRgtclauseRxRRvRRw(RTtcastRdRn((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt visit_cast,s  cCs@tt|j||}|jjr<|jdd}n|S(Ns\s\\(tsuperR_trender_literal_valueRWt_backslash_escapesR(RTtvalueRn((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyR@s cKsdS(NR((RTtelementRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt visit_trueHscKsdS(NRv((RTRRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt visit_falseKscKs;t|jtjr&|jjdS|jr3dSdSdS(sAdd special MySQL keywords in place of DISTINCT. .. note:: this usage is deprecated. :meth:`.Select.prefix_with` should be used for special keywords at the start of a SELECT. t s DISTINCT tN(Rzt _distinctR,t string_typestupper(RTRRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytget_select_precolumnsNs  cKs|jrd}n|jr$d}nd}dj|j|jdt|||j|jdt|d|j|j|fS(Ns FULL OUTER JOIN s LEFT OUTER JOIN s INNER JOIN Rtasfroms ON (tfulltisouterRRgRtTrueRtonclause(RTRRtkwargst join_type((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt visit_join_s    cKs|jjrdSdSdS(Ns LOCK IN SHARE MODEs FOR UPDATE(t_for_update_argR(RTRRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytfor_update_clauseqs cKs|j|j}}|dkr/|dkr/dS|dk r|dkrad|j||dfSd|j|||j||fSnd|j||fSdS(NRs LIMIT %s, %st18446744073709551615s LIMIT %s(t _limit_clauset_offset_clauseRvRg(RTRRdt limit_clauset offset_clause((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyRws    cCs5|jjd|jjd}|r-d|SdSdS(Ns%s_limitsLIMIT %s(RR RWRRv(RTt update_stmtR((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytupdate_limit_clausesc s-djfd|gt|DS(Ns, c3s'|]}|jdtVqdS(RN(t_compiler_dispatchR(Rktt(RdRT(sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pys s(Rtlist(RTRt from_tablet extra_fromsRd((RdRTsQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytupdate_tables_clausescKsdS(N(Rv(RTRRRt from_hintsRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytupdate_from_clausescCs4t}|rt}n|j|dtdtd|S(s=If we have extra froms make sure we render any alias as hint.Rtiscrudtashint(RyRR(RTt delete_stmtRRR((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytdelete_table_clauses  c s.ddjfd|g|DS(s4Render the DELETE .. USING clause specific to MySQL.sUSING s, c3s-|]#}|jdtdVqdS(Rt fromhintsN(RR(RkR(RRdRT(sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pys s(R(RTRRRRRd((RRdRTsQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytdelete_extra_from_clauses cCsHdidjdt|Dd6djdt|Dd6S(NsASELECT %(outer)s FROM (SELECT %(inner)s) as _empty_set WHERE 1!=1s, css|]\}}d|VqdS(s 1 AS _in_%sN((RktidxRn((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pys sRcss|]\}}d|VqdS(s_in_%sN((RkRRn((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pys sR(Rt enumerate(RTt element_types((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_empty_set_exprsN("R]R^Rt'render_table_with_column_in_update_fromR.t SQLCompilert extract_maptcopyRReRfRiRjRRRRRvRRRRRRRyRRRRRRRRR(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyR_s4     5    &        (    tMySQLDDLCompilercBsbeZdZdZdZdZdZdZdZdZ dZ d Z RS( cKsI|jj||jjj|jd|g}t|jj|jtj }|j sj|j dn|j r|r|j dn|j |}|dk r|j d|n|j}|dk r|jj|tj}|j d|n|jdk r<||jjkr<|jdkr<|j dndj|S( sBuilds column DDL.ttype_expressionsNOT NULLtNULLsDEFAULT sCOMMENT tAUTO_INCREMENTRN(Rt format_columnRWRRgRwRzt_unwrapped_dialect_implRR!tnullableRtget_column_default_stringRvtcommentt sql_compilerRRRt_autoincrement_columntserver_defaultR(RTRNRdtcolspect is_timestampR-Rtliteral((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytget_column_specifications.       c sg}tfd|jjD}|jdk rJ|j|ds tCOMMENTt PARTITION_BYt PARTITIONSt SUBPARTITIONStSUBPARTITION_BYtDEFAULT_CHARSETtCOLLATEtDEFAULT_CHARACTER_SETtDATA_DIRECTORYtINDEX_DIRECTORYt CHARACTER_SETtDEFAULT_COLLATEt_Rt=t TABLESPACEsDEFAULT CHARACTER SETs CHARACTER SETN(RR(RR(RRRRRR(RsDEFAULT CHARACTER SETs CHARACTER SETR(RR(RR(RR(RR(RR(RR(tdictRtitemsRRvRt differencet intersectionR5tsortt _reflectiont_options_of_type_stringRRRRRRR( RTRt table_optstoptstpartition_optionstnonpart_optionst part_optionstopttargtjoiner((RTsQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytpost_create_tablesh               c  s|j}|j||j}|j|j}g|jD]$}|jj|dtdt ^q;}|j |}d} |j r| d7} n|j j dd} | r| | d7} n| d||f7} |jdd dk rLttr*d jfd t|j|D}q[d jfd |D}nd j|}| d |7} |jdd} | dk r| d| f7} n|jdd} | dk r| d|j| 7} n| S(Nt include_tablet literal_bindssCREATE sUNIQUE t mysql_prefixRsINDEX %s ON %s tmysqltlengths, c3se|][\}}|jkr5d||jfn'|krUd||fnd|VqdS(s%s(%d)s%sN(R(RkRltexpr(R(sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pys rsc3s|]}d|fVqdS(s%s(%d)N((RkRl(R(sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pys ss(%s)t with_parsers WITH PARSER %sRs USING %s(Rt_verify_index_tableRt format_tableRt expressionsRRgRyRt_prepared_index_nameRRR Rvtdialect_optionsRzRRtzipR( RTRSRdRRRRRRRNt index_prefixtparserR((RsQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_create_indexRs>   1      cCsPtt|j|}|jdd}|rL|d|jj|7}n|S(NRRs USING %s(RRtvisit_primary_key_constraintRRR(RTRPRNR((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyRs  cCs5|j}d|j|dt|jj|jfS(Ns DROP INDEX %s ON %stinclude_schema(RRRyRRR(RTRlR((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_drop_indexs cCs|j}t|tjr6d}|jj|}nt|tjrWd}d}nt|tjrd}|jj|}nZt|tjr|j j rd}nd}|jj|}nd}|jj|}d|jj |j ||fS(Ns FOREIGN KEY s PRIMARY KEY RsINDEX s CONSTRAINT sCHECK sALTER TABLE %s DROP %s%s( RRzt sa_schematForeignKeyConstraintRtformat_constrainttPrimaryKeyConstrainttUniqueConstrainttCheckConstraintRWt _is_mariadbRR(RTRlRPtqualtconst((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_drop_constraints*    cCs%|jdk r!tjdndS(NsjMySQL ignores the 'MATCH' keyword while at the same time causes ON UPDATE/ON DELETE clauses to be ignored.R(RRvR't CompileError(RTRP((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytdefine_constraint_matchs cCs8d|jj|j|jj|jjtjfS(NsALTER TABLE %s COMMENT %s(RRRRRRRR(RTRS((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_set_table_comments cCsd|jj|jS(NsALTER TABLE %s COMMENT ''(RRR(RTRS((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_drop_table_commentscCs>d|jj|jj|jj|j|j|jfS(NsALTER TABLE %s CHANGE %s %s(RRRRRR(RTRS((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_set_column_comments( R]R^RR RRRR'R)R*R+R,(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyRs + S =     tMySQLTypeCompilercBsgeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%d$Z&d%Z'd&Z(RS('cCsC|j|s|S|jr)|d7}n|jr?|d7}n|S(sAExtend a numeric-type declaration with MySQL specific extensions.s UNSIGNEDs ZEROFILL(t _mysql_typeRR(RTRntspec((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt_extend_numerics    csfd}|dr1d|d}n0|drFd}n|dr[d}nd}|dr}d j}n|d rd }nd}|d rd jgd||fD]}|dk r|^qSd jg|||fD]}|dk r|^qS(sExtend a string-type declaration with standard SQL CHARACTER SET / COLLATE annotations and MySQL specific extensions. cst|j|S(N(RR (R(tdefaultsRn(sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytattrstcharsetsCHARACTER SET %stasciitASCIItunicodetUNICODEt collations COLLATE %sRBR0tnationalRtNATIONALN(RvR8R(RTRnR1R/R2R3R8Rq((R1RnsQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt_extend_strings$         /cCst|ttfS(N(RzR R (RTRn((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyR.scKsx|jdkr|j|dS|jdkrL|j|di|jd6S|j|di|jd6|jd6SdS(NRsNUMERIC(%(precision)s)Rs!NUMERIC(%(precision)s, %(scale)s)tscale(RRvR0R<(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt visit_NUMERIC scKsx|jdkr|j|dS|jdkrL|j|di|jd6S|j|di|jd6|jd6SdS(NRsDECIMAL(%(precision)s)Rs!DECIMAL(%(precision)s, %(scale)s)R<(RRvR0R<(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt visit_DECIMALscKsZ|jdk rF|jdk rF|j|di|jd6|jd6S|j|dSdS(Ns DOUBLE(%(precision)s, %(scale)s)RR<R(RRvR<R0(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt visit_DOUBLE's cKsZ|jdk rF|jdk rF|j|di|jd6|jd6S|j|dSdS(NsREAL(%(precision)s, %(scale)s)RR<R(RRvR<R0(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt visit_REAL1s cKs|j|rM|jdk rM|jdk rM|j|d|j|jfS|jdk rv|j|d|jfS|j|dSdS(Ns FLOAT(%s, %s)s FLOAT(%s)R(R.R<RvRR0(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt visit_FLOAT;scKsP|j|r<|jdk r<|j|di|jd6S|j|dSdS(NsINTEGER(%(display_width)s)t display_widthR(R.RBRvR0(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt visit_INTEGERKs cKsP|j|r<|jdk r<|j|di|jd6S|j|dSdS(NsBIGINT(%(display_width)s)RBR (R.RBRvR0(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt visit_BIGINTUs cKsP|j|r<|jdk r<|j|di|jd6S|j|dSdS(NsMEDIUMINT(%(display_width)s)RBR(R.RBRvR0(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_MEDIUMINT_s cKsI|j|r5|jdk r5|j|d|jS|j|dSdS(Ns TINYINT(%s)R#(R.RBRvR0(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt visit_TINYINTiscKsP|j|r<|jdk r<|j|di|jd6S|j|dSdS(NsSMALLINT(%(display_width)s)RBR(R.RBRvR0(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_SMALLINTqs cKs"|jdk rd|jSdSdS(NsBIT(%s)R(RRv(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt visit_BIT{s cKs%t|ddrd|jSdSdS(Ntfsps DATETIME(%d)R(RRvRI(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_DATETIMEs cKsdS(NR3((RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt visit_DATEscKs%t|ddrd|jSdSdS(NRIsTIME(%d)R (RRvRI(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt visit_TIMEs cKs%t|ddrd|jSdSdS(NRIs TIMESTAMP(%d)R!(RRvRI(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_TIMESTAMPs cKs"|jdkrdSd|jSdS(NR&sYEAR(%s)(RBRv(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt visit_YEARscKs:|jr#|j|id|jS|j|idSdS(NsTEXT(%d)R(RR;(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt visit_TEXTs cKs|j|idS(NR$(R;(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_TINYTEXTscKs|j|idS(NR(R;(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_MEDIUMTEXTscKs|j|idS(NR(R;(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_LONGTEXTscKs@|jr#|j|id|jStjd|jjdS(Ns VARCHAR(%d)s'VARCHAR requires a length on dialect %s(RR;R'R(RWR(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt visit_VARCHARs cKsA|jr*|j|idi|jd6S|j|idSdS(NsCHAR(%(length)s)RR(RR;(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt visit_CHARs cKsN|jr1|j|itd6di|jd6Stjd|jjdS(NR9sVARCHAR(%(length)s)Rs(NVARCHAR requires a length on dialect %s(RR;RR'R(RWR(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_NVARCHARs  cKsO|jr1|j|itd6di|jd6S|j|itd6dSdS(NR9sCHAR(%(length)s)RR(RR;R(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt visit_NCHARs   cKs d|jS(Ns VARBINARY(%d)(R(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_VARBINARYscKsdS(NR((RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt visit_JSONscKs |j|S(N(t visit_BLOB(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_large_binaryscKs9|jstt|j|S|jd||jSdS(NR(t native_enumRR-t visit_enumt_visit_enumerated_valuestenums(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyR\s cKs|jrd|jSdSdS(NsBLOB(%d)R1(R(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyRYs  cKsdS(NR"((RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_TINYBLOBscKsdS(NR((RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_MEDIUMBLOBscKsdS(NR((RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytvisit_LONGBLOBscCsZg}x+|D]#}|jd|jddq W|j|id|dj|fS(Ns'%s't's''s%s(%s)t,(RRR;R(RTRRntenumerated_valuest quoted_enumste((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyR]s  !cKs|jd||jS(NR(R]t_enumerated_values(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt visit_ENUMscKs|jd||jS(NR(R]Rg(RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt visit_SETscKsdS(NtBOOL((RTRnRd((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt visit_BOOLEANs()R]R^R0R;R.R=R>R?R@RARCRDRERFRGRHRJRKRLRMRNRORPRQRRRSRTRURVRWRXRZR\RYR_R`RaR]RhRiRk(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyR-sN "                             tMySQLIdentifierPreparercBs#eZeZedZdZRS(cKs;|sd}nd}tt|j|d|d|dS(Nt`t"t initial_quotet escape_quote(RRlt__init__(RTRWtserver_ansiquotesRdR((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyRq s  cGs2tg|D]!}|dk r |j|^q S(s4Unilaterally identifier-quote any number of strings.N(ttupleRvtquote_identifier(RTtidsti((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt_quote_free_identifierss(R]R^tRESERVED_WORDStreserved_wordsRyRqRw(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyRl s t MySQLDialectcBseZdZdZeZeZdZdZ eZ eZ eZ eZ eZeZdZeZeZeZeZeZeZeZeZeZejidBd6fe!j"idBd6fej#idBd6fej$idBd6dBd6dBd 6dBd 6fgZ%dBdBdBd Z&d Z'e(d dddgZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2eedZ3eedZ4dZ5dZ6dBdZ7dBdZ8dBd Z9d!Z:d"Z;dBd#Z<d$Z=d%Z>e?d&Z@e?d'ZAe?d(ZBe?d)ZCe?d*ZDeEjFd+ZGeEjFdBd,ZHeEjFdBd-ZIeEjFdBd.ZJeEjFdBd/ZKeEjFdBd0ZLeEjFdBd1ZMd2ZNeEjFdBd3ZOeEjFdBd4ZPeEjFdBd5ZQeEjFdBd6ZReEjFdBd7ZSdBd8ZTeUjVd9ZWeEjFdBd:ZXd;ZYd<ZZd=Z[d>Z\d?Z]dBdBd@Z^dBdBdAZ_RS(CsMDetails of the MySQL dialect. Not used directly in application code. Rii@tformatt*RRRtprefixRcKsB|jddtjj||||_||_||_dS(Ntuse_ansiquotes(tpopRvR-tDefaultDialectRqtisolation_levelt_json_serializert_json_deserializer(RTRtjson_serializertjson_deserializerR((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyRqVs   cs*jdk r"fd}|SdSdS(Ncsj|jdS(N(tset_isolation_levelR(tconn(RT(sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytconnectfs(RRv(RTR((RTsQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt on_connectcst SERIALIZABLEsREAD UNCOMMITTEDsREAD COMMITTEDsREPEATABLE READcCsA|jdd}t|dr-|j}n|j||dS(NRRt connection(RthasattrRt_set_isolation_level(RTRtlevel((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyRvs cCsu||jkr=tjd||jdj|jfn|j}|jd||jd|jdS(NsLInvalid value '%s' for isolation_level. Valid isolation levels for %s are %ss, s*SET SESSION TRANSACTION ISOLATION LEVEL %stCOMMIT(t_isolation_lookupR't ArgumentErrorRRRYtexecutetclose(RTRRRY((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyRs%  cCs|j}|jr4|jd kr4|jdn |jd|jd}|jtjrt|t r|j }n|j j ddS( NiiisSELECT @@transaction_isolationsSELECT @@tx_isolationit-R(iii( RYt _is_mysqltserver_version_infoRtfetchoneRR,tpy3kRztbytestdecodeRR(RTRRYR((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytget_isolation_levels   cCsp|j}|j}|jd|jd}|jtjrct|trc|j }n|j |S(NsSELECT VERSION()i( RRYRRRR,RRzRRt_parse_server_version(RTRt dbapi_conRYR((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt_get_server_version_infos    cCsg}tjd}x|j|D]v}y|jt|Wq%tk rtjd|}|r|jd|jDq|j|q%Xq%Wt |S(Ns[.\-]s(.*)(MariaDB)(.*)css|]}|r|VqdS(N((Rktg((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pys s( tretcompiletsplitRRt ValueErrorRtextendR3Rs(RTRtversiontrtntmariadb((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyRs  cCshy|jWnStk rc|jdkr]tjdj}|r]|ddkr]dSnnXdS( sExecute a COMMIT.iiiiii(N(iii(tcommitt ExceptionRtsystexc_infotargs(RTtdbapi_connectionR((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt do_commits  cCshy|jWnStk rc|jdkr]tjdj}|r]|ddkr]dSnnXdS( sExecute a ROLLBACK.iiiiii(N(iii(trollbackRRRRR(RTRR((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt do_rollbacks cCs |jtjdd|dS(Ns XA BEGIN :xidtxid(RR*RN(RTRR((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytdo_begin_twophasescCs<|jtjdd||jtjdd|dS(Ns XA END :xidRsXA PREPARE :xid(RR*RN(RTRR((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytdo_prepare_twophasescCsE|s%|jtjdd|n|jtjdd|dS(Ns XA END :xidRsXA ROLLBACK :xid(RR*RN(RTRRt is_preparedtrecover((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytdo_rollback_twophasescCs9|s|j||n|jtjdd|dS(NsXA COMMIT :xidR(RRR*RN(RTRRRR((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytdo_commit_twophasescCs5|jd}g|D]}|dd|d!^qS(Ns XA RECOVERtdatait gtrid_length(R(RTRt resultsetR@((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytdo_recover_twophasescCsmt||jj|jjfr4|j|dkSt||jj|jjfredt|kStSdS(Niiiiis(0, '')(iiiii( RztdbapitOperationalErrortProgrammingErrort_extract_error_codetInterfaceErrort InternalErrortstrRy(RTRfRRY((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt is_disconnects cCs&g|jD]}t||^q S(sMProxy result rows to smooth over MySQL-Python driver inconsistencies.(tfetchallt_DecodingRowProxy(RTtrpR3R@((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt_compat_fetchall scCs'|j}|rt||SdSdS(sNProxy a result row to smooth over MySQL-Python driver inconsistencies.N(RRRv(RTRR3R@((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt_compat_fetchone s  cCs'|j}|rt||SdSdS(sNProxy a result row to smooth over MySQL-Python driver inconsistencies.N(tfirstRRv(RTRR3R@((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt _compat_first s  cCs tdS(N(R[(RTt exception((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyR scCs|jdjS(NsSELECT DATABASE()(Rtscalar(RTR((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt_get_default_schema_name sc Csdj|jj||}d|}d}z{y?|jdtj|}|jdk }|j|SWn5t j k r}|j |j dkrt SnXWd|r|jnXdS(Nt.s DESCRIBE %stskip_user_error_eventsiz(Rtidentifier_preparerRwRvtexecution_optionsRRRRR't DBAPIErrorRtorigRy( RTRt table_nameR)t full_nametsttrsthaveRf((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt has_table s&        cCs|j||_|j||j||j||jr`|j|d|j|_ntj j |||j o|j dk|_ |jdS(NRri(i(t_detect_charsett_connection_charsett_detect_sql_modet_detect_ansiquotest_detect_casingt_server_ansiquotesRRR-Rt initializeR$Rt_needs_correct_for_88718t_warn_for_known_db_issues(RTR((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyRC s    cCsH|jrD|j}|dkrD|dkrDtjd|fqDndS(Ni ii s`MariaDB %r before 10.2.9 has known issues regarding CHECK constraints, which impact handling of NULL values with SQLAlchemy's boolean datatype (MDEV-13596). An additional issue prevents proper migrations of columns with CHECK constraints (MDEV-11114). Please upgrade to MariaDB 10.2.9 or greater, or use the MariaDB 10.1 series, to avoid these issues.(i i(i ii (R$t _mariadb_normalized_version_infoR,R(RTt mdb_version((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyRW s   cCs|jod|jkS(NtMariaDB(R(RT((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyR$e scCs|j S(N(R$(RT((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyRk scCs|jo|jdkS(Ni i(i i(R$R(RT((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt_is_mariadb_102o scCs8|jr-|jjd}|j|d|!S|jSdS(NRi(R$RR(RTR((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyRv s cCs|jdkp|jdkS(Niii(iii(RRv(RT((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyR scKs*|jd}g|D]}|d^qS(Ns SHOW schemasi(R(RTRRdRR((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytget_schema_names scKs|d k r|}n |j}|j}|jd kr|jd|jj|}g|j|d|D]}|d^qkS|jd|jj|}g|j|d|D] }|ddkr|d^qSd S( s1Return a Unicode SHOW TABLES from a given schema.iiisSHOW TABLES FROM %sR3sSHOW FULL TABLES FROM %sis BASE TABLEN(iii(Rvtdefault_schema_nameRRRRRtR(RTRR)Rdtcurrent_schemaR3RR@((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytget_table_names s    *cKs|jd krtn|dkr0|j}n|jd krO|j||S|j}|jd|jj|}g|j |d|D] }|dd kr|d^qS( NiiisSHOW FULL TABLES FROM %sR3itVIEWs SYSTEM VIEW(iii(iii(Rs SYSTEM VIEW( RR[RvRRRRRRtR(RTRR)RdR3RR@((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytget_view_names s    cKs|j||||}|jS(N(t_parsed_state_or_createt table_options(RTRRR)Rdt parsed_state((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytget_table_options scKs|j||||}|jS(N(RR(RTRRR)RdR((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt get_columns sc Ks|j||||}xT|jD]I}|ddkr"g|dD]}|d^qC}i|d6dd6Sq"Wigd6dd6S(NRwtPRIMARYRitconstrained_columnsR(RRRv( RTRRR)RdRRtsR((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytget_pk_constraint s!cKsX|j||||}d}g}x|jD]}|dd} t|ddkrf|ddpi|} | s|dkr|jj}n||kr|} qn|d} |d} i} x1dD])}|j|tr||| |tUnreflectableTableErrorRR( RTRRR3RRRRARftcode((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyR0; s,        N(`R]R^t__doc__RRtsupports_alterRytsupports_native_booleantmax_identifier_lengthtmax_index_name_lengthtsupports_native_enumtsupports_sane_rowcounttsupports_sane_multi_rowcounttsupports_multivalues_inserttsupports_commentstinline_commentstdefault_paramstyletcolspecstcte_follows_insertR_tstatement_compilerRt ddl_compilerR-Rt ischema_namesRlRRRRtTableRvR*tUpdateR!tIndextconstruct_argumentsRqRRRRRRRRRRRRRRRRRRRRRRRRtpropertyR$RRRRRtcacheRRRRRRRRRRR&R(R+RR,tmemoized_propertyR/R-RRR7RRR)R0(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyRzs             #    * J )      RcBsReZdZidd6dd6dd6dd6d d 6Zd Zd Zd ZRS(sReturn unicode-decoded values based on type inspection. Smooth over data type issues (esp. with alpha driver versions) and normalize strings as Unicode regardless of user-configured driver encoding settings. tkoi8_rtkoi8rtkoi8_utkoi8us utf-16-betutf16tutf8tutf8mb4tujisteucjpmscCs%||_|jj|||_dS(N(trowproxyt_encoding_compatR R3(RTRcR3((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyRqo s cCs^|j|}t|tr+|j}n|jrVt|tjrV|j|jS|SdS(N(RcRzt_arrayttostringR3R,t binary_typeR(RTRtitem((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt __getitem__s s  cCsct|j|}t|tr0|j}n|jr[t|tjr[|j|jS|SdS(N( RRcRzReRfR3R,RgR(RTR2Rh((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyt __getattr__} s (R]R^RBRdRqRiRj(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pyRZ s   (}RBRRet collectionsRRRRRRt enumeratedRRRKRRRR+RR R R R R RRRRRRRRRRRRRRRRRRR R!R"R#R$R%R&R'R(R)RR*RR,tengineR-R.R/R0R1R2R3R4R5RRxRtIR7RStSET_REtMSTimetMSSettMSEnumt MSLongBlobt MSMediumBlobt MSTinyBlobtMSBlobtMSBinaryt MSVarBinarytMSNChart MSNVarChartMSChartMSStringt MSLongTextt MSMediumTextt MSTinyTexttMSTexttMSYeart MSTimeStamptMSBittMSSmallIntegert MSTinyIntegertMSMediumIntegert MSBigIntegert MSNumerict MSDecimaltMSDoubletMSRealtMSFloatt MSIntegertNumerictFloatRtEnumt MatchTypeRNRRtDefaultExecutionContextRRRR_t DDLCompilerRtGenericTypeCompilerR-tIdentifierPreparerRlt class_loggerRRztobjectR(((sQ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/mysql/base.pytsf            ,3 ?