summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/mysql
Commit message (Collapse)AuthorAgeFilesLines
* Make a common approach for "emulated" typesMike Bayer2017-09-251-16/+15
| | | | | | | | | | | | | | Internal refinements to the :class:`.Enum`, :class:`.Interval`, and :class:`.Boolean` types, which now extend a common mixin :class:`.Emulated` that indicates a type that provides Python-side emulation of a DB native type, switching out to the DB native type when a supporting backend is in use. The Postgresql :class:`.INTERVAL` type when used directly will now include the correct type coercion rules for SQL expressions that also take effect for :class:`.sqltypes.Interval` (such as adding a date to an interval yields a datetime). Change-Id: Ifb9f9d7cbd9f5990dcb2abb583193e9e92b789ad Fixes: #4088
* Rename MySQL dml.insert().values to .insertedMike Bayer2017-09-082-18/+19
| | | | | | | | | | | Changed the name of the ``.values`` attribute of the new MySQL INSERT..ON DUPLICATE KEY UPDATE construct to ``.inserted``, as :class:`.Insert` already has a method called :meth:`.Insert.values`. The ``.inserted`` attribute ultimately renders the MySQL ``VALUES()`` function. Change-Id: I8da8e30a3077698385a4b77e2c2032e2d1ff10b2 Fixes: #4072
* Add InternalError for mysqlclient disconnectMike Bayer2017-09-011-1/+2
| | | | | | | | | | mysqlclient as of 1.3.11 changed the exception class for a particular disconnect situation from InterfaceError to InternalError; the disconnection detection logic now accommodates this. Change-Id: I294f90f794491fd363548719222d8e3008480615 Fixes: #4065
* Add SQL Server CI coverageMike Bayer2017-08-311-0/+7
| | | | Change-Id: Ida0d01ae9bcc0573b86e24fddea620a38c962822
* Apply percent sign escaping to literal binds, commentsMike Bayer2017-08-251-2/+5
| | | | | | | | | | | | | | Fixed bug in new percent-sign support (e.g. :ticket:`3740`) where a bound parameter rendered with literal_binds would fail to escape percent-signs for relevant dialects. In addition, ensured new table / column comment support feature also fully makes use of literal-rendered parameters so that this percent sign support takes place with table / column comment DDL as well, allowing percent sign support for the mysql / psycopg2 backends that require escaping of percent signs. Change-Id: Ia4136a300933e9bc6a01a7b9afd5c7b9a3fee4e3 Fixes: #4054 Fixes: #4052
* - fix typosMike Bayer2017-08-221-1/+1
| | | | Change-Id: Ibf8bc0e997ff989c7b0c16afad48a95414078052
* - modernize the mysql connection timeout docsMike Bayer2017-08-221-6/+13
| | | | | Change-Id: Icb0474509539c1eb7536544749f2a48b4972078a (cherry picked from commit 4ce46fb0a085c1cc739e21881cc25567e663f8dc)
* Implement MySQL's ON DUPLICATE KEY UPDATEMichael Doronin2017-07-033-0/+200
| | | | | | | | | | | Added support for MySQL's ON DUPLICATE KEY UPDATE MySQL-specific :class:`.mysql.dml.Insert` object. Pull request courtesy Michael Doronin. Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com> Resolves: #4009 Change-Id: Ic71424f3c88af6082b48a910a2efb7fbfc0a7eb4 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/365
* Handle SHOW VARIABLES returning no rowMike Bayer2017-06-161-11/+27
| | | | | | | | | | | MySQL 5.7 has introduced permission limiting for the "SHOW VARIABLES" command; the MySQL dialect will now handle when SHOW returns no row, in particular for the initial fetch of SQL_MODE, and will emit a warning that user permissions should be modified to allow the row to be present. Change-Id: I98e7a69230da397b17eae07b7e9d024fa7aeeb26 Fixes: #4007
* Allow metadata.reflect() to recover from unreflectable tablesMike Bayer2017-05-221-2/+7
| | | | | | | | | | | | | Added support for views that are unreflectable due to stale table definitions, when calling :meth:`.MetaData.reflect`; a warning is emitted for the table that cannot respond to ``DESCRIBE`` but the operation succeeds. The MySQL dialect now raises UnreflectableTableError which is in turn caught by MetaData.reflect(). Reflecting the view standalone raises this error directly. Change-Id: Id8005219d8e073c154cc84a873df911b4a6cf4d6 Fixes: #3871
* Break the lines to fit pdf and fix another broken syntaxLunarShaddow2017-05-081-6/+10
|
* remove ambiguous line breakers to help sphinx identify code blockLunarShaddow2017-05-051-5/+2
|
* Remove MySQL UTC_TIMESTAMP ruleMike Bayer2017-04-131-3/+0
| | | | | | | | | Removed an ancient and unnecessary intercept of the UTC_TIMESTAMP MySQL function, which was getting in the way of using it with a parameter. Change-Id: I6e6b52c051418bcb9d31987e78299310810cb78d Fixes: #3966
* Consider mysql partition options separately from other table optionsMike Bayer2017-04-061-5/+29
| | | | | | | | | Move down all the PARTITION, SUBPARTITION options into a separate segment so that they come out at the end of CREATE TABLE after the table options. Change-Id: Iaa1c823848c93680ca22d72bda1b7c49742b9060 Fixes: #3961
* Double percent signs based on paramstyle, not dialectMike Bayer2017-04-051-10/+2
| | | | | | | | | | | | This patch moves the "doubling" of percent signs into the base compiler and makes it completely a product of whether or not the paramstyle is format/pyformat or not. Without this paramstyle, percent signs are not doubled across text(), literal_column(), and column(). Change-Id: Ie2f278ab1dbb94b5078f85c0096d74dbfa049197 Fixes: #3740
* New features from python 2.7Катаев Денис2017-03-172-2/+2
| | | | | | | After bump minimum supported version to 2.7 (1da9d3752160430c91534a8868ceb8c5ad1451d4), we can use new syntax. Change-Id: Ib064c75a00562e641d132f9c57e5e69744200e05 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/347
* Implement comments for tables, columnsFrazer McLean2017-03-172-21/+58
| | | | | | | | | | | | | | Added support for SQL comments on :class:`.Table` and :class:`.Column` objects, via the new :paramref:`.Table.comment` and :paramref:`.Column.comment` arguments. The comments are included as part of DDL on table creation, either inline or via an appropriate ALTER statement, and are also reflected back within table reflection, as well as via the :class:`.Inspector`. Supported backends currently include MySQL, Postgresql, and Oracle. Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com> Fixes: #1546 Change-Id: Ib90683850805a2b4ee198e420dc294f32f15d35d
* Add new reserved words for MySQL 8.0 (beta).Hanno Schlichting2017-02-281-0/+3
| | | | | | | Based on https://dev.mysql.com/doc/refman/8.0/en/keywords.html#table-keywords-new-8.0 Change-Id: I128c93520e57331e0ec4d40b0c0e752bf9b982d9 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/346
* Merge "Parse (but don't record) COMMENT portion of MySQL table key"mike bayer2017-01-171-0/+1
|\
| * Parse (but don't record) COMMENT portion of MySQL table keyLele Long2017-01-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | The MySQL dialect now will not warn when a reflected column has a "COMMENT" keyword on it, but note however the comment is not yet reflected; this is on the roadmap for a future release. Pull request courtesy Lele Long. Fixes: #3867 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/324 Change-Id: I869e29aba6766d0eda1e59af09a3e8e3748a3942
* | Add support for prefixes on CREATE INDEX statements in MySQLJoseph Schorr2017-01-171-0/+25
|/ | | | | | | | | Added a new parameter ``mysql_prefix`` supported by the :class:`.Index` construct, allows specification of MySQL-specific prefixes such as "FULLTEXT". Pull request courtesy Joseph Schorr. Change-Id: I5a21fa466fdfd4d9e39e1fb4ecec1eab93b92c36 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/339
* Support python3.6Mike Bayer2017-01-135-5/+5
| | | | | | | | | | | Corrects some warnings and adds tox config. Adds DeprecationWarning to the error category. Large sweep for string literals w/ backslashes as this is common in docstrings Co-authored-by: Andrii Soldatenko Fixes: #3886 Change-Id: Ia7c838dfbbe70b262622ed0803d581edc736e085 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/337
* update for 2017 copyrightMike Bayer2017-01-0414-14/+14
| | | | Change-Id: I4e8c2aa8fe817bb2af8707410fa0201f938781de
* Add support for server side cursors to mysqldb and pymysqlRoman Podoliaka2016-11-103-1/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows to skip buffering of the results on the client side, e.g. the following snippet: table = sa.Table( 'testtbl', sa.MetaData(), sa.Column('id', sa.Integer, primary_key=True), sa.Column('a', sa.Integer), sa.Column('b', sa.String(512)) ) table.create(eng, checkfirst=True) with eng.connect() as conn: result = conn.execute(table.select().limit(1)).fetchone() if result is None: for _ in range(1000): conn.execute( table.insert(), [{'a': random.randint(1, 100000), 'b': ''.join(random.choice(string.ascii_letters) for _ in range(100))} for _ in range(1000)] ) with eng.connect() as conn: for row in conn.execution_options(stream_results=True).execute(table.select()): pass now uses ~23 MB of memory instead of ~327 MB on CPython 3.5.2 and PyMySQL 0.7.9. psycopg2 implementation and execution options (stream_results, server_side_cursors) are reused. Change-Id: I4dc23ce3094f027bdff51b896b050361991c62e2
* Add check for blank string coming from MySQL's enumMike Bayer2016-10-281-0/+10
| | | | | | | | | | | | | MySQL's native ENUM type supports any non-valid value being sent, and in response will return a blank string. A hardcoded rule to check for "is returning the blank string" has been added to the MySQL implementation for ENUM so that this blank string is returned to the application rather than being rejected as a non-valid value. Note that if your MySQL enum is linking values to objects, you still get the blank string back. Change-Id: I61f85c20293a48b0c11a31f2a19f6756c206bd20 Fixes: #3841
* Support all MySQL/Connector int/bool argumentsMike Bayer2016-09-011-0/+14
| | | | | | | | | | | Added support for parsing MySQL/Connector boolean and integer arguments within the URL query string: connection_timeout, connect_timeout, pool_size, get_warnings, raise_on_warnings, raw, consume_results, ssl_verify_cert, force_ipv6, pool_reset_session, compress, allow_local_infile, use_pure. Change-Id: I2a1a17d13d47d56871bff32e94fdbed8bc003ad7 Fixes: #3787
* Build string/int processors for JSONIndexType, JSONPathTypeMike Bayer2016-08-042-17/+41
| | | | | | | | | | | | Fixed regression in JSON datatypes where the "literal processor" for a JSON index value, that needs to take effect for example within DDL, would not be invoked for the value. The native String and Integer datatypes are now called upon from within the JSONIndexType and JSONPathType. This is applied to the generic, Postgresql, and MySQL JSON types. Change-Id: Ifa5f2acfeee57a79d01d7fc85d265a37bd27c716 Fixes: #3765
* Propagate kwargs to all MySQL CAST pathsMike Bayer2016-08-041-4/+4
| | | | | Change-Id: I23a6abb26bbbe3d118887d043ce761fc4572d8d2 Fixes: #3766
* - MySQL's JSON shared implementation completely w/ sqltypes.JSON;Mike Bayer2016-07-241-36/+1
| | | | | | | | | | this must have been an oversight. Leave mysql.JSON in place still as we might need to add things to it. - CAST(json, String) still confusing MySQL drivers even mysqlclient. Since here we're checking for the raw form of the JSON and not a typical round trip, add a force for unicode Change-Id: I727f4526a01a0875037cf0dede45cd074da5205a
* Disable Enum string validation by defaultMike Bayer2016-06-201-1/+3
| | | | | | | | | | | | | | Rolled back the validation rules a bit in :class:`.Enum` to allow unknown string values to pass through, unless the flag ``validate_string=True`` is passed to the Enum; any other kind of object is still of course rejected. While the immediate use is to allow comparisons to enums with LIKE, the fact that this use exists indicates there may be more unknown-string-comparsion use cases than we expected, which hints that perhaps there are some unknown string-INSERT cases too. Change-Id: I7d1d79b374a7d47966d410998f77cd19294ab7b0 Fixes: #3725
* - Added support for rendering "FULL OUTER JOIN" to both Core and ORM.Mike Bayer2016-03-281-1/+8
| | | | Pull request courtesy Stefan Urbanek. fixes #1957
* - changelog and docs for #3332, fixes #3332Mike Bayer2016-03-151-7/+35
| | | | | | - make docs for isolation level more consistent between postgresql and mysql - move mysql autocommit tests
* Merge branch 'master' into pr157Mike Bayer2016-03-1514-1569/+1801
|\
| * - add changelog and migration notes for new Enum features,Mike Bayer2016-02-021-25/+17
| | | | | | | | | | | | | | | | | | | | | | | | fixes #3095, #3292 - reorganize enum constructor to again work with the MySQL ENUM type - add a new create_constraint flag to Enum to complement that of Boolean - reinstate the CHECK constraint tests for enum, these already fail /skip against the MySQL backend - simplify lookup rules in Enum, have them apply to all varieties of Enum equally
| * - happy new yearMike Bayer2016-01-2914-14/+14
| |
| * - Added :class:`.mysql.JSON` for MySQL 5.7. The JSON type providesMike Bayer2016-01-063-6/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | persistence of JSON values in MySQL as well as basic operator support of "getitem" and "getpath", making use of the ``JSON_EXTRACT`` function in order to refer to individual paths in a JSON structure. fixes #3547 - Added a new type to core :class:`.types.JSON`. This is the base of the PostgreSQL :class:`.postgresql.JSON` type as well as that of the new :class:`.mysql.JSON` type, so that a PG/MySQL-agnostic JSON column may be used. The type features basic index and path searching support. fixes #3619 - reorganization of migration docs etc. to try to refer both to the fixes to JSON that helps Postgresql while at the same time indicating these are new features of the new base JSON type. - a rework of the Array/Indexable system some more, moving things that are specific to Array out of Indexable. - new operators for JSON indexing added to core so that these can be compiled by the PG and MySQL dialects individually - rename sqltypes.Array to sqltypes.ARRAY - as there is no generic Array implementation, this is an uppercase type for now, consistent with the new sqltypes.JSON type that is also not a generic implementation. There may need to be some convention change to handle the case of datatypes that aren't generic, rely upon DB-native implementations, but aren't necessarily all named the same thing.
| * - break out mysql/base into modules as it's getting huge with more to comeMike Bayer2016-01-044-1488/+1534
| |
| * - An adjustment to the regular expression used to parse MySQL views,Mike Bayer2015-12-221-1/+1
| | | | | | | | | | | | | | such that we no longer assume the "ALGORITHM" keyword is present in the reflected view source, as some users have reported this not being present in some Amazon RDS environments. fixes #3613
| * Add new reserved words for MySQL 5.7.pr/222Hanno Schlichting2015-12-141-0/+2
| |
| * - Fixed bug in MySQL reflection where the "fractional sections portion"Mike Bayer2015-12-071-0/+5
| | | | | | | | | | | | | | | | of the :class:`.mysql.DATETIME`, :class:`.mysql.TIMESTAMP` and :class:`.mysql.TIME` types would be incorrectly placed into the ``timestamp`` attribute, which is unused by MySQL, instead of the ``fsp`` attribute. fixes #3602
| * - cross-linking for pool recycle featureMike Bayer2015-10-301-0/+5
| |
| * - The system by which a :class:`.Column` considers itself to be anMike Bayer2015-10-071-31/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "auto increment" column has been changed, such that autoincrement is no longer implicitly enabled for a :class:`.Table` that has a composite primary key. In order to accommodate being able to enable autoincrement for a composite PK member column while at the same time maintaining SQLAlchemy's long standing behavior of enabling implicit autoincrement for a single integer primary key, a third state has been added to the :paramref:`.Column.autoincrement` parameter ``"auto"``, which is now the default. fixes #3216 - The MySQL dialect no longer generates an extra "KEY" directive when generating CREATE TABLE DDL for a table using InnoDB with a composite primary key with AUTO_INCREMENT on a column that isn't the first column; to overcome InnoDB's limitation here, the PRIMARY KEY constraint is now generated with the AUTO_INCREMENT column placed first in the list of columns.
| * - as the Concatenable mixin was changed to support calling down toMike Bayer2015-08-181-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | "super" instead of hardcoding to "self.type" for the default return value, the base Comparator was returning other_comparator.type. It's not clear what the rationale for this was, though in theory the base Comparator should possibly even throw an exception if the two types aren't the same (or of the same affinity?) . - mysql.SET was broken on this because the bitwise version adds "0" to the value to force an integer within column_expression, we are doing type_coerces here now in any case so that there is no type ambiguity for this operation
| * - Fixed support for "literal_binds" mode when using limit/offsetMike Bayer2015-04-231-1/+1
| | | | | | | | | | | | with Firebird, so that the values are again rendered inline when this is selected. Related to :ticket:`3034`. fixes #3381
| * - Fixed unicode support for PyMySQL when using an "executemany"Mike Bayer2015-03-221-0/+5
| | | | | | | | | | | | | | | | | | operation with unicode parameters. SQLAlchemy now passes both the statement as well as the bound parameters as unicode objects, as PyMySQL generally uses string interpolation internally to produce the final statement, and in the case of executemany does the "encode" step only on the final statement. fixes #3337
| * - more updates to the unicode mess to frame this inMike Bayer2015-03-225-75/+63
| | | | | | | | as up-to-date recommendations as possible
| * some doc defensesMike Bayer2015-03-213-2/+10
| |
| * - Repaired the commit for issue #2771 which was inadvertently commentedMike Bayer2015-03-201-1/+1
| | | | | | | | | | | | out. - add __backend__ to the dialect suite so that it runs on CI. - will be 1.0.0b3
| * Merge branch 'mysqlclient' of https://bitbucket.org/methane/sqlalchemy into pr48Mike Bayer2015-03-201-0/+9
| |\ | | | | | | | | | | | | Conflicts: lib/sqlalchemy/dialects/mysql/mysqldb.py
| | * Add mention about mysqlclientINADA Naoki2015-03-141-2/+4
| | |