Tony Locke [Mon, 23 Jun 2014 19:45:16 +0000 (20:45 +0100)]
pg8000 passing test/sql/test_types.py
Opened up two tests that now pass with pg8000. Also, rewrote two tests
to use actual tables rather than having a round trip in a single select
statement. This is necessary for pg8000 because it sends strings to the
server with type 'unknown' and lets the server work out the type.
Mike Bayer [Fri, 4 Jul 2014 19:40:47 +0000 (15:40 -0400)]
- 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.
Mike Bayer [Fri, 4 Jul 2014 01:49:10 +0000 (21:49 -0400)]
- Added new attributes :attr:`.ExecutionContext.exception` and
:attr:`.ExecutionContext.is_disconnect` which are meaningful within
the :meth:`.ConnectionEvents.dbapi_error` handler to see both the
original DBAPI error as well as whether or not it represents
a disconnect.
Mike Bayer [Thu, 3 Jul 2014 21:30:49 +0000 (17:30 -0400)]
- 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
Mike Bayer [Tue, 1 Jul 2014 16:12:27 +0000 (12:12 -0400)]
- Fixed bug where items that were persisted, deleted, or had a
primary key change within a savepoint block would not
participate in being restored to their former state (not in
session, in session, previous PK) after the outer transaction
were rolled back. fixes #3108
Mike Bayer [Tue, 1 Jul 2014 00:25:04 +0000 (20:25 -0400)]
- repair the _enable_single_crit method, it was named the same
as the attribute and probably just replaced itself, so that is
now _set_enable_single_crit
- as a side effect of the main issue fixed here, correct the case in
adjust_for_single_inheritance where the same mapper appears more
than once in mapper_adapter_map; run through a set() for uniqueness.
- Fixed bug in subquery eager loading in conjunction with
:func:`.with_polymorphic`, the targeting of entities and columns
in the subquery load has been made more accurate with respect
to this type of entity and others. Fixes #3106
Mike Bayer [Fri, 27 Jun 2014 20:08:42 +0000 (16:08 -0400)]
- Fixed a bug within the custom operator plus :meth:`.TypeEngine.with_variant`
system, whereby using a :class:`.TypeDecorator` in conjunction with
variant would fail with an MRO error when a comparison operator was used.
fixes #3102
Mike Bayer [Fri, 27 Jun 2014 19:52:40 +0000 (15:52 -0400)]
- MySQL error 2014 "commands out of sync" appears to be raised as a
ProgrammingError, not OperationalError, in modern MySQL-Python versions;
all MySQL error codes that are tested for "is disconnect" are now
checked within OperationalError and ProgrammingError regardless.
fixes #3101
Mike Bayer [Thu, 26 Jun 2014 18:58:42 +0000 (14:58 -0400)]
- Fixed bug involving dynamic attributes, that was again a regression
of :ticket:`3060` from verision 0.9.5. A self-referential relationship
with lazy='dynamic' would raise a TypeError within a flush operation.
fixes #3099
Mike Bayer [Wed, 25 Jun 2014 18:30:25 +0000 (14:30 -0400)]
- Fixed bug when the declarative ``__abstract__`` flag was not being
distinguished for when it was actually the value ``False``.
The ``__abstract__`` flag needs to acutally evaluate to a True
value at the level being tested.
fixes #3097
Mike Bayer [Mon, 23 Jun 2014 22:38:23 +0000 (18:38 -0400)]
- Reverted the change for :ticket:`3060` - this is a unit of work
fix that is updated more comprehensively in 1.0 via :ticket:`3061`.
The fix in :ticket:`3060` unfortunately produces a new issue whereby
an eager load of a many-to-one attribute can produce an event
that is interpreted into an attribute change.
Mike Bayer [Fri, 20 Jun 2014 22:47:28 +0000 (18:47 -0400)]
- Additional checks have been added for the case where an inheriting
mapper is implicitly combining one of its column-based attributes
with that of the parent, where those columns normally don't necessarily
share the same value. This is an extension of an existing check that
was added via :ticket:`1892`; however this new check emits only a
warning, instead of an exception, to allow for applications that may
be relying upon the existing behavior.
fixes #3042
Mike Bayer [Fri, 20 Jun 2014 22:03:28 +0000 (18:03 -0400)]
- The :paramref:`.Column.nullable` flag is implicitly set to ``False``
when that :class:`.Column` is referred to in an explicit
:class:`.PrimaryKeyConstraint` for that table. This behavior now
matches that of when the :class:`.Column` itself has the
:paramref:`.Column.primary_key` flag set to ``True``, which is
intended to be an exactly equivalent case.
fixes #3023
Mike Bayer [Fri, 20 Jun 2014 21:58:06 +0000 (17:58 -0400)]
- Added a new type :class:`.postgresql.OID` to the Postgresql dialect.
While "oid" is generally a private type within PG that is not exposed
in modern versions, there are some PG use cases such as large object
support where these types might be exposed, as well as within some
user-reported schema reflection use cases.
fixes #3002
Mike Bayer [Wed, 18 Jun 2014 14:56:23 +0000 (10:56 -0400)]
- Fixed bug where column names added to ``mysql_length`` parameter
on an index needed to have the same quoting for quoted names in
order to be recognized. The fix makes the quotes optional but
also provides the old behavior for backwards compatibility with those
using the workaround.
fixes #3085
Mike Bayer [Thu, 12 Jun 2014 15:47:50 +0000 (11:47 -0400)]
- Modified the behavior of :func:`.orm.load_only` such that primary key
columns are always added to the list of columns to be "undeferred";
otherwise, the ORM can't load the row's identity. Apparently,
one can defer the mapped primary keys and the ORM will fail, that
hasn't been changed. But as load_only is essentially saying
"defer all but X", it's more critical that PK cols not be part of this
deferral. fixes #3080
Mike Bayer [Fri, 30 May 2014 20:24:38 +0000 (16:24 -0400)]
- 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
Mike Bayer [Fri, 30 May 2014 19:36:13 +0000 (15:36 -0400)]
- The ``__mapper_args__`` dictionary is copied from a declarative
mixin or abstract class when accessed, so that modifications made
to this dictionary by declarative itself won't conflict with that
of other mappings. The dictionary is modified regarding the
``version_id_col`` and ``polymorphic_on`` arguments, replacing the
column within with the one that is officially mapped to the local
class/table. fixes #3062
BY-jk [Fri, 30 May 2014 19:11:19 +0000 (21:11 +0200)]
Uninitialized local variable
implicit_return_defaults is not properly initialized. I am implementing a MERGE statement (inherits from Executable and ClauseElement) that is neither INSERT nor UPDATE. This causes access to the uninitialized variable in line 1979.
Mike Bayer [Fri, 30 May 2014 15:56:19 +0000 (11:56 -0400)]
- The psycopg2 ``.closed`` accessor is now consulted when determining
if an exception is a "disconnect" error; ideally, this should remove
the need for any other inspection of the exception message to detect
disconnect, however we will leave those existing messages in place
as a fallback. This should be able to handle newer cases like
"SSL EOF" conditions. Pull request courtesy Dirk Mueller.
fixes #3021
Dirk Mueller [Thu, 8 May 2014 15:07:44 +0000 (17:07 +0200)]
Another Variant for detecting if a connection is closed
If there is a closed attribute on the connection and
it is true, return true. Implements a todo in the code
and helps in one specific disconnect case where it previously
did not match because the error message was "unknown error".
Mike Bayer [Fri, 30 May 2014 05:39:45 +0000 (01:39 -0400)]
- Related to :ticket:`3060`, an adjustment has been made to the unit
of work such that loading for related many-to-one objects is slightly
more aggressive, in the case of a graph of self-referential objects
that are to be deleted; the load of related objects is to help
determine the correct order for deletion if passive_deletes is
not set.
- revert the changes to test_delete_unloaded_m2o, these deletes do in fact
need to occur in the order of the two child objects first.
Mike Bayer [Fri, 30 May 2014 04:21:11 +0000 (00:21 -0400)]
- add a new assertsql construct "Or", so that we can test for a UOW flush
that might take one of multiple directions; apply this to test_delete_unloaded_m2o
which is now illustrating multiple paths due to #3060/#3061, though still doing the
right thing.
Mike Bayer [Thu, 29 May 2014 16:28:19 +0000 (12:28 -0400)]
- disable the scrolling layout, anchors for code/params are not working,
and the current approach used for sections is not able to work for fine-grained
anchors like these, another approach needs to be taken.
Mike Bayer [Thu, 29 May 2014 00:01:21 +0000 (20:01 -0400)]
- Fixed a few edge cases which arise in the so-called "row switch"
scenario, where an INSERT/DELETE can be turned into an UPDATE.
In this situation, a many-to-one relationship set to None, or
in some cases a scalar attribute set to None, may not be detected
as a net change in value, and therefore the UPDATE would not reset
what was on the previous row. This is due to some as-yet
unresovled side effects of the way attribute history works in terms
of implicitly assuming None isn't really a "change" for a previously
un-set attribute. See also :ticket:`3061`. fixes #3060
Mike Bayer [Wed, 28 May 2014 14:56:52 +0000 (10:56 -0400)]
- a rework of doc layout and nav:
- reduce the real estate for the top nav; move the search box
into the top yellow box, close in space
- use a new CSS/js approach such that the top toolbar freezes from
scrolling at the top of the page. The left nav scrolls independently
of the content pane so that the local contents remain visible regardless
of scrolling. this approach is disabled on mobile where the dual scrollbars
may be cumbersome (overall the site is not well designed for mobile).
Mike Bayer [Sun, 25 May 2014 17:58:08 +0000 (13:58 -0400)]
- Added the ``hashable=False`` flag to the PG :class:`.HSTORE` type, which
is needed to allow the ORM to skip over trying to "hash" an ORM-mapped
HSTORE column when requesting it in a mixed column/entity list.
Patch courtesy Gunnlaugur Þór Briem. Fixes #3053
Mike Bayer [Sun, 25 May 2014 17:45:32 +0000 (13:45 -0400)]
- Fixed bug in subquery eager loading where a long chain of
eager loads across a polymorphic-subclass boundary in conjunction
with polymorphic loading would fail to locate the subclass-link in the
chain, erroring out with a missing property name on an
:class:`.AliasedClass`. fixes #3055
Mike Bayer [Sun, 25 May 2014 15:32:07 +0000 (11:32 -0400)]
- Fixed bug in SQLite join rewriting where anonymized column names
due to repeats would not correctly be rewritten in subqueries.
This would affect SELECT queries with any kind of subquery + join.
fixes #3057
Mike Bayer [Sat, 24 May 2014 18:35:28 +0000 (14:35 -0400)]
- Fixed bug where the :meth:`.Operators.__and__`,
:meth:`.Operators.__or__` and :meth:`.Operators.__invert__`
operator overload methods could not be overridden within a custom
:class:`.TypeEngine.Comparator` implementation.
fixes #3012
Mike Bayer [Sat, 24 May 2014 13:54:20 +0000 (09:54 -0400)]
- hyperlink all the column operators listed in the ORM tutorial common filter operators section
- add language to MATCH explicitly stating this operator varies by backend and is not available
on SQLite, as the tutorial defaults to SQLite to start with, fix #3059
- on the actual match() documentation fix this up to be more accurate, list some example renderings
for different backends. again mention SQLite not supported
Mike Bayer [Fri, 16 May 2014 15:53:12 +0000 (11:53 -0400)]
- add lots more to the profiling section
- add the query profiling recipe, fix it with a stack as we now nest those
calls occasionally
- tabs to spaces