summaryrefslogtreecommitdiff
path: root/test/engine
Commit message (Collapse)AuthorAgeFilesLines
* - 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.
* - add test cases for pullreq github:182, where we add a newMike Bayer2015-06-141-47/+110
| | | | | | | | "max_row_buffer" execution option for BufferedRowResultProxy - also add documentation, changelog and version notes - rework the max_row_buffer argument to be interpreted from the execution options upfront when the BufferedRowResultProxy is first initialized.
* - Added new engine event :meth:`.ConnectionEvents.engine_disposed`.Mike Bayer2015-06-061-0/+26
| | | | Called after the :meth:`.Engine.dispose` method is called.
* - Fixed bug where known boolean values used byMike Bayer2015-05-261-0/+17
| | | | | | | | :func:`.engine_from_config` were not being parsed correctly; these included ``pool_threadlocal`` and the psycopg2 argument ``use_native_unicode``. fixes #3435 - add legacy_schema_aliasing config parsing for mssql - move use_native_unicode config arg to the psycopg2 dialect
* - fix some tests related to the URL change and try to makeMike Bayer2015-05-231-0/+4
| | | | the URL design a little simpler
* - Fixed bug where in the case that a pool checkout event handler is usedMike Bayer2015-05-141-17/+48
| | | | | | | | | | | | | | | | | and the database can no longer be connected towards, that the checkout handler failure is caught, the attempt to re-acquire the connection also raises an exception, but the underlying connection record is not immediately re-checked in before the exception is propagated outwards, having the effect that the checked-out record does not close itself until the stack trace it's associated with is garbage collected, preventing that record from being used for a new checkout until we leave the scope of the stack trace. This can lead to confusion in the specific case of when the number of current stack traces in memory exceeds the number of connections the pool can return, as the pool will instead begin to raise errors about no more checkouts available, rather than attempting a connection again. The fix applies a checkin of the record before re-raising. fixes #3419
* - revise the last commit with a more traditional approachMike Bayer2015-04-301-6/+1
| | | | using descriptors; ensure that mock.patch() honors descriptor setters
* - work the wrapping of the "creator" to be as resilient toMike Bayer2015-04-302-1/+56
| | | | | old / new style, direct access, and ad-hoc patching and unpatching as possible
* - New features added to support engine/pool plugins with advancedMike Bayer2015-04-303-5/+251
| | | | | | | | | | | | | | | | | | | | | | | | | functionality. Added a new "soft invalidate" feature to the connection pool at the level of the checked out connection wrapper as well as the :class:`._ConnectionRecord`. This works similarly to a modern pool invalidation in that connections aren't actively closed, but are recycled only on next checkout; this is essentially a per-connection version of that feature. A new event :class:`.PoolEvents.soft_invalidate` is added to complement it. fixes #3379 - Added new flag :attr:`.ExceptionContext.invalidate_pool_on_disconnect`. Allows an error handler within :meth:`.ConnectionEvents.handle_error` to maintain a "disconnect" condition, but to handle calling invalidate on individual connections in a specific manner within the event. - Added new event :class:`.DialectEvents.do_connect`, which allows interception / replacement of when the :meth:`.Dialect.connect` hook is called to create a DBAPI connection. Also added dialect plugin hooks :meth:`.Dialect.get_dialect_cls` and :meth:`.Dialect.engine_created` which allow external plugins to add events to existing dialects using entry points. fixes #3355
* - replace old crufty ddl event test fixture with mockMike Bayer2015-04-271-95/+164
|
* - Fixed regression due to :ticket:`3282` where the ``tables`` collectionMike Bayer2015-04-271-2/+53
| | | | | | | | | | | | | | | | passed as a keyword argument to the :meth:`.DDLEvents.before_create`, :meth:`.DDLEvents.after_create`, :meth:`.DDLEvents.before_drop`, and :meth:`.DDLEvents.after_drop` events would no longer be a list of tables, but instead a list of tuples which contained a second entry with foreign keys to be added or dropped. As the ``tables`` collection, while documented as not necessarily stable, has come to be relied upon, this change is considered a regression. Additionally, in some cases for "drop", this collection would be an iterator that would cause the operation to fail if prematurely iterated. The collection is now a list of table objects in all cases and test coverage for the format of this collection is now added. fixes #3391
* - Added the string value ``"none"`` to those accepted by theMike Bayer2015-04-211-0/+15
| | | | | | | | :paramref:`.Pool.reset_on_return` parameter as a synonym for ``None``, so that string values can be used for all settings, allowing .ini file utilities like :func:`.engine_from_config` to be usable without issue. fixes #3375
* Merge remote-tracking branch 'origin/pr/163' into pr163Mike Bayer2015-04-126-79/+160
|\
| * PEP8 cleanup in /test/enginepr/163Eric Streeper2015-03-206-79/+160
| |
* | - add some teardown for connections that are held open after testsMike Bayer2015-04-081-6/+18
|/ | | | in some cases, interfering with tests that check pool._refs
* - The "auto close" for :class:`.ResultProxy` is now a "soft" close.Mike Bayer2015-03-171-0/+41
| | | | | | | | | | | That is, after exhausing all rows using the fetch methods, the DBAPI cursor is released as before and the object may be safely discarded, but the fetch methods may continue to be called for which they will return an end-of-result object (None for fetchone, empty list for fetchmany and fetchall). Only if :meth:`.ResultProxy.close` is called explicitly will these methods raise the "result is closed" error. fixes #3330 fixes #3329
* - Fixed bug in :class:`.Connection` and pool where theMike Bayer2015-02-042-0/+22
| | | | | | | | | :meth:`.Connection.invalidate` method, or an invalidation due to a database disconnect, would fail if the ``isolation_level`` parameter had been used with :meth:`.Connection.execution_options`; the "finalizer" that resets the isolation level would be called on the no longer opened connection. fixes #3302
* - A warning is emitted if the ``isolation_level`` parameter is usedMike Bayer2015-02-041-3/+25
| | | | | | | | | | | | | | | | with :meth:`.Connection.execution_options` when a :class:`.Transaction` is in play; DBAPIs and/or SQLAlchemy dialects such as psycopg2, MySQLdb may implicitly rollback or commit the transaction, or not change the setting til next transaction, so this is never safe. - Added new parameter :paramref:`.Session.connection.execution_options` which may be used to set up execution options on a :class:`.Connection` when it is first checked out, before the transaction has begun. This is used to set up options such as isolation level on the connection before the transaction starts. - added new documentation section detailing best practices for setting transaction isolation with sessions. fixes #3296
* - additional test adjustments for pypy / psycopg2cffi. ThisMike Bayer2015-01-261-24/+26
| | | | | | | | | | consists mainly of adjusting fixtures to ensure connections are closed explicitly. psycopg2cffi also handles unicode bind parameter names differently than psycopg2, and seems to possibly have a little less control over floating point values at least in one test which is marked as a "fail", though will see if it runs differently on linux than osx.. - changelog for psycopg2cffi, fixes #3052
* Added psycopg2cffi dialectShaun Stanworth2015-01-261-1/+1
|
* - Added new user-space accessors for viewing transaction isolationMike Bayer2015-01-202-0/+43
| | | | | | | | | 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.
* formattingMike Bayer2015-01-201-27/+30
|
* - rework the handle error on connect tests from test_parsconnect whereMike Bayer2014-12-102-236/+245
| | | | they don't really belong into a new suite in test_execute
* - identify another spot where _handle_dbapi_error() needs to do somethingMike Bayer2014-12-081-0/+28
| | | | | differently for the case where it is called in an already-invalidated state; don't call upon self.connection
* - simplify the "noconnection" error handling, settingMike Bayer2014-12-081-2/+2
| | | | | | | _handle_dbapi_exception_noconnection() to only invoke in the case of raw_connection() in the constructor of Connection. in all other cases the Connection proceeds with _handle_dbapi_exception() including revalidate.
* - adjust _revalidate_connection() again such that we pass a _wrap=FalseMike Bayer2014-12-052-3/+3
| | | | | | | | | | to it, so that we say we will do the wrapping just once right here in _execute_context() / _execute_default(). An adjustment is made to _handle_dbapi_error() to not assume self.__connection in case we are already in an invalidated state further adjustment to 0639c199a547343d62134d2f233225fd2862ec45, 41e7253dee168b8c26c49, #3266
* - move inner calls to _revalidate_connection() outside of existingMike Bayer2014-12-051-1/+34
| | | | | _handle_dbapi_error(); these are now handled already and the reentrant call is not needed / breaks things. Adjustment to 41e7253dee168b8c26c49 /
* - The engine-level error handling and wrapping routines will nowMike Bayer2014-12-051-1/+112
| | | | | | | | | take effect in all engine connection use cases, including when user-custom connect routines are used via the :paramref:`.create_engine.creator` parameter, as well as when the :class:`.Connection` encounters a connection error on revalidation. fixes #3266
* - pep8 cleanupMike Bayer2014-12-051-58/+77
|