Commit Graph

608 Commits

Author SHA1 Message Date
Mike Bayer eee617e08e - rework the handle error on connect tests from test_parsconnect where
they don't really belong into a new suite in test_execute
2014-12-10 12:11:59 -05:00
Mike Bayer 06738f665e - identify another spot where _handle_dbapi_error() needs to do something
differently for the case where it is called in an already-invalidated state;
don't call upon self.connection
2014-12-08 15:15:02 -05:00
Mike Bayer b7cf11b163 - simplify the "noconnection" error handling, setting
_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.
2014-12-08 14:05:20 -05:00
Mike Bayer b8114a3576 - adjust _revalidate_connection() again such that we pass a _wrap=False
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
0639c199a5, 41e7253dee, #3266
2014-12-05 19:08:47 -05:00
Mike Bayer 0639c199a5 - move inner calls to _revalidate_connection() outside of existing
_handle_dbapi_error(); these are now handled already and the reentrant
call is not needed / breaks things.  Adjustment to 41e7253dee /
2014-12-05 16:34:43 -05:00
Mike Bayer 41e7253dee - The engine-level error handling and wrapping routines will now
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
2014-12-05 12:12:44 -05:00
Mike Bayer 6e53e866de - pep8 cleanup 2014-12-05 11:35:42 -05:00
Scott Dugas b31ab00689 Merge branch 'master' into fdbsql-tests
Conflicts:
	lib/sqlalchemy/testing/exclusions.py
2014-11-03 14:54:51 -05:00
Scott Dugas 9687b272bd Added new requirement for check_constraints 2014-10-23 11:46:34 -04:00
Mike Bayer dddb74bbd3 - control the module name of the exception here for py3k compat 2014-10-19 13:37:48 -04:00
Mike Bayer 6f40eb37cb - Exception messages have been spiffed up a bit. The SQL statement
and parameters are not displayed if None, reducing confusion for
error messages that weren't related to a statement.  The full
module and classname for the DBAPI-level exception is displayed,
making it clear that this is a wrapped DBAPI exception.  The
statement and parameters themselves are bounded within a bracketed
sections to better isolate them from the error message and from
each other.
fixes #3172
2014-10-17 19:37:45 -04:00
Mike Bayer 2885f78e4e - adjustment for ref #3200 as we need an immutabledict() here so
that union() can be called, in the case of a dialect that uses
execution options inside of initialize() (e.g. oursql)
2014-10-07 12:43:27 -04:00
Mike Bayer 119674dd25 - The execution options passed to an :class:.Engine either via
:paramref:`.create_engine.execution_options` or
:meth:`.Engine.update_execution_options` are not passed to the
special :class:`.Connection` used to initialize the dialect
within the "first connect" event; dialects will usually
perform their own queries in this phase, and none of the
current available  options should be applied here.  In
particular, the "autocommit" option was causing an attempt to
autocommit within this initial connect which would fail with
an AttributeError due to the non-standard state of the
:class:`.Connection`.
fixes #3200
2014-10-06 18:23:42 -04:00
Mike Bayer 573877b4bc - repair autorollback for branches 2014-09-26 21:41:15 -04:00
Mike Bayer b89523f0b7 - Fixed bug where a "branched" connection, that is the kind you get
when you call :meth:`.Connection.connect`, would not share transaction
status with the parent.  The architecture of branching has been tweaked
a bit so that the branched connection defers to the parent for
all transactional status and operations.
fixes #3190
2014-09-26 16:25:26 -04:00
Mike Bayer fbddf193a6 - Fixed bug where a "branched" connection, that is the kind you get
when you call :meth:`.Connection.connect`, would not share invalidation
status with the parent.  The architecture of branching has been tweaked
a bit so that the branched connection defers to the parent for
all invalidation status and operations.
fixes #3215
2014-09-26 14:55:36 -04:00
Mike Bayer f458ef8456 - these tests don't test anything in SQLAlchemy - from our perpsective,
we need to be in transactions (tested elsewhere) and we need to
emit the correct FOR UPDATE strings (tested elsewhere).  There's nothing
in SQLA to be tested as far as validating that for update causes exceptions
or not, and these tests frequently fail as they are timing sensitive.
2014-09-19 12:41:07 -04:00
Mike Bayer b36cdefba2 - Fixed bug that affected generally the same classes of event
as that of 🎫`3199`, when the ``named=True`` parameter
would be used.  Some events would fail to register, and others
would not invoke the event arguments correctly, generally in the
case of when an event was "wrapped" for adaption in some other way.
The "named" mechanics have been rearranged to not interfere with
the argument signature expected by internal wrapper functions.
fixes #3197
2014-09-18 17:49:07 -04:00
Mike Bayer ec840a6eea - An adjustment to table/index reflection such that if an index
reports a column that isn't found to be present in the table,
a warning is emitted and the column is skipped.  This can occur
for some special system column situations as has been observed
with Oracle. fixes #3180
2014-09-02 14:18:09 -04:00
Mike Bayer 92b0ad0fef - Fixed bug in connection pool logging where the "connection checked out"
debug logging message would not emit if the logging were set up using
``logging.setLevel()``, rather than using the ``echo_pool`` flag.
Tests to assert this logging have been added.  This is a
regression that was introduced in 0.9.0.
fixes #3168
2014-08-20 12:01:20 -04:00
Mike Bayer cea97d1fae - pep8 cleanup 2014-08-20 09:08:59 -04:00
Mike Bayer 948986ad59 Merge remote-tracking branch 'origin/pr/125' into pr125 2014-08-16 13:48:57 -04:00
Mike Bayer 6a21f9e328 - The string keys that are used to determine the columns impacted
for an INSERT or UPDATE are now sorted when they contribute towards
the "compiled cache" cache key.   These keys were previously not
deterministically ordered, meaning the same statement could be
cached multiple times on equivalent keys, costing both in terms of
memory as well as performance.
fixes #3165
2014-08-14 20:00:35 -04:00
Malik Diarra ad8f921e96 Providing an autoload_with info automatically sets autoload to True 2014-08-09 21:43:32 +02:00
Mike Bayer 6fd073b912 - take out the iterator approach here as it does not support concurrent access 2014-08-07 12:36:50 -04:00
Tony Locke ed1bbbed27 two_phase_recover, COMMIT PREPARED in transaction
In test/engine/test_transaction/test_two_phase_recover(), a COMMIT
PREPARED is issued while in a transaction. This causes an error, and
a prepared transaction is left hanging around which causes
the subsequent test to hang. I've altered the test to execute the
offending query with autocommit=true, then when it gets to the COMMIT
PRPARED it can go ahead.

There's another complication for pg8000 because its tpc_recover() method
started a transaction if one wasn't already in progress. I've decided
that this is incorrect behaviour and so from pg8000-1.9.13 this method
never starts or stops a transaction.
2014-08-02 15:29:36 +01:00
Tony Locke f586754c86 PEP8 tidy of test/engine/test_reconnect 2014-08-02 15:29:36 +01:00
Mike Bayer 5a86dba402 - workaround removal of nested() in py3k 2014-07-30 12:50:38 -04:00
Mike Bayer 0bf33068f4 - ensure all tests are named test_* 2014-07-30 12:18:33 -04:00
Mike Bayer e5620993bf pep8 cleanup 2014-07-29 14:17:29 -04:00
Mike Bayer 83326bf44c - The exception wrapping system for DBAPI errors can now accommodate
non-standard DBAPI exceptions, such as the psycopg2
TransactionRollbackError.  These exceptions will now be raised
using the closest available subclass in ``sqlalchemy.exc``, in the
case of TransactionRollbackError, ``sqlalchemy.exc.OperationalError``.
fixes #3075
2014-07-29 14:06:43 -04:00
Mike Bayer 54592942c4 - add support for tags, including include/exclude support.
simplify tox again now that we can exclude tests more easily
2014-07-27 18:46:20 -04:00
Mike Bayer 41a8a85311 Merge branch 'master' into xdist_poc 2014-07-26 20:53:27 -04:00
Mike Bayer 82965851fe fix paren here 2014-07-26 20:53:12 -04:00
Mike Bayer d2358629c9 - scale up for mysql, sqlite 2014-07-26 20:50:57 -04:00
Mike Bayer fe878f5aff - more pg8000 tests passing 2014-07-25 16:39:44 -04:00
Mike Bayer 6b60d3a9e6 - The MySQL dialect will now disable :meth:.ConnectionEvents.handle_error
events from firing for those statements which it uses internally
to detect if a table exists or not.   This is achieved using an
execution option ``skip_user_error_events`` that disables the handle
error event for the scope of that execution.   In this way, user code
that rewrites exceptions doesn't need to worry about the MySQL
dialect or other dialects that occasionally need to catch
SQLAlchemy specific exceptions.
2014-07-25 12:14:22 -04:00
mike bayer 7c29cff14d Merge pull request #100 from plaes/typos
Typo fixes
2014-07-06 17:17:59 -04:00
Mike Bayer 9b03d6a0a8 - add test support for disconnect modification 2014-07-04 16:49:11 -04:00
Mike Bayer dfb5707dae - rework the entire approach to #3076. As we need to catch all exceptions
in all cases unconditionally, the number of use cases that go beyond what
dbapi_error() is expecting has gone too far for an 0.9 release.
Additionally, the number of things we'd like to track is really a lot
more than the five arguments here, and ExecutionContext is really not
suitable as totally public API for this.   So restore dbapi_error
to its old version, deprecate, and build out handle_error instead.
This is a lot more extensible and doesn't get in the way of anything
compatibility-wise.
2014-07-04 15:40:47 -04:00
Mike Bayer e0a9b94abb - The mechanics of the :meth:.ConnectionEvents.dbapi_error handler
have been enhanced such that the function handler is now capable
of raising or returning a new exception object, which will replace
the exception normally being thrown by SQLAlchemy.
fixes #3076
2014-07-03 17:30:49 -04:00
Priit Laes 68a72ee0c4 typo: s/thbe/the 2014-06-28 12:47:19 +03:00
Priit Laes eb5f398a01 typo: s/tranasction/transaction 2014-06-28 12:46:46 +03:00
Mike Bayer 814637e291 - vastly improve the "safe close cursor" tests in test_reconnect
- Fixed bug which would occur if a DBAPI exception
occurs when the engine first connects and does its initial checks,
and the exception is not a disconnect exception, yet the cursor
raises an error when we try to close it.  In this case the real
exception would be quashed as we tried to log the cursor close
exception via the connection pool and failed, as we were trying
to access the pool's logger in a way that is inappropriate
in this very specific scenario. fixes #3063
2014-05-30 16:24:38 -04:00
Alex Gaynor 1caa7fafbd Fix many typos throughout the codebase
Found using: https://github.com/intgr/topy
2014-04-26 13:13:13 -07:00
Mike Bayer a04fb82028 pickle of execption not supported on mysqlconnector 2014-03-28 16:37:43 -04:00
Mike Bayer 761c8ff15d - work on fixing some race-condition failures:
1. make sure pool._invalidate() sets the timestamp up before
invalidating the target connection.  we can otherwise show how the
conn.invalidate() + pool._invalidate() can lead to an extra connection
being made.
2. to help with that, soften up the check on connection.invalidate()
when connection is already closed. a warning is fine here
3. add a mutex to test_max_overflow() when we connect, because the way
we're using mock depends on an iterator, that needs to be synchronized
2014-03-26 16:31:52 -04:00
Mike Bayer 74f7509d66 add some more mock structure so tricky DBAPIs like pypy work 2014-03-24 19:30:44 -04:00
Mike Bayer 50d19f55d2 - add some more rules to make sure all tests run if DBs are available 2014-03-24 12:49:22 -04:00
Mike Bayer 82a67abf4b - fix the uuid routine here to not run out of uuids 2014-03-24 11:57:38 -04:00