summaryrefslogtreecommitdiff
path: root/test/engine
Commit message (Collapse)AuthorAgeFilesLines
* Add SQL Server CI coverageMike Bayer2017-08-311-1/+2
| | | | Change-Id: Ida0d01ae9bcc0573b86e24fddea620a38c962822
* First level repair for cx_Oracle 6.0 test regressionsMike Bayer2017-08-181-0/+3
| | | | | | | | | | | | Fixed more regressions caused by cx_Oracle 6.0; at the moment, the only behavioral change for users is disconnect detection now detects for cx_Oracle.DatabaseError in addition to cx_Oracle.InterfaceError, as this behavior seems to have changed. Other issues regarding numeric precision and uncloseable connections are pending with the upstream cx_Oracle issue tracker. Change-Id: Id61f1e33b21c155a598396340dfdecd28ff4066b Fixes: #4045
* Don't erase reflected comment in _init_existingEloy Felix2017-06-201-0/+4
| | | | | Change-Id: Ie0b78c79367933486528ca0ba686d4a9f16922b1 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/370
* Allow metadata.reflect() to recover from unreflectable tablesMike Bayer2017-05-221-0/+31
| | | | | | | | | | | | | 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
* - keep trying to identify the race here. can reproduce locallyMike Bayer2017-04-271-11/+11
| | | | | | now and it seems like mock might not be doing the right thing. Change-Id: I5c108d82631c9217da54a8ace68d7728c3e204d8
* - try to work around a race that can occur in STP whenMike Bayer2017-04-271-2/+11
| | | | | | used in this intentionally broken scenario Change-Id: I88ea6fa710da2189e6d47e2d12f5f0fd6f6bb7d4
* Apply type processing to untyped preexec default clauseMike Bayer2017-03-301-53/+26
| | | | | | | | | | | | | | | | Fixed bug where a SQL-oriented Python-side column default could fail to be executed properly upon INSERT in the "pre-execute" codepath, if the SQL itself were an untyped expression, such as plain text. The "pre- execute" codepath is fairly uncommon however can apply to non-integer primary key columns with SQL defaults when RETURNING is not used. Tests exist here to ensure typing is applied to a typed expression for default, but in the case of an untyped SQL value, we know the type from the column, so apply this. Change-Id: I5d8b391611c137b9f700115a50a2bf5b30abfe94 Fixes: #3923
* Add safe_reraise() + warnings only to Connection._autorollbackMike Bayer2017-03-272-21/+62
| | | | | | | | | | | | Added an exception handler that will warn for the "cause" exception on Py2K when the "autorollback" feature of :class:`.Connection` itself raises an exception. In Py3K, the two exceptions are naturally reported by the interpreter as one occurring during the handling of the other. This is continuing with the series of changes for rollback failure handling that were last visited as part of :ticket:`2696` in 1.0.12. Change-Id: I600ba455a14ebaea27c6189889181f97c632f179 Fixes: #3946
* Integrate "pre-ping" into connection pool.Mike Bayer2017-03-201-2/+147
| | | | | | | | | | | | | | | Added native "pessimistic disconnection" handling to the :class:`.Pool` object. The new parameter :paramref:`.Pool.pre_ping`, available from the engine as :paramref:`.create_engine.pool_pre_ping`, applies an efficient form of the "pre-ping" recipe featured in the pooling documentation, which upon each connection check out, emits a simple statement, typically "SELECT 1", to test the connection for liveness. If the existing connection is no longer able to respond to commands, the connection is transparently recycled, and all other connections made prior to the current timestamp are invalidated. Change-Id: I89700d0075e60abd2250e54b9bd14daf03c71c00 Fixes: #3919
* Implement comments for tables, columnsFrazer McLean2017-03-171-0/+14
| | | | | | | | | | | | | | 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
* Consult compiled paramstyle on execute_compiledMike Bayer2017-03-151-0/+30
| | | | | | | | | | | | Fixed bug where in the unusual case of passing a :class:`.Compiled` object directly to :meth:`.Connection.execute`, the dialect with which the :class:`.Compiled` object were generated was not consulted for the paramstyle of the string statement, instead assuming it would match the dialect-level paramstyle, causing mismatches to occur. Change-Id: I114e4db2183fbb75bb7c0b0641f5a161855696ee Fixes: #3938
* - add ad_hoc_engines to remove RealReconnectTest from oracleMike Bayer2017-03-141-1/+1
| | | | Change-Id: Ie40aeba87dcfe9e8216abb8be050e7c2cc5b5ec9
* - add a test suite that ensures textual autocommit worksMike Bayer2017-02-131-0/+56
| | | | | | for correct expressions Change-Id: I17d35169be914924828487abba05658dff380f2a
* Make all tests to be PEP8 compliantKhairi Hafsham2017-02-078-429/+401
| | | | | | | | tested using pycodestyle version 2.2.0 Fixes: #3885 Change-Id: I5df43adc3aefe318f9eeab72a078247a548ec566 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/343
* Accept FetchedValue, text() for column "default" valueMike Bayer2017-02-011-3/+50
| | | | | | | | | | | | | Fixed bug whereby the :meth:`.DDLEvents.column_reflect` event would not allow a non-textual expression to be passed as the value of the "default" for the new column, such as a :class:`.FetchedValue` object to indicate a generic triggered default or a :func:`.sql.expression.text` construct. Clarified the documentation in this regard as well. Fixes: #3905 Change-Id: I829796c3e9f87f375149bebee7eef133a6876d4d
* Better hide engine passwordValery Yundin2017-01-161-5/+7
| | | | | | | | | | Avoid putting engine password in the exception message in `MetaData.reflect` (since exception messages often appear in logs). Use the same redacted `__repr__` implementation in `TLEngine` as in its base class `Engine` Change-Id: Ic0a7baea917a9c8d87dffdd82ef566673ab08e02 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/327
* Support python3.6Mike Bayer2017-01-133-15/+15
| | | | | | | | | | | 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
* Add _extend_on deduplicating set for metadata.reflect()Mike Bayer2016-11-231-1/+35
| | | | | | | | | | | | | The "extend_existing" option of :class:`.Table` reflection would cause indexes and constraints to be doubled up in the case that the parameter were used with :meth:`.MetaData.reflect` (as the automap extension does) due to tables being reflected both within the foreign key path as well as directly. A new de-duplicating set is passed through within the :meth:`.MetaData.reflect` sequence to prevent double reflection in this way. Change-Id: Ibf6650c1e76a44ccbe15765fd79df2fa53d6bac7 Fixes: #3861
* Spelling fixesVille Skyttä2016-10-081-1/+1
|
* Handle BaseException in all _handle_dbapi_errorMike Bayer2016-09-211-3/+91
| | | | | | | | | | | | | | | | | Tests illustrate that exceptions like GreenletExit and even KeyboardInterrupt can corrupt the state of a DBAPI connection like that of pymysql and mysqlclient. Intercept BaseException errors within the handle_error scheme and invalidate just the connection alone in this case, but not the whole pool. The change is backwards-incompatible with a program that currently intercepts ctrl-C within a database transaction and wants to continue working on that transaction. Ensure the event hook can be used to reverse this behavior. Change-Id: Ifaa013c13826d123eef34e32b7e79fff74f1b21b Fixes: #3803
* Additions to support HAAlchemy pluginMike Bayer2016-09-162-0/+78
| | | | | | | | | | | | | | | | | | | - add a connect=True key to connection record to support pre-loading of _ConnectionRecord objects - ensure _ConnectionRecord.close() leaves the record in a good state for reopening - add _ConnectionRecord.record_info for persistent storage - add "in_use" accessor based on fairy_ref being present or not - allow for the exclusions system and SuiteRequirements to be usable without the full plugin_base setup. - move some Python-env requirements to the importable requirements.py module. - allow starttime to be queried - add additional events for engine plugins - have "dialect" be a first-class parameter to the pool, ensure the engine strategy supplies it up front Change-Id: Ibf549f7a1766e49d335cd6f5e26bacfaef9a8229
* - latest mysql 5.7 also crashing on XA recovery, disableMike Bayer2016-09-161-0/+3
| | | | | | XA recovery for all MySQL Change-Id: I4f77de521cd80c09fdf97e5bbe5dfd1c830dc3cb
* Check for supports_execution at ClauseElement baseMike Bayer2016-08-311-0/+20
| | | | | | | | | | Raise a more descriptive exception / message when ClauseElement or non-SQLAlchemy objects that are not "executable" are erroneously passed to ``.execute()``; a new exception ObjectNotExecutableError is raised consistently in all cases. Change-Id: I2dd393121e2c7e5b6b9e40286a2f25670876e8e4 Fixes: #3786
* - a variety of test adjustments to accomodate for MySQL 5.7Mike Bayer2016-07-241-6/+1
| | | | Change-Id: Ied4245433d0d7b469dae6e7394c4931d8405f387
* Make boolean processors consistent between Py/C; coerce to 1/0Mike Bayer2016-06-231-0/+79
| | | | | | | | | | | | | The processing performed by the :class:`.Boolean` datatype for backends that only feature integer types has been made consistent between the pure Python and C-extension versions, in that the C-extension version will accept any integer value from the database as a boolean, not just zero and one; additionally, non-boolean integer values being sent to the database are coerced to exactly zero or one, instead of being passed as the original integer value. Change-Id: I01e647547fd7047bd549dd70e1fa202c51e8328b Fixes: #3730
* - dont use id() to test identity as these can be recycledMike Bayer2016-06-151-12/+14
| | | | Change-Id: Ie4cb4924909d55c5962f66e36cd5325e8e8f0538
* - flake8Mike Bayer2016-06-151-106/+128
| | | | Change-Id: I74e369d1d71c98cb0af58dde80b7d535d17cbdf7
* Deprecate FromClause.count()Mike Bayer2016-06-141-1/+2
| | | | | | | | | | | count() here is misleading in that it not only counts from an arbitrary column in the table, it also does not make accommodations for DISTINCT, JOIN, etc. as the ORM-level function does. Core should not be attempting to provide a function like this. Change-Id: I9916fc51ef744389a92c54660ab08e9695b8afc2 Fixes: #3724
* - use a mock here, do away with timing problems for good. need to do thisMike Bayer2016-06-021-12/+18
| | | | | | for the rest of the timing tests Change-Id: I06a815b1500222126a4dbc2a9a5da3ef7847e321
* Implemented CHECK constraint reflection for SQLite and PostgreSQLAlex Grönholm2016-06-011-0/+20
| | | | | | Co-Authored-By: Mike Bayer <mike_mp@zzzcomputing.com> Change-Id: Ie6cf2d2958d1c567324db9e08fef2d3186e97350 Pull-request: https://bitbucket.org/zzzeek/sqlalchemy/pull-requests/80
* Merge remote-tracking branch 'origin/pr/270'Mike Bayer2016-05-241-1/+1
|\
| * Spelling fixes: "an SQL" -> "a SQL", see #266pr/270Ville Skyttä2016-05-051-1/+1
| |
* | Support "blank" schema when MetaData.schema is setMike Bayer2016-05-181-0/+25
|/ | | | | | | | | | | | | Previously, it was impossible to have a Table that has None for a schema name when the "schema" parameter on MetaData was set. A new symbol sqlalchemy.schema.BLANK_SCHEMA is added which indicates that the schema name should unconditionally be set to None. In particular, this value must be passed within cross-schema foreign key reflection, so that a Table which is in the "default" schema can be represented properly. Fixes: #3716 Change-Id: I3d24f99c22cded206c5379fd32a225e74edb7a8e
* - Add support for PostgreSQL with PyGreSQLChristoph Zwerschke2016-04-151-2/+2
| | | | | Change-Id: I040b75ff3b4110e7e8b26442a4eb226ba8c26715 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/234
* - move all resultproxy tests intio test_resultsetMike Bayer2016-03-301-332/+0
|
* - make sure negative row indexes are based on the size of theMike Bayer2016-03-301-14/+22
| | | | | | number of columns we're actually reporting on - add more tests for negative row index - changelog/migration
* Merge remote-tracking branch 'origin/pr/231' into pr231Mike Bayer2016-03-301-0/+19
|\
| * - properly handle negative indexes in RowProxy.__getitem__()pr/231Lele Gaifax2016-01-281-0/+19
| |
* | - Added connection pool events :meth:`ConnectionEvents.close`,Mike Bayer2016-03-251-0/+60
| | | | | | | | | | :meth:`.ConnectionEvents.detach`, :meth:`.ConnectionEvents.close_detached`.
* | - Added basic isolation level support to the SQL Server dialectsMike Bayer2016-03-151-0/+4
| | | | | | | | | | | | via :paramref:`.create_engine.isolation_level` and :paramref:`.Connection.execution_options.isolation_level` parameters. fixes #3534
* | - handle parameter sets that aren't correctly formed, so thatMike Bayer2016-02-171-1/+27
| | | | | | | | | | for example an exception object made within a test suite can still repr (error seen in Keystone)
* | - do the trailing comma logic of tuple repr() exactlyMike Bayer2016-02-171-0/+18
| |
* | - All string formatting of bound parameter sets and result rows forMike Bayer2016-02-171-1/+85
| | | | | | | | | | | | | | | | | | logging, exception, and ``repr()`` purposes now truncate very large scalar values within each collection, including an "N characters truncated" notation, similar to how the display for large multiple-parameter sets are themselves truncated. fixes #2837
* | - revert the change first made in a6fe4dc, as we are now generalizingMike Bayer2016-01-281-0/+21
|/ | | | | | | | | | | | | | | | | | | | | | | the warning here to all safe_reraise() cases in Python 2. - Revisiting :ticket:`2696`, first released in 1.0.10, which attempts to work around Python 2's lack of exception context reporting by emitting a warning for an exception that was interrupted by a second exception when attempting to roll back the already-failed transaction; this issue continues to occur for MySQL backends in conjunction with a savepoint that gets unexpectedly lost, which then causes a "no such savepoint" error when the rollback is attempted, obscuring what the original condition was. The approach has been generalized to the Core "safe reraise" function which takes place across the ORM and Core in any place that a transaction is being rolled back in response to an error which occurred trying to commit, including the context managers provided by :class:`.Session` and :class:`.Connection`, and taking place for operations such as a failure on "RELEASE SAVEPOINT". Previously, the fix was only in place for a specific path within the ORM flush/commit process; it now takes place for all transational context managers as well. fixes #2696
* - Multi-tenancy schema translation for :class:`.Table` objects is added.Mike Bayer2016-01-082-5/+202
| | | | | | | | | This supports the use case of an application that uses the same set of :class:`.Table` objects in many schemas, such as schema-per-user. A new execution option :paramref:`.Connection.execution_options.schema_translate_map` is added. fixes #2685 - latest tox doesn't like the {posargs} in the profile rerunner
* - add a do-nothing for mock url _instantiate_pluginsMike Bayer2016-01-061-0/+1
|
* - Added a new entrypoint system to the engine to allow "plugins" toMike Bayer2016-01-061-8/+35
| | | | | | | | | | | be stated in the query string for a URL. Custom plugins can be written which will be given the chance up front to alter and/or consume the engine's URL and keyword arguments, and then at engine create time will be given the engine itself to allow additional modifications or event registration. Plugins are written as a subclass of :class:`.CreateEnginePlugin`; see that class for details. fixes #3536
* - The system by which a :class:`.Column` considers itself to be anMike Bayer2015-10-071-9/+10
| | | | | | | | | | | | | | | | | "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.
* - Fixed critical issue whereby the pool "checkout" event handlerMike Bayer2015-07-221-1/+94
| | | | | | | | | | | | may be called against a stale connection without the "connect" event handler having been called, in the case where the pool attempted to reconnect after being invalidated and failed; the stale connection would remain present and would be used on a subsequent attempt. This issue has a greater impact in the 1.0 series subsequent to 1.0.2, as it also delivers a blanked-out ``.info`` dictionary to the event handler; prior to 1.0.2 the ``.info`` dictionary is still the previous one. fixes #3497
* - remove the redundant non-max-row-buffer test from the max_row_bufferMike Bayer2015-06-141-12/+0
| | | | test as we implemented that as a separate test.