.. changelog::
:version: 0.8.1
- :tags: feature, orm
- :tickets: 2673
- :pullreq: 53
+ .. change::
- Added a convenience method to Query that turns a query into an
- EXISTS subquery of the form EXISTS (SELECT 1 FROM ... WHERE ...)
++ :tags: feature, orm
++ :tickets: 2673
+
++ Added a convenience method to Query that turns a query into an
++ EXISTS subquery of the form
++ ``EXISTS (SELECT 1 FROM ... WHERE ...)``.
++
+ .. change::
+ :tags: bug, orm
+
+ Added a conditional to the unpickling process for ORM
+ mapped objects, such that if the reference to the object
+ were lost when the object was pickled, we don't
+ erroneously try to set up _sa_instance_state - fixes
+ a NoneType error.
+
+ .. change::
+ :tags: bug, postgresql
+ :tickets: 2712
+
+ Opened up the checking for "disconnect" with psycopg2/libpq
+ to check for all the various "disconnect" messages within
+ the full exception hierarchy. Specifically the
+ "closed the connection unexpectedly" message has now been
+ seen in at least three different exception types.
+ Courtesy Eli Collins.
+
+ .. change::
+ :tags: bug, sql, mysql
+ :tickets: 2682
+
+ Fully implemented the IS and IS NOT operators with
+ regards to the True/False constants. An expression like
+ ``col.is_(True)`` will now render ``col IS true``
+ on the target platform, rather than converting the True/
+ False constant to an integer bound parameter.
+ This allows the ``is_()`` operator to work on MySQL when
+ given True/False constants.
+
+ .. change::
+ :tags: bug, postgresql
+ :tickets: 2681
+
+ The operators for the Postgresql ARRAY type supports
+ input types of sets, generators, etc. even when
+ a dimension is not specified, by turning the given
+ iterable into a collection unconditionally.
+
+ .. change::
+ :tags: bug, mysql
+ :pullreq: 55
+
+ Fixes to support the latest cymysql DBAPI, courtesy
+ Hajime Nakagami.
+
+ .. change::
+ :tags: bug, mysql
+ :tickets: 2663
+
+ Improvements to the operation of the pymysql dialect on
+ Python 3, including some important decode/bytes steps.
+ Issues remain with BLOB types due to driver issues.
+ Courtesy Ben Trofatter.
+
+ .. change::
+ :tags: bug, orm
+ :tickets: 2710
+
+ Fixed bug where many-to-many relationship with uselist=False
+ would fail to delete the association row and raise an error
+ if the scalar attribute were set to None. This was a
+ regression introduced by the changes for :ticket:`2229`.
+
+ .. change::
+ :tags: bug, orm
+ :tickets: 2708
+
+ Improved the behavior of instance management regarding
+ the creation of strong references within the Session;
+ an object will no longer have an internal reference cycle
+ created if it's in the transient state or moves into the
+ detached state - the strong ref is created only when the
+ object is attached to a Session and is removed when the
+ object is detached. This makes it somewhat safer for an
+ object to have a `__del__()` method, even though this is
+ not recommended, as relationships with backrefs produce
+ cycles too. A warning has been added when a class with
+ a `__del__()` method is mapped.
+
+ .. change::
+ :tags: bug, sql
+ :tickets: 2702
+
+ A major fix to the way in which a select() object produces
+ labeled columns when apply_labels() is used; this mode
+ produces a SELECT where each column is labeled as in
+ <tablename>_<columnname>, to remove column name collisions
+ for a multiple table select. The fix is that if two labels
+ collide when combined with the table name, i.e.
+ "foo.bar_id" and "foo_bar.id", anonymous aliasing will be
+ applied to one of the dupes. This allows the ORM to handle
+ both columns independently; previously, 0.7
+ would in some cases silently emit a second SELECT for the
+ column that was "duped", and in 0.8 an ambiguous column error
+ would be emitted. The "keys" applied to the .c. collection
+ of the select() will also be deduped, so that the "column
+ being replaced" warning will no longer emit for any select()
+ that specifies use_labels, though the dupe key will be given
+ an anonymous label which isn't generally user-friendly.
+
+ .. change::
+ :tags: bug, mysql
+ :pullreq: 54
+
+ Updated a regexp to correctly extract error code on
+ google app engine v1.7.5 and newer. Courtesy
+ Dan Ring.
+
+ .. change::
+ :tags: bug, examples
+
+ Fixed a long-standing bug in the caching example, where
+ the limit/offset parameter values wouldn't be taken into
+ account when computing the cache key. The
+ _key_from_query() function has been simplified to work
+ directly from the final compiled statement in order to get
+ at both the full statement as well as the fully processed
+ parameter list.
+
+ .. change::
+ :tags: bug, mssql
+ :tickets: 2355
+
+ Part of a longer series of fixes needed for pyodbc+
+ mssql, a CAST to NVARCHAR(max) has been added to the bound
+ parameter for the table name and schema name in all information schema
+ queries to avoid the issue of comparing NVARCHAR to NTEXT,
+ which seems to be rejected by the ODBC driver in some cases,
+ such as FreeTDS (0.91 only?) plus unicode bound parameters being passed.
+ The issue seems to be specific to the SQL Server information
+ schema tables and the workaround is harmless for those cases
+ where the problem doesn't exist in the first place.
+
+ .. change::
+ :tags: bug, sql
+ :tickets: 2691
+
+ Fixed bug where disconnect detect on error would
+ raise an attribute error if the error were being
+ raised after the Connection object had already
+ been closed.
+
+ .. change::
+ :tags: bug, sql
+ :tickets: 2703
+
+ Reworked internal exception raises that emit
+ a rollback() before re-raising, so that the stack
+ trace is preserved from sys.exc_info() before entering
+ the rollback. This so that the traceback is preserved
+ when using coroutine frameworks which may have switched
+ contexts before the rollback function returns.
+
+ .. change::
+ :tags: bug, orm
+ :tickets: 2697
+
+ Fixed bug whereby ORM would run the wrong kind of
+ query when refreshing an inheritance-mapped class
+ where the superclass was mapped to a non-Table
+ object, like a custom join() or a select(),
+ running a query that assumed a hierarchy that's
+ mapped to individual Table-per-class.
+
+ .. change::
+ :tags: bug, orm
+
+ Fixed `__repr__()` on mapper property constructs
+ to work before the object is initialized, so
+ that Sphinx builds with recent Sphinx versions
+ can read them.
+
+ .. change::
+ :tags: bug, sql, postgresql
+
+ The _Binary base type now converts values through
+ the bytes() callable when run on Python 3; in particular
+ psycopg2 2.5 with Python 3.3 seems to now be returning
+ the "memoryview" type, so this is converted to bytes
+ before return.
+
+ .. change::
+ :tags: bug, sql
+ :tickets: 2695
+
+ Improvements to Connection auto-invalidation
+ handling. If a non-disconnect error occurs,
+ but leads to a delayed disconnect error within error
+ handling (happens with MySQL), the disconnect condition
+ is detected. The Connection can now also be closed
+ when in an invalid state, meaning it will raise "closed"
+ on next usage, and additionally the "close with result"
+ feature will work even if the autorollback in an error
+ handling routine fails and regardless of whether the
+ condition is a disconnect or not.
+
+
+ .. change::
+ :tags: bug, orm, declarative
+ :tickets: 2656
+
+ Fixed indirect regression regarding :func:`.has_inherited_table`,
+ where since it considers the current class' ``__table__``, was
+ sensitive to when it was called. This is 0.7's behavior also,
+ but in 0.7 things tended to "work out" within events like
+ ``__mapper_args__()``. :func:`.has_inherited_table` now only
+ considers superclasses, so should return the same answer
+ regarding the current class no matter when it's called
+ (obviously assuming the state of the superclass).
+
+ .. change::
+ :tags: bug, orm
+ :tickets: 2699
+
+ Fixed bug when a query of the form:
+ ``query(SubClass).options(subqueryload(Baseclass.attrname))``,
+ where ``SubClass`` is a joined inh of ``BaseClass``,
+ would fail to apply the ``JOIN`` inside the subquery
+ on the attribute load, producing a cartesian product.
+ The populated results still tended to be correct as additional
+ rows are just ignored, so this issue may be present as a
+ performance degradation in applications that are
+ otherwise working correctly. Also in 0.7.11.
+
+ .. change::
+ :tags: bug, orm
+ :tickets: 2689
+
+ Fixed bug in unit of work whereby a joined-inheritance
+ subclass could insert the row for the "sub" table
+ before the parent table, if the two tables had no
+ ForeignKey constraints set up between them.
+ Also in 0.7.11.
.. change::
:tags: bug, mssql