summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/mysql/base.py
Commit message (Collapse)AuthorAgeFilesLines
* Rename MySQL dml.insert().values to .insertedMike Bayer2017-09-081-7/+7
| | | | | | | | | | | 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-031-0/+119
| | | | | | | | | | | 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
* Implement comments for tables, columnsFrazer McLean2017-03-171-0/+31
| | | | | | | | | | | | | | 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
* 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-131-1/+1
| | | | | | | | | | | 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-041-1/+1
| | | | Change-Id: I4e8c2aa8fe817bb2af8707410fa0201f938781de
* Add support for server side cursors to mysqldb and pymysqlRoman Podoliaka2016-11-101-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Build string/int processors for JSONIndexType, JSONPathTypeMike Bayer2016-08-041-4/+4
| | | | | | | | | | | | 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
* - 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-151-1515/+147
|\
| * - happy new yearMike Bayer2016-01-291-1/+1
| |
| * - Added :class:`.mysql.JSON` for MySQL 5.7. The JSON type providesMike Bayer2016-01-061-3/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-041-1488/+12
| |
| * - 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
| * - more updates to the unicode mess to frame this inMike Bayer2015-03-221-15/+54
| | | | | | | | as up-to-date recommendations as possible
| * some doc defensesMike Bayer2015-03-211-2/+4
| |
| * - 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
| * - reorganize MySQL docs re: unicode, other cleanup and updatesMike Bayer2015-03-201-1/+44
| |
| * Merge branch 'support-emoji-on-mysql' of ↵Mike Bayer2015-03-201-1/+9
| |\ | | | | | | | | | https://bitbucket.org/graingert/sqlalchemy into pr49
| | * map MySQL encodings to python encodings fixes #2771Thomas Grainger2015-03-181-1/+9
| | |
| * | Merge remote-tracking branch 'origin/pr/158' into pr158Mike Bayer2015-03-201-1/+3
| |\ \ | | |/ | |/|
| | * fix Python 2-specific byte conversionpr/158David Marin2015-02-051-1/+3
| | |
| * | - The Postgresql :class:`.postgresql.ENUM` type will emit aMike Bayer2015-03-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DROP TYPE instruction when a plain ``table.drop()`` is called, assuming the object is not associated directly with a :class:`.MetaData` object. In order to accomodate the use case of an enumerated type shared between multiple tables, the type should be associated directly with the :class:`.MetaData` object; in this case the type will only be created at the metadata level, or if created directly. The rules for create/drop of Postgresql enumerated types have been highly reworked in general. fixes #3319
| * | - copyright 2015Mike Bayer2015-03-101-1/+1
| | |
* | | Add 'native' autocommit support for mysql driverspr/157Roman Podoliaka2015-02-241-0/+8
|/ / | | | | | | | | | | Sometimes it might be useful to have 'native' autocommit support provided by a DB API driver rather than rely on SQLAlchemy autocommit emulation.
* | - The MySQL dialect now supports CAST on types that are constructedMike Bayer2015-02-091-3/+6
| | | | | | | | as :class:`.TypeDecorator` objects.
* | - add a fix to MySQL re: #3074 tests, make sure we check table is presentMike Bayer2015-02-091-1/+2
| |
* | - A warning is emitted when :func:`.cast` is used with the MySQLMike Bayer2015-02-091-0/+7
|/ | | | | | | | | | | dialect on a type where MySQL does not support CAST; MySQL only supports CAST on a subset of datatypes. SQLAlchemy has for a long time just omitted the CAST for unsupported types in the case of MySQL. While we don't want to change this now, we emit a warning to show that it's taken place. A warning is also emitted when a CAST is used with an older MySQL version (< 4) that doesn't support CAST at all, it's skipped in this case as well. fixes #3237
* - The MySQL dialect now renders TIMESTAMP with NULL / NOT NULL inMike Bayer2015-02-051-48/+40
| | | | | | | | | all cases, so that MySQL 5.6.6 with the ``explicit_defaults_for_timestamp`` flag enabled will will allow TIMESTAMP to continue to work as expected when ``nullable=False``. Existing applications are unaffected as SQLAlchemy has always emitted NULL for a TIMESTAMP column that is ``nullable=True``. fixes #3155
* - Added new user-space accessors for viewing transaction isolationMike Bayer2015-01-201-1/+1
| | | | | | | | | levels; :meth:`.Connection.get_isolation_level`, :attr:`.Connection.default_isolation_level`. - enhance documentation inter-linkage between new accessors, existing isolation_level parameters, as well as in the dialect-level methods which should be fully covered by Engine/Connection level APIs now.