summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
Commit message (Collapse)AuthorAgeFilesLines
* Refactor for cx_Oracle version 6oracle_numericMike Bayer2017-09-1110-564/+423
| | | | | | | | | Drops support for cx_Oracle prior to version 5.x, reworks numeric and binary support. Fixes: #4064 Change-Id: Ib9ae9aba430c15cd2a6eeb4e5e3fd8e97b5fe480
* Don't use repr() for Column/ColumnClause in warningMike Bayer2017-09-101-2/+3
| | | | | | | | for #4073, use the string version of the column expression in the warning, otherwise the repr() is showing the hex id which causes unlimited warnings. Change-Id: I6869b685b237e7f02c7b5071701dd63a3577182a
* Warn instead of raise for unmapped column that matches on keyticket_4073Mike Bayer2017-09-102-7/+17
| | | | | | | | | | | | | | | Modified the change made to the ORM update/delete evaluator in :ticket:`3366` such that if an unmapped column expression is present in the update or delete, if the evaluator can match its name to the mapped columns of the target class, a warning is emitted, rather than raising UnevaluatableError. This is essentially the pre-1.2 behavior, and is to allow migration for applications that are currently relying upon this pattern. However, if the given attribute name cannot be matched to the columns of the mapper, the UnevaluatableError is still raised, which is what was fixed in :ticket:`3366`. Change-Id: I658ed0dbf485b7f8009774f9c12d9912447abd2a Fixes: #4073
* Merge "Remove LRU warnings"mike bayer2017-09-092-38/+3
|\
| * Remove LRU warningsMike Bayer2017-09-082-38/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removed the warnings that are emitted when the LRU caches employed by the mapper as well as loader srtategies reach their threshold; the purpose of this warning was at first a guard against excess cache keys being generated but became basically a check on the "creating many engines" antipattern. While this is still an antipattern, the presense of test suites which both create an engine per test as well as raise on all warnings will be an inconvenience; it should not be critical that such test suites change their architecture just for this warning (though engine-per-test suite is always better). Change-Id: I41ef8cd642d05a845f53119b196440f9d7879cd9 Fixes: #4071
* | 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
* - skip oracle tests until we can merge refactorMike Bayer2017-09-081-0/+18
| | | | Change-Id: Ie9bec6e8f51d52349dcbd8009981818e459e88b8
* Merge "Guard against KeyError in session.merge after check for identity"mike bayer2017-09-051-18/+24
|\
| * Guard against KeyError in session.merge after check for identityMike Bayer2017-09-041-18/+24
| | | | | | | | | | | | | | | | | | | | Fixed bug in :meth:`.Session.merge` following along similar lines as that of :ticket:`4030`, where an internal check for a target object in the identity map could lead to an error if it were to be garbage collected immediately before the merge routine actually retrieves the object. Change-Id: Ifecfb8b9d50c52d0ebd5a03e1bd69fe3abf1dc40 Fixes: #4069
* | Merge "Check for non-mapped property in synonym"mike bayer2017-09-051-1/+12
|\ \
| * | Check for non-mapped property in synonymMike Bayer2017-09-041-1/+12
| |/ | | | | | | | | | | | | | | | | | | An :class:`.InvalidRequestError` is raised when a :func:`.synonym` is used against an attribute that is not against a :class:`.MapperProperty`, such as an association proxy. Previously, a recursion overflow would occur trying to locate non-existent attributes. Change-Id: If2ce38c429a69951df4c94b71b74edbd59d775e3 Fixes: #4067
* | Merge "Ensure custom ops have consistent typing behavior, boolean support"mike bayer2017-09-044-12/+69
|\ \
| * | Ensure custom ops have consistent typing behavior, boolean supportMike Bayer2017-09-014-12/+69
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | Refined the behavior of :meth:`.Operators.op` such that in all cases, if the :paramref:`.Operators.op.is_comparison` flag is set to True, the return type of the resulting expression will be :class:`.Boolean`, and if the flag is False, the return type of the resulting expression will be the same type as that of the left-hand expression, which is the typical default behavior of other operators. Also added a new parameter :paramref:`.Operators.op.return_type` as well as a helper method :meth:`.Operators.bool_op`. Change-Id: Ifc8553cd4037d741b84b70a9702cbd530f1a9de0 Fixes: #4063
* | Always check that discarded state is the expected oneMike Bayer2017-09-041-11/+22
|/ | | | | | | | | | | | Fixed race condition in ORM identity map which would cause objects to be inappropriately removed during a load operation, causing duplicate object identities to occur, particularly under joined eager loading which involves deduplication of objects. The issue is specific to garbage collection of weak references and is observed only under the Pypy interpreter. Change-Id: I9f6ae3fe5b078f26146af82b15d16f3a549a9032 Fixes: #4068
* 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
* Consider merge key with (None, ) as non-persistentMike Bayer2017-08-311-5/+5
| | | | | | | | | | | | Fixed bug in :meth:`.Session.merge` where objects in a collection that had the primary key attribute set to ``None`` for a key that is typically autoincrementing would be considered to be a database-persisted key for part of the internal deduplication process, causing only one object to actually be inserted in the database. Change-Id: I0a6e00043be0b2979cda33740e1be3b430ecf8c7 Fixes: #4056 (cherry picked from commit 5243341ed886e10a0d3f7fef8ae3d071e0ffdcf0)
* Add SQL Server CI coverageMike Bayer2017-08-319-150/+195
| | | | Change-Id: Ida0d01ae9bcc0573b86e24fddea620a38c962822
* Additional fixes to sane rowcountMike Bayer2017-08-311-2/+12
| | | | | | | | Implement rowcount assertions and single row check for post_update as well as deletes. Change-Id: I4e5ba7e8747bf0e0b41f569089eb8cdbf064b7a9 Fixes: #4062
* Add new sane_rowcount_w_returning flagMike Bayer2017-08-314-9/+43
| | | | | | | | | | | | | | | | | Added a new class of "rowcount support" for dialects that is specific to when "RETURNING", which on SQL Server looks like "OUTPUT inserted", is in use, as the PyODBC backend isn't able to give us rowcount on an UPDATE or DELETE statement when OUTPUT is in effect. This primarily affects the ORM when a flush is updating a row that contains server-calcluated values, raising an error if the backend does not return the expected row count. PyODBC now states that it supports rowcount except if OUTPUT.inserted is present, which is taken into account by the ORM during a flush as to whether it will look for a rowcount. ORM tests are implicit in existing tests run against PyODBC Fixes: #4062 Change-Id: Iff17cbe4c7a5742971ed85a4d58660c18cc569c2
* Use text_type, not unicodeMike Bayer2017-08-311-1/+1
| | | | | | | Revise the fix from 03560c4b83308719067ec635662c35f9a437fb7f to use compat.text_type for py3k compatibility Change-Id: Ia6807bd4de3bba4b33b5327a1be7e728b45eb093
* Enable native boolean for SQL ServerMike Bayer2017-08-302-7/+7
| | | | | | | | | | | | | | | | SQL Server supports what SQLAlchemy calls "native boolean" with its BIT type, as this type only accepts 0 or 1 and the DBAPIs return its value as True/False. So the SQL Server dialects now enable "native boolean" support, in that a CHECK constraint is not generated for a :class:`.Boolean` datatype. The only difference vs. other native boolean is that there are no "true" / "false" constants so "1" and "0" are still rendered here. Tests are implicit in the existing suites. Change-Id: I75bbcd549884099fb1a177e68667bf880c40fa7c Fixes: #4061
* Merge "Join key_constraints on schema as well for SQL server get_fks"mike bayer2017-08-301-0/+1
|\
| * Join key_constraints on schema as well for SQL server get_fksMike Bayer2017-08-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Fixed bug where the SQL Server dialect could pull columns from multiple schemas when reflecting a self-referential foreign key constraint, if multiple schemas contained a constraint of the same name against a table of the same name. Tests are part of standard suite already (CI has been disabled) Change-Id: I04ff4a5dea9b82c8e517b3700a28fe994b5550f3 Fixes: #4060
* | Merge "Ignore SQL Server "heap" indexes"mike bayer2017-08-301-1/+1
|\ \
| * | Ignore SQL Server "heap" indexesMike Bayer2017-08-301-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | Added a rule to SQL Server index reflection to ignore the so-called "heap" index that is implicitly present on a table that does not specify a clustered index. Tests are part of standard suite already (CI has been disabled) Change-Id: I593b95551c40ee5d95d54203611112cbff10856f Fixes: #4059
* | Add preparer to pymssql that disables percent doublingMike Bayer2017-08-301-1/+12
|/ | | | | | | | | | | | | Fixed the pymssql dialect so that percent signs in SQL text, such as used in modulus expressions or literal textual values, are **not** doubled up, as seems to be what pymssql expects. This is despite the fact that the pymssql DBAPI uses the "pyformat" parameter style which itself considers the percent sign to be significant. Tests are part of standard suite already (CI has been disabled) Change-Id: Ie05de403caefcba3292a967183a995e95a5854d5 Fixes: #4057
* Implement AUTOCOMMIT for pyodbc, pymssqlMike Bayer2017-08-293-0/+24
| | | | | | | In prep for CI coverage for SQL Server, allow AUTOCOMMIT isolation level to work Change-Id: I850b977e75f53385986f2c181be4e4412dd3b3f4
* Generalize autocommit testingMike Bayer2017-08-292-0/+48
| | | | | | | To support adding AUTOCOMMIT to more dialects, add a suite test Change-Id: I585dcce19fcdce70e8cf21aea4edaa97d7bf2bb9
* Merge "Apply percent sign escaping to literal binds, comments"mike bayer2017-08-284-6/+22
|\
| * Apply percent sign escaping to literal binds, commentsMike Bayer2017-08-254-6/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Don't do recovery operations under Empty/AttributeError"mike bayer2017-08-252-20/+35
|\ \
| * | Don't do recovery operations under Empty/AttributeErrorMike Bayer2017-08-252-20/+35
| |/ | | | | | | | | | | | | | | | | | | | | | | Made some adjustments to :class:`.Pool` and :class:`.Connection` such that recovery logic is not run underneath exception catches for ``pool.Empty``, ``AttributeError``, since when the recovery operation itself fails, Python 3 creates a misleading stack trace referring to the ``Empty`` / ``AttributeError`` as the cause, when in fact these exception catches are part of control flow. Change-Id: Id3ed9a8f96ce4ccb4009c94af30ddc2ddb9818b9 Fixes: #4028
* | Merge "Allow for multiple FOLLOWING/PRECEDING in a window range"mike bayer2017-08-252-25/+26
|\ \ | |/ |/|
| * Allow for multiple FOLLOWING/PRECEDING in a window rangeMike Bayer2017-08-252-25/+26
| | | | | | | | | | | | | | | | | | | | | | Altered the range specification for window functions to allow for two of the same PRECEDING or FOLLOWING keywords in a range by allowing for the left side of the range to be positive and for the right to be negative, e.g. (1, 3) is "1 FOLLOWING AND 3 FOLLOWING". Change-Id: I7d3a6c641151bb49219104968d18dac2266f3db8 Fixes: #4053
* | Ensure col is not None when retrieving quick populatorsMike Bayer2017-08-231-2/+17
|/ | | | | | | | | | | | | | | | Fixed bug where an :func:`.undefer_group` option would not be recognized if it extended from a relationship that was loading using joined eager loading. In particular we need to double check the column both in terms of the given "adapter" as well as without applying the "adapter" when searching for the column in the result. As we now avoid redoing the row processor step we also improve on callcounts in joined eager loading. Change-Id: I0f48766f12f7299f4626ff41a00bf1f5bfca5f3b Fixes: #4048
* Handle cache key for option that has no strategyMike Bayer2017-08-221-1/+1
| | | | | | | | | | Fixed regression where the use of a :func:`.undefer_group` option in conjunction with a lazy loaded relationship option would cause an attribute error, due to a bug in the SQL cache key generation added in 1.2 as part of :ticket:`3954`. Change-Id: Icd9a34f0b5aa96d6433a2ab9c8d3eaee0006f609 Fixes: #4049
* - fix typosMike Bayer2017-08-221-1/+1
| | | | Change-Id: Ibf8bc0e997ff989c7b0c16afad48a95414078052
* - modernize the mysql connection timeout docsMike Bayer2017-08-222-6/+17
| | | | | Change-Id: Icb0474509539c1eb7536544749f2a48b4972078a (cherry picked from commit 4ce46fb0a085c1cc739e21881cc25567e663f8dc)
* Deactivate transaction if rollback failsMike Bayer2017-08-222-2/+3
| | | | | | | | | | | | Fixed regression introduced in 1.2.0b1 due to :ticket:`3934` where the :class:`.Session` would fail to "deactivate" the transaction, if a rollback failed (the target issue is when MySQL loses track of a SAVEPOINT). This would cause a subsequent call to :meth:`.Session.rollback` to raise an error a second time, rather than completing and bringing the :class:`.Session` back to ACTIVE. Fixes: #4050 Change-Id: Id245e8dd3487cb006b2d6631c8bd513b5ce81abe
* - allow a separate template database to be used forMike Bayer2017-08-222-5/+11
| | | | | | | PG CREATE DATABASE. as nobody will connect to it that would solve the contention issue here Change-Id: I00a4d52091876e120faff4a8a5493c53280d96f1
* - repair --dbsMike Bayer2017-08-222-1/+21
| | | | | Change-Id: I69e39d2368f50b126c369ecc35e01799fd013254 (cherry picked from commit 3fc6f32ddc5fbbf439acff42c2fdae9e910154be)
* - simplify and see if it still worksMike Bayer2017-08-211-23/+6
| | | | Change-Id: Id0cf7ae2223507d413aaa22e5f8df066b7ac2b46
* - keep trying to get PG dbs to buildMike Bayer2017-08-211-0/+11
| | | | Change-Id: Ib36949da8f079594494a482423d96e7509673481
* - add missing quotesMike Bayer2017-08-211-1/+1
| | | | Change-Id: Ib6efc465cccd7c7661dd089856edfd4979b53517
* - try to get PG database create to be more reliableMike Bayer2017-08-211-1/+10
| | | | Change-Id: I9c9d101547f4484af447db924dc06afd0392a03e
* - sanitize class names for junit reportingMike Bayer2017-08-211-1/+8
| | | | Change-Id: I42821d8324208b708adc17a10b1a2758797cb9db
* - filter out non-oracle URLsMike Bayer2017-08-211-0/+2
| | | | Change-Id: I475f744f8801bc923d738e466d208d662e707413
* - a few mysql fixes, more to comeMike Bayer2017-08-201-3/+4
| | | | Change-Id: Icdcc8ed03374251b8d3815ae58e2726ea27c14b4
* - rework oracle de-provisioning to write URLs to the file as well,Mike Bayer2017-08-203-33/+47
| | | | | | supporting custom dburi etc. Change-Id: Ic0ab0b3b4223e40fd335ee3313fda4dfce942100
* - add some logging for the provisioningMike Bayer2017-08-191-0/+2
| | | | Change-Id: I1ac16bc77642f4f576195ac10443ed8e641e0d49