1=============
21.1 Changelog
3=============
4
5.. changelog_imports::
6
7    .. include:: changelog_10.rst
8        :start-line: 5
9
10    .. include:: changelog_09.rst
11        :start-line: 5
12
13    .. include:: changelog_08.rst
14        :start-line: 5
15
16    .. include:: changelog_07.rst
17        :start-line: 5
18
19
20.. changelog::
21    :version: 1.1.19
22    :include_notes_from: unreleased_11
23
24.. changelog::
25    :version: 1.1.18
26    :released: March 6, 2018
27
28    .. change::
29        :tags: bug, mysql
30        :tickets: 4205
31        :versions: 1.2.5
32
33        MySQL dialects now query the server version using ``SELECT @@version``
34        explicitly to the server to ensure we are getting the correct version
35        information back.   Proxy servers like MaxScale interfere with the value
36        that is passed to the DBAPI's connection.server_version value so this
37        is no longer reliable.
38
39    .. change::
40        :tags: bug, postgresql, py3k
41        :tickets: 4208
42        :versions: 1.2.5
43
44        Fixed bug in PostgreSQL COLLATE / ARRAY adjustment first introduced
45        in :ticket:`4006` where new behaviors in Python 3.7 regular expressions
46        caused the fix to fail.
47
48.. changelog::
49    :version: 1.1.17
50    :released: February 22, 2018
51
52    .. change::
53        :tags: bug, ext
54        :tickets: 4185
55
56        Repaired regression caused in 1.2.3 and 1.1.16 regarding association proxy
57        objects, revising the approach to :ticket:`4185` when calculating the
58        "owning class" of an association proxy to default to choosing the current
59        class if the proxy object is not directly associated with a mapped class,
60        such as a mixin.
61
62.. changelog::
63    :version: 1.1.16
64    :released: February 16, 2018
65
66    .. change::
67        :tags: bug, postgresql
68        :versions: 1.2.3
69
70        Added "SSL SYSCALL error: Operation timed out" to the list
71        of messages that trigger a "disconnect" scenario for the
72        psycopg2 driver.  Pull request courtesy André Cruz.
73
74    .. change::
75        :tags: bug, orm
76        :tickets: 4187
77        :versions: 1.2.3
78
79        Fixed issue in post_update feature where an UPDATE is emitted
80        when the parent object has been deleted but the dependent object
81        is not.   This issue has existed for a long time however
82        since 1.2 now asserts rows matched for post_update, this
83        was raising an error.
84
85    .. change::
86        :tags: bug, mysql
87        :tickets: 4136
88        :versions: 1.2.0b4
89
90        Fixed bug where the MySQL "concat" and "match" operators failed to
91        propagate kwargs to the left and right expressions, causing compiler
92        options such as "literal_binds" to fail.
93
94    .. change::
95        :tags: bug, sql
96        :versions: 1.2.0b4
97
98        Added :func:`.nullsfirst` and :func:`.nullslast` as top level imports
99        in the ``sqlalchemy.`` and ``sqlalchemy.sql.`` namespace.  Pull request
100        courtesy Lele Gaifax.
101
102    .. change::
103        :tags: bug, orm
104        :tickets: 4185
105        :versions: 1.2.3
106
107        Fixed regression caused by fix for issue :ticket:`4116` affecting versions
108        1.2.2 as well as 1.1.15, which had the effect of mis-calculation of the
109        "owning class" of an :class:`.AssociationProxy` as the ``NoneType`` class
110        in some declarative mixin/inheritance situations as well as if the
111        association proxy were accessed off of an un-mapped class.  The "figure out
112        the owner" logic has been replaced by an in-depth routine that searches
113        through the complete mapper hierarchy assigned to the class or subclass to
114        determine the correct (we hope) match; will not assign the owner if no
115        match is found.  An exception is now raised if the proxy is used
116        against an un-mapped instance.
117
118
119    .. change::
120        :tags: bug, sql
121        :tickets: 4162
122        :versions: 1.2.1
123
124        Fixed bug in :meth:`.Insert.values` where using the "multi-values"
125        format in combination with :class:`.Column` objects as keys rather
126        than strings would fail.   Pull request courtesy Aubrey Stark-Toller.
127
128    .. change::
129        :tags: bug, postgresql
130        :versions: 1.2.3
131
132        Added "TRUNCATE" to the list of keywords accepted by the
133        PostgreSQL dialect as an "autocommit"-triggering keyword.
134        Pull request courtesy Jacob Hayes.
135
136    .. change::
137        :tags: bug, pool
138        :tickets: 4184
139        :versions: 1.2.3
140
141        Fixed a fairly serious connection pool bug where a connection that is
142        acquired after being refreshed as a result of a user-defined
143        :class:`.DisconnectionError` or due to the 1.2-released "pre_ping" feature
144        would not be correctly reset if the connection were returned to the pool by
145        weakref cleanup (e.g. the front-facing object is garbage collected); the
146        weakref would still refer to the previously invalidated DBAPI connection
147        which would have the reset operation erroneously called upon it instead.
148        This would lead to stack traces in the logs and a connection being checked
149        into the pool without being reset, which can cause locking issues.
150
151
152    .. change::
153        :tags: bug, orm
154        :tickets: 4151
155        :versions: 1.2.1
156
157        Fixed bug where an object that is expunged during a rollback of
158        a nested or subtransaction which also had its primary key mutated
159        would not be correctly removed from the session, causing subsequent
160        issues in using the session.
161
162.. changelog::
163    :version: 1.1.15
164    :released: November 3, 2017
165
166    .. change:
167        :tags: bug, sqlite
168        :tickets: 4099
169        :versions: 1.2.0b3
170
171        Fixed bug where SQLite CHECK constraint reflection would fail
172        if the referenced table were in a remote schema, e.g. on SQLite a
173        remote database referred to by ATTACH.
174
175    .. change::
176        :tags: bug, mysql
177        :tickets: 4097
178        :versions: 1.2.0b3
179
180        Warning emitted when MariaDB 10.2.8 or earlier in the 10.2
181        series is detected as there are major issues with CHECK
182        constraints within these versions that were resolved as of
183        10.2.9.
184
185        Note that this changelog message was NOT released with
186        SQLAlchemy 1.2.0b3 and was added retroactively.
187
188    .. change::
189        :tags: bug, mssql
190        :tickets: 4095
191        :versions: 1.2.0b3
192
193        Added a full range of "connection closed" exception codes to the
194        PyODBC dialect for SQL Server, including '08S01', '01002', '08003',
195        '08007', '08S02', '08001', 'HYT00', 'HY010'.  Previously, only '08S01'
196        was covered.
197
198    .. change::
199        :tags: bug, sql
200        :tickets: 4126
201        :versions: 1.2.0
202
203        Fixed bug where ``__repr__`` of :class:`.ColumnDefault` would fail
204        if the argument were a tuple.  Pull request courtesy Nicolas Caniart.
205
206    .. change::
207        :tags: bug, orm, declarative
208        :tickets: 4124
209        :versions: 1.2.0
210
211        Fixed bug where a descriptor that is elsewhere a mapped column
212        or relationship within a hierarchy based on :class:`.AbstractConcreteBase`
213        would be referred towards during a refresh operation, causing an error
214        as the attribute is not mapped as a mapper property.
215        A similar issue can arise for other attributes like the "type" column
216        added by :class:`.AbstractConcreteBase` if the class fails to include
217        "concrete=True" in its mapper, however the check here should also
218        prevent that scenario from causing a problem.
219
220    .. change:: 4006
221        :tags: bug, postgresql
222        :tickets: 4006
223        :versions: 1.2.0b3
224
225        Made further fixes to the :class:`.ARRAY` class in conjunction with
226        COLLATE, as the fix made in :ticket:`4006` failed to accommodate
227        for a multidimensional array.
228
229    .. change::
230        :tags: bug, orm, ext
231        :tickets: 4116
232        :versions: 1.2.0
233
234        Fixed bug where the association proxy would inadvertently link itself
235        to an :class:`.AliasedClass` object if it were called first with
236        the :class:`.AliasedClass` as a parent, causing errors upon subsequent
237        usage.
238
239    .. change::
240        :tags: bug, mysql
241        :tickets: 4120
242        :versions: 1.2.0
243
244        MySQL 5.7.20 now warns for use of the @tx_isolation variable; a version
245        check is now performed and uses @transaction_isolation instead
246        to prevent this warning.
247
248    .. change::
249        :tags: bug, postgresql
250        :tickets: 4107
251        :versions: 1.2.0b3
252
253        Fixed bug in :obj:`.array_agg` function where passing an argument
254        that is already of type :class:`.ARRAY`, such as a PostgreSQL
255        :obj:`.postgresql.array` construct, would produce a ``ValueError``, due
256        to the function attempting to nest the arrays.
257
258    .. change::
259        :tags: bug, orm
260        :tickets: 4078
261        :versions: 1.2.0b3
262
263        Fixed bug where ORM relationship would warn against conflicting sync
264        targets (e.g. two relationships would both write to the same column) for
265        sibling classes in an inheritance hierarchy, where the two relationships
266        would never actually conflict during writes.
267
268    .. change::
269        :tags: bug, postgresql
270        :tickets: 4074
271        :versions: 1.2.0b3
272
273        Fixed bug in PostgreSQL :meth:`.postgresql.dml.Insert.on_conflict_do_update`
274        which would prevent the insert statement from being used as a CTE,
275        e.g. via :meth:`.Insert.cte`, within another statement.
276
277    .. change::
278        :tags: bug, orm
279        :tickets: 4103
280        :versions: 1.2.0b3
281
282        Fixed bug where correlated select used against single-table inheritance
283        entity would fail to render correctly in the outer query, due to adjustment
284        for single inheritance discriminator criteria inappropriately re-applying
285        the criteria to the outer query.
286
287    .. change:
288        :tags: bug, mysql
289        :tickets: 4096
290        :versions: 1.2.0b3
291
292        Fixed issue where CURRENT_TIMESTAMP would not reflect correctly
293        in the MariaDB 10.2 series due to a syntax change, where the function
294        is now represented as ``current_timestamp()``.
295
296    .. change:
297        :tags: bug, mysql
298        :tickets: 4098
299        :versions: 1.2.0b3
300
301        MariaDB 10.2 now supports CHECK constraints (warning: use version 10.2.9
302        or greater due to upstream issues noted in :ticket:`4097`).  Reflection
303        now takes these CHECK constraints into account when they are present in
304        the ``SHOW CREATE TABLE`` output.
305
306    .. change::
307        :tags: bug, sql
308        :tickets: 4093
309        :versions: 1.2.0b3
310
311        Fixed bug where the recently added :meth:`.ColumnOperators.any_`
312        and :meth:`.ColumnOperators.all_` methods didn't work when called
313        as methods, as opposed to using the standalone functions
314        :func:`~.expression.any_` and :func:`~.expression.all_`.  Also
315        added documentation examples for these relatively unintuitive
316        SQL operators.
317
318.. changelog::
319    :version: 1.1.14
320    :released: September 5, 2017
321
322    .. change::
323        :tags: bug, orm
324        :tickets: 4069
325        :versions: 1.2.0b3
326
327        Fixed bug in :meth:`.Session.merge` following along similar lines as that
328        of :ticket:`4030`, where an internal check for a target object in
329        the identity map could lead to an error if it were to be garbage collected
330        immediately before the merge routine actually retrieves the object.
331
332    .. change::
333        :tags: bug, orm
334        :tickets: 4048
335        :versions: 1.2.0b3
336
337        Fixed bug where an :func:`.undefer_group` option would not be recognized
338        if it extended from a relationship that was loading using joined eager
339        loading.  Additionally, as the bug led to excess work being performed,
340        Python function call counts are also improved by 20% within the initial
341        calculation of result set columns, complementing the joined eager load
342        improvements of :ticket:`3915`.
343
344    .. change::
345        :tags: bug, orm
346        :tickets: 4068
347
348        Fixed race condition in ORM identity map which would cause objects
349        to be inappropriately removed during a load operation, causing
350        duplicate object identities to occur, particularly under joined eager
351        loading which involves deduplication of objects.  The issue is specific
352        to garbage collection of weak references and is observed only under the
353        PyPy interpreter.
354
355    .. change::
356        :tags: bug, orm
357        :tickets: 4056
358        :versions: 1.2.0b3
359
360        Fixed bug in :meth:`.Session.merge` where objects in a collection that had
361        the primary key attribute set to ``None`` for a key that is  typically
362        autoincrementing would be considered to be a database-persisted key for
363        part of the internal deduplication process, causing only one object to
364        actually be inserted in the database.
365
366    .. change::
367        :tags: bug, sql
368        :tickets: 4053
369
370        Altered the range specification for window functions to allow
371        for two of the same PRECEDING or FOLLOWING keywords in a range
372        by allowing for the left side of the range to be positive
373        and for the right to be negative, e.g. (1, 3) is
374        "1 FOLLOWING AND 3 FOLLOWING".
375
376    .. change::
377        :tags: bug, orm
378        :tickets: 4067
379        :versions: 1.2.0b3
380
381        An :class:`.InvalidRequestError` is raised when a :func:`.synonym`
382        is used against an attribute that is not against a :class:`.MapperProperty`,
383        such as an association proxy.  Previously, a recursion overflow would
384        occur trying to locate non-existent attributes.
385
386.. changelog::
387    :version: 1.1.13
388    :released: August 3, 2017
389
390.. changelog::
391    :version: 1.1.12
392    :released: July 24, 2017
393
394    .. change:: cache_order_sequence
395        :tags: feature, oracle, postgresql
396        :versions: 1.2.0b1
397
398        Added new keywords :paramref:`.Sequence.cache` and
399        :paramref:`.Sequence.order` to :class:`.Sequence`, to allow rendering
400        of the CACHE parameter understood by Oracle and PostgreSQL, and the
401        ORDER parameter understood by Oracle.  Pull request
402        courtesy David Moore.
403
404
405    .. change:: 4033
406        :tags: bug, orm
407        :tickets: 4033
408        :versions: 1.2.0b2
409
410        Fixed regression from 1.1.11 where adding additional non-entity
411        columns to a query that includes an entity with subqueryload
412        relationships would fail, due to an inspection added in 1.1.11 as a
413        result of :ticket:`4011`.
414
415
416    .. change:: 4031
417        :tags: bug, orm
418        :versions: 1.2.0b2
419        :tickets: 4031
420
421        Fixed bug involving JSON NULL evaluation logic added in 1.1 as part
422        of :ticket:`3514` where the logic would not accommodate ORM
423        mapped attributes named differently from the :class:`.Column`
424        that was mapped.
425
426    .. change:: 4030
427        :tags: bug, orm
428        :versions: 1.2.0b2
429        :tickets: 4030
430
431        Added ``KeyError`` checks to all methods within
432        :class:`.WeakInstanceDict` where a check for ``key in dict`` is
433        followed by indexed access to that key, to guard against a race against
434        garbage collection that under load can remove the key from the dict
435        after the code assumes its present, leading to very infrequent
436        ``KeyError`` raises.
437
438.. changelog::
439    :version: 1.1.11
440    :released: Monday, June 19, 2017
441
442    .. change:: 4012
443        :tags: bug, sql
444        :tickets: 4012
445        :versions: 1.2.0b1
446
447        Fixed AttributeError which would occur in :class:`.WithinGroup`
448        construct during an iteration of the structure.
449
450    .. change:: 4011
451        :tags: bug, orm
452        :tickets: 4011
453        :versions: 1.2.0b1
454
455        Fixed issue with subquery eagerloading which continues on from
456        the series of issues fixed in :ticket:`2699`, :ticket:`3106`,
457        :ticket:`3893` involving that the "subquery" contains the correct
458        FROM clause when beginning from a joined inheritance subclass
459        and then subquery eager loading onto a relationship from
460        the base class, while the query also includes criteria against
461        the subclass. The fix in the previous tickets did not accommodate
462        for additional subqueryload operations loading more deeply from
463        the first level, so the fix has been further generalized.
464
465    .. change:: 4005
466        :tags: bug, postgresql
467        :tickets: 4005
468        :versions: 1.2.0b1
469
470        Continuing with the fix that correctly handles PostgreSQL
471        version string "10devel" released in 1.1.8, an additional regexp
472        bump to handle version strings of the form "10beta1".   While
473        PostgreSQL now offers better ways to get this information, we
474        are sticking w/ the regexp at least through 1.1.x for the least
475        amount of risk to compatibility w/ older or alternate PostgreSQL
476        databases.
477
478    .. change:: 4006
479        :tags: bug, postgresql
480        :tickets: 4006
481        :versions: 1.2.0b1
482
483        Fixed bug where using :class:`.ARRAY` with a string type that
484        features a collation would fail to produce the correct syntax
485        within CREATE TABLE.
486
487    .. change:: 4007
488        :tags: bug, mysql
489        :tickets: 4007
490        :versions: 1.2.0b1
491
492        MySQL 5.7 has introduced permission limiting for the "SHOW VARIABLES"
493        command; the MySQL dialect will now handle when SHOW returns no
494        row, in particular for the initial fetch of SQL_MODE, and will
495        emit a warning that user permissions should be modified to allow the
496        row to be present.
497
498    .. change:: 3994
499        :tags: bug, mssql
500        :tickets: 3994
501        :versions: 1.2.0b1
502
503        Fixed bug where SQL Server transaction isolation must be fetched
504        from a different view when using Azure data warehouse, the query
505        is now attempted against both views and then a NotImplemented
506        is raised unconditionally if failure continues to provide the
507        best resiliency against future arbitrary API changes in new
508        SQL Server versions.
509
510    .. change:: 3997
511        :tags: bug, oracle
512        :tickets: 3997
513        :versions: 1.2.0b1
514
515        Support for two-phase transactions has been removed entirely for
516        cx_Oracle when version 6.0b1 or later of the DBAPI is in use.  The two-
517        phase feature historically has never been usable under cx_Oracle 5.x in
518        any case, and cx_Oracle 6.x has removed the connection-level "twophase"
519        flag upon which this feature relied.
520
521    .. change:: 3973
522        :tags: bug, mssql
523        :tickets: 3973
524        :versions: 1.2.0b1
525
526        Added a placeholder type :class:`.mssql.XML` to the SQL Server
527        dialect, so that a reflected table which includes this type can
528        be re-rendered as a CREATE TABLE.  The type has no special round-trip
529        behavior nor does it currently support additional qualifying
530        arguments.
531
532.. changelog::
533    :version: 1.1.10
534    :released: Friday, May 19, 2017
535
536    .. change:: 3986
537        :tags: bug, orm
538        :versions: 1.2.0b1
539        :tickets: 3986
540
541        Fixed bug where a cascade such as "delete-orphan" (but others as well)
542        would fail to locate an object linked to a relationship that itself
543        is local to a subclass in an inheritance relationship, thus causing
544        the operation to not take place.
545
546    .. change:: 3975
547        :tags: bug, oracle
548        :versions: 1.2.0b1
549        :tickets: 3975
550
551        Fixed bug in cx_Oracle dialect where version string parsing would
552        fail for cx_Oracle version 6.0b1 due to the "b" character.  Version
553        string parsing is now via a regexp rather than a simple split.
554
555    .. change:: 3949
556        :tags: bug, schema
557        :versions: 1.2.0b1
558        :tickets: 3949
559
560        An :class:`.ArgumentError` is now raised if a
561        :class:`.ForeignKeyConstraint` object is created with a mismatched
562        number of "local" and "remote" columns, which otherwise causes the
563        internal state of the constraint to be incorrect.   Note that this
564        also impacts the condition where a dialect's reflection process
565        produces a mismatched set of columns for a foreign key constraint.
566
567    .. change:: 3980
568        :tags: bug, ext
569        :versions: 1.2.0b1
570        :tickets: 3980
571
572        Protected against testing "None" as a class in the case where
573        declarative classes are being garbage collected and new
574        automap prepare() operations are taking place concurrently, very
575        infrequently hitting a weakref that has not been fully acted upon
576        after gc.
577
578    .. change::
579        :tags: bug, postgresql
580        :versions: 1.2.0b1
581
582        Added "autocommit" support for GRANT, REVOKE keywords.  Pull request
583        courtesy Jacob Hayes.
584
585    .. change:: 3966
586        :tags: bug, mysql
587        :versions: 1.2.0b1
588        :tickets: 3966
589
590        Removed an ancient and unnecessary intercept of the UTC_TIMESTAMP
591        MySQL function, which was getting in the way of using it with a
592        parameter.
593
594    .. change:: 3961
595        :tags: bug, mysql
596        :versions: 1.2.0b1
597        :tickets: 3961
598
599        Fixed bug in MySQL dialect regarding rendering of table options in
600        conjunction with PARTITION options when rendering CREATE TABLE.
601        The PARTITION related options need to follow the table options,
602        whereas previously this ordering was not enforced.
603
604
605.. changelog::
606    :version: 1.1.9
607    :released: April 4, 2017
608
609    .. change:: 3956
610        :tags: bug, ext
611        :tickets: 3956
612
613        Fixed regression released in 1.1.8 due to :ticket:`3950` where the
614        deeper search for information about column types in the case of a
615        "schema type" or a :class:`.TypeDecorator` would produce an attribute
616        error if the mapping also contained a :obj:`.column_property`.
617
618    .. change:: 3952
619        :tags: bug, sql
620        :versions: 1.2.0b1
621        :tickets: 3952
622
623        Fixed regression released in 1.1.5 due to :ticket:`3859` where
624        adjustments to the "right-hand-side" evaluation of an expression
625        based on :class:`.Variant` to honor the underlying type's
626        "right-hand-side" rules caused the :class:`.Variant` type
627        to be inappropriately lost, in those cases when we *do* want the
628        left-hand side type to be transferred directly to the right hand side
629        so that bind-level rules can be applied to the expression's argument.
630
631    .. change:: 3955
632        :tags: bug, sql, postgresql
633        :versions: 1.2.0b1
634        :tickets: 3955
635
636        Changed the mechanics of :class:`.ResultProxy` to unconditionally
637        delay the "autoclose" step until the :class:`.Connection` is done
638        with the object; in the case where PostgreSQL ON CONFLICT with
639        RETURNING returns no rows, autoclose was occurring in this previously
640        non-existent use case, causing the usual autocommit behavior that
641        occurs unconditionally upon INSERT/UPDATE/DELETE to fail.
642
643.. changelog::
644    :version: 1.1.8
645    :released: March 31, 2017
646
647    .. change:: 3950
648        :tags: bug, ext
649        :versions: 1.2.0b1
650        :tickets: 3950
651
652        Fixed bug in :mod:`sqlalchemy.ext.mutable` where the
653        :meth:`.Mutable.as_mutable` method would not track a type that had
654        been copied using :meth:`.TypeEngine.copy`.  This became more of
655        a regression in 1.1 compared to 1.0 because the :class:`.TypeDecorator`
656        class is now a subclass of :class:`.SchemaEventTarget`, which among
657        other things indicates to the parent :class:`.Column` that the type
658        should be copied when the :class:`.Column` is.  These copies are
659        common when using declarative with mixins or abstract classes.
660
661    .. change::
662        :tags: bug, ext
663        :versions: 1.2.0b1
664
665        Added support for bound parameters, e.g. those normally set up
666        via :meth:`.Query.params`, to the :meth:`.baked.Result.count`
667        method.  Previously, support for parameters were omitted. Pull request
668        courtesy Pat Deegan.
669
670    .. change::
671        :tags: bug, postgresql
672        :versions: 1.2.0b1
673
674        Added support for parsing the PostgreSQL version string for
675        a development version like "PostgreSQL 10devel".  Pull request
676        courtesy Sean McCully.
677
678.. changelog::
679    :version: 1.1.7
680    :released: March 27, 2017
681
682    .. change::
683        :tags: feature, orm
684        :tickets: 3933
685        :versions: 1.2.0b1
686
687        An :func:`.aliased()` construct can now be passed to the
688        :meth:`.Query.select_entity_from` method.   Entities will be pulled
689        from the selectable represented by the :func:`.aliased` construct.
690        This allows special options for :func:`.aliased` such as
691        :paramref:`.aliased.adapt_on_names` to be used in conjunction with
692        :meth:`.Query.select_entity_from`.
693
694    .. change::
695        :tags: bug, engine
696        :tickets: 3946
697        :versions: 1.2.0b1
698
699        Added an exception handler that will warn for the "cause" exception on
700        Py2K when the "autorollback" feature of :class:`.Connection` itself
701        raises an exception. In Py3K, the two exceptions are naturally reported
702        by the interpreter as one occurring during the handling of the other.
703        This is continuing with the series of changes for rollback failure
704        handling that were last visited as part of :ticket:`2696` in 1.0.12.
705
706    .. change::
707        :tags: bug, orm
708        :tickets: 3947
709        :versions: 1.2.0b1
710
711        Fixed a race condition which could occur under threaded environments
712        as a result of the caching added via :ticket:`3915`.   An internal
713        collection of ``Column`` objects could be regenerated on an alias
714        object inappropriately, confusing a joined eager loader when it
715        attempts to render SQL and collect results and resulting in an
716        attribute error.   The collection is now generated up front before
717        the alias object is cached and shared among threads.
718
719    .. change::
720        :tags: bug, sql, postgresql
721        :tickets: 2892
722
723        Added support for the :class:`.Variant` and the :class:`.SchemaType`
724        objects to be compatible with each other.  That is, a variant
725        can be created against a type like :class:`.Enum`, and the instructions
726        to create constraints and/or database-specific type objects will
727        propagate correctly as per the variant's dialect mapping.
728
729    .. change::
730        :tags: bug, sql
731        :tickets: 3931
732
733        Fixed bug in compiler where the string identifier of a savepoint would
734        be cached in the identifier quoting dictionary; as these identifiers
735        are arbitrary, a small memory leak could occur if a single
736        :class:`.Connection` had an unbounded number of savepoints used,
737        as well as if the savepoint clause constructs were used directly
738        with an unbounded umber of savepoint names.   The memory leak does
739        **not** impact the vast majority of cases as normally the
740        :class:`.Connection`, which renders savepoint names with a simple
741        counter starting at "1", is used on a per-transaction or
742        per-fixed-number-of-transactions basis before being discarded.
743
744    .. change::
745        :tags: bug, sql
746        :tickets: 3924
747
748        Fixed bug in new "schema translate" feature where the translated schema
749        name would be invoked in terms of an alias name when rendered along
750        with a column expression; occurred only when the source translate
751        name was "None".   The "schema translate" feature now only takes
752        effect for :class:`.SchemaItem` and :class:`.SchemaType` subclasses,
753        that is, objects that correspond to a DDL-creatable structure in
754        a database.
755
756.. changelog::
757    :version: 1.1.6
758    :released: February 28, 2017
759
760    .. change::
761        :tags: bug, mysql
762
763        Added new MySQL 8.0 reserved words to the MySQL dialect for proper
764        quoting.  Pull request courtesy Hanno Schlichting.
765
766    .. change:: 3915
767        :tags: bug, orm
768        :tickets: 3915
769
770        Addressed some long unattended performance concerns within the joined
771        eager loader query construction system that have accumulated since
772        earlier versions as a result of increased abstraction. The use of ad-
773        hoc :class:`.AliasedClass` objects per query, which produces lots of
774        column lookup overhead each time, has been replaced with a cached
775        approach that makes use of a small pool of :class:`.AliasedClass`
776        objects that are reused between invocations of joined eager loading.
777        Some mechanics involving eager join path construction have also been
778        optimized.   Callcounts for an end-to-end query construction + single
779        row fetch test with a worst-case joined loader scenario have been
780        reduced by about 60% vs. 1.1.5 and 42% vs. that of 0.8.6.
781
782    .. change:: 3804
783        :tags: bug, postgresql
784        :tickets: 3804
785
786        Added regular expressions for the "IMPORT FOREIGN SCHEMA",
787        "REFRESH MATERIALIZED VIEW" PostgreSQL statements so that they
788        autocommit when invoked via a connection or engine without
789        an explicit transaction.  Pull requests courtesy Frazer McLean
790        and Paweł Stiasny.
791
792    .. change:: 3909
793        :tags: bug, orm
794        :tickets: 3909
795
796        Fixed a major inefficiency in the "eager_defaults" feature whereby
797        an unnecessary SELECT would be emitted for column values where the
798        ORM had explicitly inserted NULL, corresponding to attributes that
799        were unset on the object but did not have any server default
800        specified, as well as expired attributes on update that nevertheless
801        had no server onupdate set up.   As these columns are not part of the
802        RETURNING that eager_defaults tries to use, they should not be
803        post-SELECTed either.
804
805    .. change:: 3908
806        :tags: bug, orm
807        :tickets: 3908
808
809        Fixed two closely related bugs involving the mapper eager_defaults
810        flag in conjunction with single-table inheritance; one where the
811        eager defaults logic would inadvertently try to access a column
812        that's part of the mapper's "exclude_properties" list (used by
813        Declarative with single table inheritance) during the eager defaults
814        fetch, and the other where the full load of the row in order to
815        fetch the defaults would fail to use the correct inheriting mapper.
816
817
818    .. change:: 3905
819        :tags: bug, sql
820        :tickets: 3905
821
822        Fixed bug whereby the :meth:`.DDLEvents.column_reflect` event would not
823        allow a non-textual expression to be passed as the value of the
824        "default" for the new column, such as a :class:`.FetchedValue`
825        object to indicate a generic triggered default or a
826        :func:`.sql.expression.text` construct.  Clarified the documentation
827        in this regard as well.
828
829    .. change:: 3901
830        :tags: bug, ext
831        :tickets: 3901
832
833        Fixed bug in new :mod:`sqlalchemy.ext.indexable` extension
834        where setting of a property that itself refers to another property
835        would fail.
836
837    .. change:: 3900
838        :tags: bug, postgresql
839        :tickets: 3900
840
841        Fixed bug in PostgreSQL :class:`.ExcludeConstraint` where the
842        "whereclause" and "using" parameters would not be copied during an
843        operation like :meth:`.Table.tometadata`.
844
845    .. change:: 3898
846        :tags: bug, mssql
847        :tickets: 3898
848
849        Added a version check to the "get_isolation_level" feature, which is
850        invoked upon first connect, so that it skips for SQL Server version
851        2000, as the necessary system view is not available prior to SQL Server
852        2005.
853
854    .. change:: 3897
855        :tags: feature, ext
856        :tickets: 3896
857
858        Added :meth:`.baked.Result.scalar` and :meth:`.baked.Result.count`
859        to the "baked" query system.
860
861    .. change:: 3895
862        :tags: bug, orm, declarative
863        :tickets: 3895
864
865        Fixed bug where the "automatic exclude" feature of declarative that
866        ensures a column local to a single table inheritance subclass does
867        not appear as an attribute on other derivations of the base would
868        not take effect for multiple levels of subclassing from the base.
869
870    .. change:: 3893
871        :tags: bug, orm
872        :tickets: 3893
873
874        Fixed bug first introduced in 0.9.7 as a result of :ticket:`3106`
875        which would cause an incorrect query in some forms of multi-level
876        subqueryload against aliased entities, with an unnecessary extra
877        FROM entity in the innermost subquery.
878
879.. changelog::
880    :version: 1.1.5
881    :released: January 17, 2017
882
883    .. change:: mysql_index_prefix
884        :tags: feature, mysql
885
886        Added a new parameter ``mysql_prefix`` supported by the :class:`.Index`
887        construct, allows specification of MySQL-specific prefixes such as
888        "FULLTEXT". Pull request courtesy Joseph Schorr.
889
890    .. change:: 3854
891        :tags: bug, orm
892        :tickets: 3854
893
894        Fixed bug in subquery loading where an object encountered as an
895        "existing" row, e.g. already loaded from a different path in the
896        same query, would not invoke subquery loaders for unloaded attributes
897        that specified this loading.  This issue is in the same area
898        as that of :ticket:`3431`, :ticket:`3811` which involved
899        similar issues with joined loading.
900
901    .. change:: 3888
902        :tags: bug, postgresql
903        :tickets: 3888
904
905        Fixed bug in new "ON CONFLICT DO UPDATE" feature where the "set"
906        values for the UPDATE clause would not be subject to type-level
907        processing, as normally takes effect to handle both user-defined
908        type level conversions as well as dialect-required conversions, such
909        as those required for JSON datatypes.   Additionally, clarified that
910        the keys in the ``set_`` dictionary should match the "key" of the
911        column, if distinct from the column name.  A warning is emitted
912        for remaining column names that don't match column keys; for
913        compatibility reasons, these are emitted as they were previously.
914
915    .. change:: 3872
916        :tags: bug, examples
917        :tickets: 3872
918
919        Fixed two issues with the versioned_history example, one is that
920        the history table now gets autoincrement=False to avoid 1.1's new
921        errors regarding composite primary keys with autoincrement; the other
922        is that the sqlite_autoincrement flag is now used to ensure on SQLite,
923        unique identifiers are used for the lifespan of a table even if
924        some rows are deleted.  Pull request courtesy Carlos García Montoro.
925
926    .. change:: 3882
927        :tags: bug, sql
928        :tikets: 3882
929
930        Fixed bug originally introduced in 0.9 via :ticket:`1068` where
931        order_by(<some Label()>) would order by the label name based on name
932        alone, that is, even if the labeled expression were not at all the same
933        expression otherwise present, implicitly or explicitly, in the
934        selectable.  The logic that orders by label now ensures that the
935        labeled expression is related to the one that resolves to that name
936        before ordering by the label name; additionally, the name has to
937        resolve to an actual label explicit in the expression elsewhere, not
938        just a column name.  This logic is carefully kept separate from the
939        order by(textual name) feature that has a slightly different purpose.
940
941    .. change:: try_finally_for_noautoflush
942        :tags: bug, orm
943
944        The :attr:`.Session.no_autoflush` context manager now ensures that
945        the autoflush flag is reset within a "finally" block, so that if
946        an exception is raised within the block, the state still resets
947        appropriately.  Pull request courtesy Emin Arakelian.
948
949    .. change:: 3878
950        :tags: bug, sql
951        :tickets: 3878
952
953        Fixed 1.1 regression where "import *" would not work for
954        sqlalchemy.sql.expression, due to mis-spelled ``any_`` and ``all_``
955        functions.
956
957    .. change:: 3880
958        :tags: bg, sql
959        :tickets: 3880
960
961        Fixed bug where literal_binds compiler flag was not honored by the
962        :class:`.Insert` construct for the "multiple values" feature; the
963        subsequent values are now rendered as literals.
964
965    .. change:: 3877
966        :tags: bug, oracle, postgresql
967        :tickets: 3877
968
969        Fixed bug where an INSERT from SELECT where the source table contains
970        an autoincrementing Sequence would fail to compile correctly.
971
972    .. change:: 3876
973        :tags: bug, mssql
974        :tickets: 3876
975
976        Fixed bug where SQL Server dialects would attempt to select the
977        last row identity for an INSERT from SELECT, failing in the case when
978        the SELECT has no rows.  For such a statement,
979        the inline flag is set to True indicating no last primary key
980        should be fetched.
981
982    .. change:: 3875
983        :tags: bug, oracle
984        :tickets: 3875
985
986        Fixed bug where the "COMPRESSION" keyword was used in the ALL_TABLES
987        query on Oracle 9.2; even though Oracle docs state table compression
988        was introduced in 9i, the actual column is not present until
989        10.1.
990
991    .. change:: 3874
992        :tags: bug, orm
993        :tickets: 3874
994
995        Fixed bug where the single-table inheritance query criteria would not
996        be inserted into the query in the case that the :class:`.Bundle`
997        construct were used as the selection criteria.
998
999    .. change:: repr_for_url_reflect
1000        :tags: bug, sql
1001
1002        The engine URL embedded in the exception for "could not reflect"
1003        in :meth:`.MetaData.reflect` now conceals the password; also
1004        the ``__repr__`` for :class:`.TLEngine` now acts like that of
1005        :class:`.Engine`, concealing the URL password.  Pull request courtesy
1006        Valery Yundin.
1007
1008    .. change:: 3867
1009        :tags: bug, mysql
1010        :tickets: 3867
1011
1012        The MySQL dialect now will not warn when a reflected column has a
1013        "COMMENT" keyword on it, but note however the comment is not yet
1014        reflected; this is on the roadmap for a future release.  Pull request
1015        courtesy Lele Long.
1016
1017    .. change:: pg_timestamp_zero_prec
1018        :tags: bug, postgresql
1019
1020        The :class:`.postgresql.TIME` and :class:`.postgresql.TIMESTAMP`
1021        datatypes now support a setting of zero for "precision"; previously
1022        a zero would be ignored.  Pull request courtesy Ionuț Ciocîrlan.
1023
1024    .. change:: 3861
1025        :tags: bug, engine
1026        :tickets: 3861
1027
1028        The "extend_existing" option of :class:`.Table` reflection would
1029        cause indexes and constraints to be doubled up in the case that the parameter
1030        were used with :meth:`.MetaData.reflect` (as the automap extension does)
1031        due to tables being reflected both within the foreign key path as well
1032        as directly.  A new de-duplicating set is passed through within the
1033        :meth:`.MetaData.reflect` sequence to prevent double reflection in this
1034        way.
1035
1036    .. change:: 3859
1037        :tags: bug, sql
1038        :tickets: 3859
1039
1040        Fixed issue in :class:`.Variant` where the "right hand coercion" logic,
1041        inherited from :class:`.TypeDecorator`, would
1042        coerce the right-hand side into the :class:`.Variant` itself, rather than
1043        what the default type for the :class:`.Variant` would do.   In the
1044        case of :class:`.Variant`, we want the type to act mostly like the base
1045        type so the default logic of :class:`.TypeDecorator` is now overridden
1046        to fall back to the underlying wrapped type's logic.   Is mostly relevant
1047        for JSON at the moment.
1048
1049    .. change:: 3856
1050        :tags: bug, orm
1051        :tickets: 3856
1052
1053        Fixed bug related to :ticket:`3177`, where a UNION or other set operation
1054        emitted by a :class:`.Query` would apply "single-inheritance" criteria
1055        to the outside of the union (also referencing the wrong selectable),
1056        even though this criteria is now expected to
1057        be already present on the inside subqueries.  The single-inheritance
1058        criteria is now omitted once union() or another set operation is
1059        called against :class:`.Query` in the same way as :meth:`.Query.from_self`.
1060
1061    .. change:: 3548
1062        :tags: bug, firebird
1063        :tickets: 3548
1064
1065        Ported the fix for Oracle quoted-lowercase names to Firebird, so that
1066        a table name that is quoted as lower case can be reflected properly
1067        including when the table name comes from the get_table_names()
1068        inspection function.
1069
1070.. changelog::
1071    :version: 1.1.4
1072    :released: November 15, 2016
1073
1074    .. change::  3842
1075        :tags: bug, sql
1076        :tickets: 3842
1077
1078        Fixed bug where newly added warning for primary key on insert w/o
1079        autoincrement setting (see :ref:`change_3216`) would fail to emit
1080        correctly when invoked upon a lower-case :func:`.table` construct.
1081
1082    .. change::  3852
1083        :tags: bug, orm
1084        :tickets: 3852
1085
1086        Fixed regression in collections due to :ticket:`3457` whereby
1087        deserialize during pickle or deepcopy would fail to establish all
1088        attributes of an ORM collection, causing further mutation operations to
1089        fail.
1090
1091    .. change::  default_schema
1092        :tags: bug, engine
1093
1094        Removed long-broken "default_schema_name()" method from
1095        :class:`.Connection`.  This method was left over from a very old
1096        version and was non-working (e.g. would raise).  Pull request
1097        courtesy Benjamin Dopplinger.
1098
1099    .. change:: pragma
1100        :tags: bug, sqlite
1101
1102        Added quotes to the PRAGMA directives in the pysqlcipher dialect
1103        to support additional cipher arguments appropriately.  Pull request
1104        courtesy Kevin Jurczyk.
1105
1106    .. change:: 3846
1107        :tags: bug, postgresql
1108        :tickets: 3846, 3807
1109
1110        Fixed regression caused by the fix in :ticket:`3807` (version 1.1.0)
1111        where we ensured that the tablename was qualified in the WHERE clause
1112        of the DO UPDATE portion of PostgreSQL's ON CONFLICT, however you
1113        *cannot* put the table name in the  WHERE clause in the actual ON
1114        CONFLICT itself.   This was an incorrect assumption, so that portion
1115        of the change in :ticket:`3807` is rolled back.
1116
1117    .. change:: 3845
1118        :tags: bug, orm
1119        :tickets: 3845
1120
1121        Fixed long-standing bug where the "noload" relationship loading
1122        strategy would cause backrefs and/or back_populates options to be
1123        ignored.
1124
1125    .. change:: sscursor_mysql
1126        :tags: feature, mysql
1127
1128        Added support for server side cursors to the mysqlclient and
1129        pymysql dialects.   This feature is available via the
1130        :paramref:`.Connection.execution_options.stream_results` flag as well
1131        as the ``server_side_cursors=True`` dialect argument in the
1132        same way that it has been for psycopg2 on PostgreSQL.  Pull request
1133        courtesy Roman Podoliaka.
1134
1135    .. change::
1136        :tags: bug, mysql
1137        :tickets: 3841
1138
1139        MySQL's native ENUM type supports any non-valid value being sent, and
1140        in response will return a blank string.  A hardcoded rule to check for
1141        "is returning the blank string" has been added to the  MySQL
1142        implementation for ENUM so that this blank string is returned to the
1143        application rather than being rejected as a non-valid value.  Note that
1144        if your MySQL enum is linking values to objects, you still get the
1145        blank string back.
1146
1147    .. change::
1148        :tags: bug, sqlite, py3k
1149
1150        Added an optional import for the pysqlcipher3 DBAPI when using the
1151        pysqlcipher dialect.  This package will attempt to be imported
1152        if the Python-2 only pysqlcipher DBAPI is non-present.
1153        Pull request courtesy Kevin Jurczyk.
1154
1155.. changelog::
1156    :version: 1.1.3
1157    :released: October 27, 2016
1158
1159    .. change::
1160        :tags: bug, orm
1161        :tickets: 3839
1162
1163        Fixed regression caused by :ticket:`2677` whereby calling
1164        :meth:`.Session.delete` on an object that was already flushed as
1165        deleted in that session would fail to set up the object in the
1166        identity map (or reject the object), causing flush errors as the
1167        object were in a state not accommodated by the unit of work.
1168        The pre-1.1 behavior in this case has been restored, which is that
1169        the object is put back into the identity map so that the DELETE
1170        statement will be attempted again, which emits a warning that the number
1171        of expected rows was not matched (unless the row were restored outside
1172        of the session).
1173
1174    .. change::
1175        :tags: bug, postgresql
1176        :tickets: 3835
1177
1178        PostgreSQL table reflection will ensure that the
1179        :paramref:`.Column.autoincrement` flag is set to False when reflecting
1180        a primary key column that is not of an :class:`.Integer` datatype,
1181        even if the default is related to an integer-generating sequence.
1182        This can happen if a column is created as SERIAL and the datatype
1183        is changed.  The autoincrement flag can only be True if the datatype
1184        is of integer affinity in the 1.1 series.
1185
1186    .. change::
1187        :tags: bug, orm
1188        :tickets: 3836
1189
1190        Fixed regression where some :class:`.Query` methods like
1191        :meth:`.Query.update` and others would fail if the :class:`.Query`
1192        were against a series of mapped columns, rather than the mapped
1193        entity as a whole.
1194
1195    .. change::
1196        :tags: bug, sql
1197        :tickets: 3833
1198
1199        Fixed bug involving new value translation and validation feature
1200        in :class:`.Enum` whereby using the enum object in a string
1201        concatenation would maintain the :class:`.Enum` type as the type
1202        of the expression overall, producing missing lookups.  A string
1203        concatenation against an :class:`.Enum`-typed column now uses
1204        :class:`.String` as the datatype of the expression itself.
1205
1206    .. change::
1207        :tags: bug, sql
1208        :tickets: 3832
1209
1210        Fixed regression which occurred as a side effect of :ticket:`2919`,
1211        which in the less typical case of a user-defined
1212        :class:`.TypeDecorator` that was also itself an instance of
1213        :class:`.SchemaType` (rather than the implementation being such)
1214        would cause the column attachment events to be skipped for the
1215        type itself.
1216
1217
1218.. changelog::
1219    :version: 1.1.2
1220    :released: October 17, 2016
1221
1222    .. change::
1223        :tags: bug, sql
1224        :tickets: 3823
1225
1226        Fixed a regression caused by a newly added function that performs the
1227        "wrap callable" function of sql :class:`.DefaultGenerator` objects,
1228        an attribute error raised for ``__module__`` when the default callable
1229        was a ``functools.partial`` or other object that doesn't have a
1230        ``__module__`` attribute.
1231
1232    .. change::
1233        :tags: bug, orm
1234        :tickets: 3824
1235
1236        Fixed bug involving the rule to disable a joined collection eager
1237        loader on the other side of a many-to-one lazy loader, first added
1238        in :ticket:`1495`, where the rule would fail if the parent object
1239        had some other lazyloader-bound query options associated with it.
1240
1241    .. change::
1242        :tags: bug, orm
1243        :tickets: 3822
1244
1245        Fixed self-referential entity, deferred column loading issue in a
1246        similar style as that of :ticket:`3431`, :ticket:`3811` where an entity
1247        is present in multiple positions within the row due to self-referential
1248        eager loading; when the deferred loader only applies to one of the
1249        paths, the "present" column loader will now override the deferred non-
1250        load for that entity regardless of row ordering.
1251
1252    .. change::
1253        :tags: bug, sql, postgresql
1254        :tickets: 3827
1255
1256        Fixed regression in :class:`.Enum` type where event handlers were not
1257        transferred in the case of the type object being copied, due to a
1258        conflicting copy() method added as part of :ticket:`3250`.  This copy
1259        occurs normally in situations when the column is copied, such as
1260        in tometadata() or when using declarative mixins with columns.  The
1261        event handler not being present would impact the constraint being
1262        created for a non-native enumerated type, but more critically the
1263        ENUM object on the PostgreSQL backend.
1264
1265
1266    .. change::
1267        :tags: bug, postgresql, sql
1268        :tickets: 3828
1269
1270        Changed the naming convention used when generating bound parameters
1271        for a multi-VALUES insert statement, so that the numbered parameter
1272        names don't conflict with the anonymized parameters of a WHERE clause,
1273        as is now common in a PostgreSQL ON CONFLICT construct.
1274
1275.. changelog::
1276    :version: 1.1.1
1277    :released: October 7, 2016
1278
1279    .. change::
1280        :tags: bug, mssql
1281        :tickets: 3820
1282
1283        The "SELECT SERVERPROPERTY"
1284        query added in :ticket:`3810` and :ticket:`3814` is failing on unknown
1285        combinations of Pyodbc and SQL Server.  While failure of this function
1286        was anticipated, the exception catch was not broad enough so it now
1287        catches all forms of pyodbc.Error.
1288
1289    .. change::
1290        :tags: bug, core
1291        :tickets: 3216
1292
1293        Changed the CompileError raised when various primary key missing
1294        situations are detected to a warning.  The statement is again
1295        passed to the database where it will fail and the DBAPI error (usually
1296        IntegrityError) raises as usual.
1297
1298        .. seealso::
1299
1300            :ref:`change_3216`
1301
1302.. changelog::
1303    :version: 1.1.0
1304    :released: October 5, 2016
1305
1306    .. change::
1307        :tags: bug, sql
1308        :tickets: 3805
1309
1310        Execution options can now be propagated from within a
1311        statement at compile time to the outermost statement, so that
1312        if an embedded element wants to set "autocommit" to be True for example,
1313        it can propagate this to the enclosing statement.  Currently, this
1314        feature is enabled for a DML-oriented CTE embedded inside of a SELECT
1315        statement, e.g. INSERT/UPDATE/DELETE inside of SELECT.
1316
1317    .. change::
1318        :tags: bug, orm
1319        :tickets: 3802
1320
1321        ORM attributes can now be assigned any object that is has a
1322        ``__clause_element__()`` attribute, which will result in inline
1323        SQL the way any :class:`.ClauseElement` class does.  This covers other
1324        mapped attributes not otherwise transformed by further expression
1325        constructs.
1326
1327    .. change::
1328        :tags: feature, orm
1329        :tickets: 3812
1330
1331        Enhanced the new "raise" lazy loader strategy to also include a
1332        "raise_on_sql" variant, available both via :paramref:`.orm.relationship.lazy`
1333        as well as :func:`.orm.raiseload`.   This variant only raises if the
1334        lazy load would actually emit SQL, vs. raising if the lazy loader
1335        mechanism is invoked at all.
1336
1337    .. change::
1338        :tags: bug, postgresql
1339        :tickets: 3813
1340
1341        An adjustment to ON CONFLICT such that the "inserted_primary_key"
1342        logic is able to accommodate the case where there's no INSERT or
1343        UPDATE and there's no net change.  The value comes out as None
1344        in this case, rather than failing on an exception.
1345
1346    .. change::
1347        :tags: bug, orm
1348        :tickets: 3811
1349
1350        Made an adjustment to the bug fix first introduced in [ticket:3431]
1351        that involves an object appearing in multiple contexts in a single
1352        result set, such that an eager loader that would set the related
1353        object value to be None will still fire off, thus satisfying the
1354        load of that attribute.  Previously, the adjustment only honored
1355        a non-None value arriving for an eagerly loaded attribute in a
1356        secondary row.
1357
1358    .. change::
1359        :tags: bug, orm
1360        :tickets: 3808
1361
1362        Fixed bug in new :meth:`.SessionEvents.persistent_to_deleted` event
1363        where the target object could be garbage collected before the event
1364        is fired off.
1365
1366    .. change::
1367        :tags: bug, sql
1368        :tickets: 3809
1369
1370        A string sent as a column default via the
1371        :paramref:`.Column.server_default` parameter is now escaped for quotes.
1372
1373        .. seealso::
1374
1375            :ref:`change_3809`
1376
1377    .. change::
1378        :tags: bug, postgresql
1379        :tickets: 3807
1380
1381        Fixed issue in new PG "on conflict" construct where columns including
1382        those of the "excluded" namespace would not be table-qualified
1383        in the WHERE clauses in the statement.
1384
1385     .. change::
1386        :tags: bug, sql, postgresql
1387        :tickets: 3806
1388
1389        Added compiler-level flags used by PostgreSQL to place additional
1390        parenthesis than would normally be generated by precedence rules
1391        around operations involving JSON, HSTORE indexing operators as well as
1392        within their operands since it has been observed that PostgreSQL's
1393        precedence rules for at least the HSTORE indexing operator is not
1394        consistent between 9.4 and 9.5.
1395
1396    .. change::
1397        :tags: bug, sql, mysql
1398        :tickets: 3803
1399
1400        The ``BaseException`` exception class is now intercepted by the
1401        exception-handling routines of :class:`.Connection`, and includes
1402        handling by the :meth:`~.ConnectionEvents.handle_error`
1403        event.  The :class:`.Connection` is now **invalidated** by default in
1404        the case of a system level exception that is not a subclass of
1405        ``Exception``, including ``KeyboardInterrupt`` and the greenlet
1406        ``GreenletExit`` class, to prevent further operations from occurring
1407        upon a database connection that is in an unknown and possibly
1408        corrupted state.  The MySQL drivers are most targeted by this change
1409        however the change is across all DBAPIs.
1410
1411        .. seealso::
1412
1413            :ref:`change_3803`
1414
1415    .. change::
1416        :tags: bug, sql
1417        :tickets: 3799
1418
1419        The "eq" and "ne" operators are no longer part of the list of
1420        "associative" operators, while they remain considered to be
1421        "commutative".  This allows an expression like ``(x == y) == z``
1422        to be maintained at the SQL level with parenthesis.  Pull request
1423        courtesy John Passaro.
1424
1425    .. change::
1426        :tags: bug, orm
1427        :tickets: 3767
1428
1429        The primaryjoin of a :func:`.relationship` construct can now include
1430        a :func:`.bindparam` object that includes a callable function to
1431        generate values.  Previously, the lazy loader strategy would
1432        be incompatible with this use, and additionally would fail to correctly
1433        detect if the "use_get" criteria should be used if the primary key
1434        were involved with the bound parameter.
1435
1436    .. change::
1437        :tags: bug, orm
1438        :tickets: 3801
1439
1440        An UPDATE emitted from the ORM flush process can now accommodate a
1441        SQL expression element for a column within the primary key of an
1442        object, if the target database supports RETURNING in order to provide
1443        the new value, or if the PK value is set "to itself" for the purposes
1444        of bumping some other trigger / onupdate on the column.
1445
1446    .. change::
1447        :tags: bug, orm
1448        :tickets: 3788
1449
1450        Fixed bug where the "simple many-to-one" condition that allows  lazy
1451        loading to use get() from identity map would fail to be  invoked if the
1452        primaryjoin of the relationship had multiple clauses separated by AND
1453        which were not in the same order as that of the primary key columns
1454        being compared in each clause. This ordering
1455        difference occurs for a composite foreign key where the table-bound
1456        columns on the referencing side were not in the same order in the .c
1457        collection as the primary key columns on the referenced side....which
1458        in turn occurs a lot if one is using declarative mixins and/or
1459        declared_attr to set up columns.
1460
1461    .. change::
1462        :tags: bug, sql
1463        :tickets: 3789
1464
1465        Stringify of expression with unnamed :class:`.Column` objects, as
1466        occurs in lots of situations including ORM error reporting,
1467        will now render the name in string context as "<name unknown>"
1468        rather than raising a compile error.
1469
1470    .. change::
1471        :tags: bug, sql
1472        :tickets: 3786
1473
1474        Raise a more descriptive exception / message when ClauseElement
1475        or non-SQLAlchemy objects that are not "executable" are erroneously
1476        passed to ``.execute()``; a new exception ObjectNotExecutableError
1477        is raised consistently in all cases.
1478
1479    .. change::
1480        :tags: bug, orm
1481        :tickets: 3776
1482
1483        An exception is raised when two ``@validates`` decorators on a mapping
1484        make use of the same name.  Only one validator of a certain name
1485        at a time is supported, there's no mechanism to chain these together,
1486        as the order of the validators at the level of function decorator
1487        can't be made deterministic.
1488
1489        .. seealso::
1490
1491            :ref:`change_3776`
1492
1493    .. change::
1494        :tags: bug, orm
1495
1496        Mapper errors raised during :func:`.configure_mappers` now explicitly
1497        include the name of the originating mapper in the exception message
1498        to help in those situations where the wrapped exception does not
1499        itself include the source mapper.  Pull request courtesy
1500        John Perkins.
1501
1502    .. change::
1503        :tags: bug, mysql
1504        :tickets: 3766
1505
1506        Fixed bug where the "literal_binds" flag would not be propagated
1507        to a CAST expression under MySQL.
1508
1509    .. change::
1510        :tags: bug, sql, postgresql, mysql
1511        :tickets: 3765
1512
1513        Fixed regression in JSON datatypes where the "literal processor" for
1514        a JSON index value would not be invoked.  The native String and Integer
1515        datatypes are now called upon from within the JSONIndexType
1516        and JSONPathType.  This is applied to the generic, PostgreSQL, and
1517        MySQL JSON types and also has a dependency on :ticket:`3766`.
1518
1519    .. change::
1520        :tags: change, orm
1521
1522        Passing False to :meth:`.Query.order_by` in order to cancel
1523        all order by's is deprecated; there is no longer any difference
1524        between calling this method with False or with None.
1525
1526    .. change::
1527        :tags: feature, orm
1528
1529        The :meth:`.Query.group_by` method now resets the group by collection
1530        if an argument of ``None`` is passed, in the same way that
1531        :meth:`.Query.order_by` has worked for a long time.  Pull request
1532        courtesy Iuri Diniz.
1533
1534    .. change::
1535        :tags: bug, sql
1536        :tickets: 3763
1537
1538        Fixed bug where :class:`.Index` would fail to extract columns from
1539        compound SQL expressions if those SQL expressions were wrapped inside
1540        of an ORM-style ``__clause_element__()`` construct.  This bug
1541        exists in 1.0.x as well, however in 1.1 is more noticeable as
1542        hybrid_property @expression now returns a wrapped element.
1543
1544    .. change::
1545        :tags: change, orm, declarative
1546
1547        Constructing a declarative base class that inherits from another class
1548        will also inherit its docstring. This means
1549        :func:`~.ext.declarative.as_declarative` acts more like a normal class
1550        decorator.
1551
1552.. changelog::
1553    :version: 1.1.0b3
1554    :released: July 26, 2016
1555
1556    .. change::
1557        :tags: change, orm
1558        :tickets: 3749
1559
1560        Removed a warning that dates back to 0.4 which emits when a same-named
1561        relationship is placed on two mappers that inherits via joined or
1562        single table inheritance.   The warning does not apply to the
1563        current unit of work implementation.
1564
1565        .. seealso::
1566
1567            :ref:`change_3749`
1568
1569
1570    .. change::
1571        :tags: bug, sql
1572        :tickets: 3745
1573
1574        Fixed bug in new CTE feature for update/insert/delete stated
1575        as a CTE inside of an enclosing statement (typically SELECT) whereby
1576        oninsert and onupdate values weren't called upon for the embedded
1577        statement.
1578
1579    .. change::
1580        :tags: bug, sql
1581        :tickets: 3744
1582
1583        Fixed bug in new CTE feature for update/insert/delete whereby
1584        an anonymous (e.g. no name passed) :class:`.CTE` construct around
1585        the statement would fail.
1586
1587    .. change::
1588        :tags: bug, ext
1589
1590        sqlalchemy.ext.indexable will intercept IndexError as well
1591        as KeyError when raising as AttributeError.
1592
1593    .. change::
1594        :tags: feature, ext
1595
1596        Added a "default" parameter to the new sqlalchemy.ext.indexable
1597        extension.
1598
1599.. changelog::
1600    :version: 1.1.0b2
1601    :released: July 1, 2016
1602
1603    .. change::
1604        :tags: bug, ext, postgresql
1605        :tickets: 3732
1606
1607        Made a slight behavioral change in the ``sqlalchemy.ext.compiler``
1608        extension, whereby the existing compilation schemes for an established
1609        construct would be removed if that construct itself didn't already
1610        have its own dedicated ``__visit_name__``.  This was a
1611        rare occurrence in 1.0, however in 1.1 :class:`.postgresql.ARRAY`
1612        subclasses :class:`.sqltypes.ARRAY` and has this behavior.
1613        As a result, setting up a compilation handler for another dialect
1614        such as SQLite would render the main :class:`.postgresql.ARRAY`
1615        object no longer compilable.
1616
1617    .. change::
1618        :tags: bug, sql
1619        :tickets: 3730
1620
1621        The processing performed by the :class:`.Boolean` datatype for backends
1622        that only feature integer types has been made consistent between the
1623        pure Python and C-extension versions, in that the C-extension version
1624        will accept any integer value from the database as a boolean, not just
1625        zero and one; additionally, non-boolean integer values being sent to
1626        the database are coerced to exactly zero or one, instead of being
1627        passed as the original integer value.
1628
1629        .. seealso::
1630
1631            :ref:`change_3730`
1632
1633    .. change::
1634        :tags: bug, sql
1635        :tickets: 3725
1636
1637        Rolled back the validation rules a bit in :class:`.Enum` to allow
1638        unknown string values to pass through, unless the flag
1639        ``validate_string=True`` is passed to the Enum; any other kind of object is
1640        still of course rejected.  While the immediate use
1641        is to allow comparisons to enums with LIKE, the fact that this
1642        use exists indicates there may be more unknown-string-comparison use
1643        cases than we expected, which hints that perhaps there are some
1644        unknown string-INSERT cases too.
1645
1646    .. change::
1647        :tags: bug, mysql
1648        :tickets: 3726
1649
1650        Dialed back the "order the primary key columns per auto-increment"
1651        described in :ref:`change_mysql_3216` a bit, so that if the
1652        :class:`.PrimaryKeyConstraint` is explicitly defined, the order
1653        of columns is maintained exactly, allowing control of this behavior
1654        when necessary.
1655
1656.. changelog::
1657    :version: 1.1.0b1
1658    :released: June 16, 2016
1659
1660    .. change::
1661        :tags: feature, sql
1662        :tickets: 3718
1663
1664        Added TABLESAMPLE support via the new :meth:`.FromClause.tablesample`
1665        method and standalone function.  Pull request courtesy Ilja Everilä.
1666
1667        .. seealso::
1668
1669            :ref:`change_3718`
1670
1671    .. change::
1672        :tags: feature, orm, ext
1673
1674        A new ORM extension :ref:`indexable_toplevel` is added, which allows
1675        construction of Python attributes which refer to specific elements
1676        of "indexed" structures such as arrays and JSON fields.  Pull request
1677        courtesy Jeong YunWon.
1678
1679        .. seealso::
1680
1681            :ref:`feature_indexable`
1682
1683    .. change::
1684        :tags: bug, sql
1685        :tickets: 3724
1686
1687        :meth:`.FromClause.count` is deprecated.  This function makes use of
1688        an arbitrary column in the table and is not reliable; for Core use,
1689        ``func.count()`` should be preferred.
1690
1691    .. change::
1692        :tags: feature, postgresql
1693        :tickets: 3529
1694
1695        Added support for PostgreSQL's INSERT..ON CONFLICT using a new
1696        PostgreSQL-specific :class:`.postgresql.dml.Insert` object.
1697        Pull request and extensive efforts here by Robin Thomas.
1698
1699        .. seealso::
1700
1701            :ref:`change_3529`
1702
1703    .. change::
1704        :tags: feature, postgresql
1705
1706        The DDL for DROP INDEX will emit "CONCURRENTLY" if the
1707        ``postgresql_concurrently`` flag is set upon the
1708        :class:`.Index` and if the database in use is detected as
1709        PostgreSQL version 9.2 or greater.   For CREATE INDEX, database
1710        version detection is also added which will omit the clause if
1711        PG version is less than 8.2.  Pull request courtesy Iuri de Silvio.
1712
1713    .. change::
1714        :tags: bug, orm
1715        :tickets: 3708
1716
1717        Fixed an issue where a many-to-one change of an object from one
1718        parent to another could work inconsistently when combined with
1719        an un-flushed modification of the foreign key attribute.  The attribute
1720        move now considers the database-committed value of the foreign key
1721        in order to locate the "previous" parent of the object being
1722        moved.   This allows events to fire off correctly including
1723        backref events.  Previously, these events would not always fire.
1724        Applications which may have relied on the previously broken
1725        behavior may be affected.
1726
1727        .. seealso::
1728
1729            :ref:`change_3708`
1730
1731    .. change::
1732        :tags: feature, sql
1733        :tickets: 3049
1734
1735        Added support for ranges in window functions, using the
1736        :paramref:`.expression.over.range_` and
1737        :paramref:`.expression.over.rows` parameters.
1738
1739        .. seealso::
1740
1741            :ref:`change_3049`
1742
1743    .. change::
1744        :tags: feature, orm
1745
1746        Added new flag :paramref:`.Session.bulk_insert_mappings.render_nulls`
1747        which allows an ORM bulk INSERT to occur with NULL values rendered;
1748        this bypasses server side defaults, however allows all statements
1749        to be formed with the same set of columns, allowing them to be
1750        batched.  Pull request courtesy Tobias Sauerwein.
1751
1752    .. change::
1753        :tags: feature, postgresql
1754        :tickets: 3588
1755
1756        Added new parameter :paramref:`.PGInspector.get_view_names.include`,
1757        allowing specification for what kinds of views should be returned.
1758        Currently "plain" and "materialized" views are included.  Pull
1759        request courtesy Sebastian Bank.
1760
1761    .. change::
1762        :tags: feature, mssql
1763
1764        The ``mssql_clustered`` flag available on :class:`.UniqueConstraint`,
1765        :class:`.PrimaryKeyConstraint`, :class:`.Index` now defaults to
1766        ``None``, and can be set to False which will render the NONCLUSTERED
1767        keyword in particular for a primary key, allowing a different index to
1768        be used as "clustered". Pull request courtesy Saulius Žemaitaitis.
1769
1770    .. change::
1771        :tags: feature, orm
1772        :tickets: 1311
1773
1774        Added new event :meth:`.AttributeEvents.init_scalar`, as well
1775        as a new example suite illustrating its use.  This event can be used
1776        to provide a Core-generated default value to a Python-side attribute
1777        before the object is persisted.
1778
1779        .. seealso::
1780
1781            :ref:`change_1311`
1782
1783    .. change::
1784        :tags: feature, postgresql
1785        :tickets: 3720
1786
1787        Added ``postgresql_tablespace`` as an argument to :class:`.Index`
1788        to allow specification of TABLESPACE for an index in PostgreSQL.
1789        Complements the same-named parameter on :class:`.Table`.  Pull
1790        request courtesy Benjamin Bertrand.
1791
1792    .. change::
1793        :tags: orm, feature
1794
1795        Added :paramref:`.AutomapBase.prepare.schema` to the
1796        :meth:`.AutomapBase.prepare` method, to indicate which schema
1797        tables should be reflected from if not the default schema.
1798        Pull request courtesy Josh Marlow.
1799
1800    .. change::
1801        :tags: feature, sqlite
1802
1803        The SQLite dialect now reflects ON UPDATE and ON DELETE phrases
1804        within foreign key constraints.  Pull request courtesy
1805        Michal Petrucha.
1806
1807    .. change::
1808        :tags: bug, mssql
1809
1810        Adjustments to the mxODBC dialect to make use of the ``BinaryNull``
1811        symbol when appropriate in conjunction with the ``VARBINARY``
1812        data type.  Pull request courtesy Sheila Allen.
1813
1814    .. change::
1815        :tags: feature, sql
1816
1817        Implemented reflection of CHECK constraints for SQLite and PostgreSQL.
1818        This is available via the new inspector method
1819        :meth:`.Inspector.get_check_constraints` as well as when reflecting
1820        :class:`.Table` objects in the form of :class:`.CheckConstraint`
1821        objects present in the constraints collection.  Pull request courtesy
1822        Alex Grönholm.
1823
1824    .. change::
1825        :tags: feature, postgresql
1826
1827        Added new parameter
1828        :paramref:`.GenerativeSelect.with_for_update.key_share`, which
1829        will render the ``FOR NO KEY UPDATE`` version of ``FOR UPDATE``
1830        and ``FOR KEY SHARE`` instead of ``FOR SHARE``
1831        on the PostgreSQL backend.  Pull request courtesy Sergey Skopin.
1832
1833    .. change::
1834        :tags: feature, postgresql, oracle
1835
1836        Added new parameter
1837        :paramref:`.GenerativeSelect.with_for_update.skip_locked`, which
1838        will render the ``SKIP LOCKED`` phrase for a ``FOR UPDATE`` or
1839        ``FOR SHARE`` lock on the PostgreSQL and Oracle backends.  Pull
1840        request courtesy Jack Zhou.
1841
1842    .. change::
1843        :tags: change, orm
1844        :tickets: 3394
1845
1846        The :paramref:`.Mapper.order_by` parameter is deprecated.
1847        This is an old parameter no longer relevant to how SQLAlchemy
1848        works, once the Query object was introduced.  By deprecating it
1849        we establish that we aren't supporting non-working use cases
1850        and that we encourage applications to move off of the use of this
1851        parameter.
1852
1853        .. seealso::
1854
1855            :ref:`change_3394`
1856
1857    .. change::
1858        :tags: feature, postgresql
1859
1860        Added a new dialect for the PyGreSQL PostgreSQL dialect.  Thanks
1861        to Christoph Zwerschke and Kaolin Imago Fire for their efforts.
1862
1863    .. change::
1864        :tags: bug, ext
1865        :tickets: 3653
1866
1867        The docstring specified on a hybrid property or method is now honored
1868        at the class level, allowing it to work with tools like Sphinx
1869        autodoc.  The mechanics here necessarily involve some wrapping of
1870        expressions to occur for hybrid properties, which may cause them
1871        to appear differently using introspection.
1872
1873        .. seealso::
1874
1875            :ref:`change_3653`
1876
1877    .. change::
1878        :tags: feature, sql
1879
1880        New :meth:`.ColumnOperators.is_distinct_from` and
1881        :meth:`.ColumnOperators.isnot_distinct_from` operators; pull request
1882        courtesy Sebastian Bank.
1883
1884        .. seealso::
1885
1886            :ref:`change_is_distinct_from`
1887
1888    .. change::
1889        :tags: bug, orm
1890        :tickets: 3488
1891
1892        Fixed bug where deferred columns would inadvertently be set up
1893        for database load on the next object-wide unexpire, when the object
1894        were merged into the session with ``session.merge(obj, load=False)``.
1895
1896    .. change::
1897        :tags: feature, sql
1898
1899        Added a hook in :meth:`.DDLCompiler.visit_create_table` called
1900        :meth:`.DDLCompiler.create_table_suffix`, allowing custom dialects
1901        to add keywords after the "CREATE TABLE" clause.  Pull request
1902        courtesy Mark Sandan.
1903
1904    .. change::
1905        :tags: feature, sql
1906
1907        Negative integer indexes are now accommodated by rows
1908        returned from a :class:`.ResultProxy`.  Pull request courtesy
1909        Emanuele Gaifas.
1910
1911        .. seealso::
1912
1913            :ref:`change_gh_231`
1914
1915    .. change::
1916        :tags: feature, sqlite
1917        :tickets: 3629
1918
1919        The SQLite dialect now reflects the names of primary key constraints.
1920        Pull request courtesy Diana Clarke.
1921
1922        .. seealso::
1923
1924            :ref:`change_3629`
1925
1926    .. change::
1927        :tags: feature, sql
1928        :tickets: 2857
1929
1930        Added :meth:`.Select.lateral` and related constructs to allow
1931        for the SQL standard LATERAL keyword, currently only supported
1932        by PostgreSQL.
1933
1934        .. seealso::
1935
1936            :ref:`change_2857`
1937
1938    .. change::
1939        :tags: feature, sql
1940        :tickets: 1957
1941
1942        Added support for rendering "FULL OUTER JOIN" to both Core and ORM.
1943        Pull request courtesy Stefan Urbanek.
1944
1945        .. seealso::
1946
1947            :ref:`change_1957`
1948
1949    .. change::
1950        :tags: feature, engine
1951
1952        Added connection pool events :meth:`ConnectionEvents.close`,
1953        :meth:`.ConnectionEvents.detach`,
1954        :meth:`.ConnectionEvents.close_detached`.
1955
1956    .. change::
1957        :tags: bug, orm, mysql
1958        :tickets: 3680
1959
1960        Further continuing on the common MySQL exception case of
1961        a savepoint being cancelled first covered in :ticket:`2696`,
1962        the failure mode in which the :class:`.Session` is placed when a
1963        SAVEPOINT vanishes before rollback has been improved to allow the
1964        :class:`.Session` to still function outside of that savepoint.
1965        It is assumed that the savepoint operation failed and was cancelled.
1966
1967        .. seealso::
1968
1969            :ref:`change_3680`
1970
1971    .. change::
1972        :tags: feature, mssql
1973        :tickets: 3534
1974
1975        Added basic isolation level support to the SQL Server dialects
1976        via :paramref:`.create_engine.isolation_level` and
1977        :paramref:`.Connection.execution_options.isolation_level`
1978        parameters.
1979
1980        .. seealso::
1981
1982            :ref:`change_3534`
1983
1984    .. change::
1985        :tags: feature, mysql
1986        :tickets: 3332
1987
1988        Added support for "autocommit" on MySQL drivers, via the
1989        AUTOCOMMIT isolation level setting.  Pull request courtesy
1990        Roman Podoliaka.
1991
1992        .. seealso::
1993
1994            :ref:`change_3332`
1995
1996    .. change::
1997        :tags: bug, orm
1998        :tickets: 3677
1999
2000        Fixed bug where a newly inserted instance that is rolled back
2001        would still potentially cause persistence conflicts on the next
2002        transaction, because the instance would not be checked that it
2003        was expired.   This fix will resolve a large class of cases that
2004        erroneously cause the "New instance with identity X conflicts with
2005        persistent instance Y" error.
2006
2007        .. seealso::
2008
2009            :ref:`change_3677`
2010
2011    .. change::
2012        :tags: bug, orm
2013        :tickets: 3662
2014
2015        An improvement to the workings of :meth:`.Query.correlate` such
2016        that when a "polymorphic" entity is used which represents a straight
2017        join of several tables, the statement will ensure that all the
2018        tables within the join are part of what's correlating.
2019
2020        .. seealso::
2021
2022            :ref:`change_3662`
2023
2024    .. change::
2025        :tags: bug, orm
2026        :tickets: 3431
2027
2028        Fixed bug which would cause an eagerly loaded many-to-one attribute
2029        to not be loaded, if the joined eager load were from a row where the
2030        same entity were present multiple times, some calling for the attribute
2031        to be eagerly loaded and others not.  The logic here is revised to
2032        take in the attribute even though a different loader path has
2033        handled the parent entity already.
2034
2035        .. seealso::
2036
2037            :ref:`change_3431`
2038
2039    .. change::
2040        :tags: feature, engine
2041        :tickets: 2837
2042
2043        All string formatting of bound parameter sets and result rows for
2044        logging, exception, and  ``repr()`` purposes now truncate very large
2045        scalar values within each collection, including an
2046        "N characters truncated"
2047        notation, similar to how the display for large multiple-parameter sets
2048        are themselves truncated.
2049
2050
2051        .. seealso::
2052
2053            :ref:`change_2837`
2054
2055    .. change::
2056        :tags: feature, ext
2057        :tickets: 3297
2058
2059        Added :class:`.MutableSet` and :class:`.MutableList` helper classes
2060        to the :ref:`mutable_toplevel` extension.  Pull request courtesy
2061        Jeong YunWon.
2062
2063    .. change::
2064        :tags: feature, sql
2065        :tickets: 2551
2066
2067        CTE functionality has been expanded to support all DML, allowing
2068        INSERT, UPDATE, and DELETE statements to both specify their own
2069        WITH clause, as well as for these statements themselves to be
2070        CTE expressions when they include a RETURNING clause.
2071
2072        .. seealso::
2073
2074            :ref:`change_2551`
2075
2076    .. change::
2077        :tags: bug, orm
2078        :tickets: 3641
2079
2080        A refinement to the logic which adds columns to the resulting SQL when
2081        :meth:`.Query.distinct` is combined with :meth:`.Query.order_by` such
2082        that columns which are already present will not be added
2083        a second time, even if they are labeled with a different name.
2084        Regardless of this change, the extra columns added to the SQL have
2085        never been returned in the final result, so this change only impacts
2086        the string form of the statement as well as its behavior when used in
2087        a Core execution context.   Additionally, columns are no longer added
2088        when the DISTINCT ON format is used, provided the query is not
2089        wrapped inside a subquery due to joined eager loading.
2090
2091        .. seealso::
2092
2093            :ref:`change_3641`
2094
2095    .. change::
2096        :tags: feature, sql
2097        :tickets: 3292, 3095
2098
2099        Added support for PEP-435-style enumerated classes, namely
2100        Python 3's ``enum.Enum`` class but also including compatible
2101        enumeration libraries, to the :class:`.types.Enum` datatype.
2102        The :class:`.types.Enum` datatype now also performs in-Python validation
2103        of incoming values, and adds an option to forego creating the
2104        CHECK constraint :paramref:`.Enum.create_constraint`.
2105        Pull request courtesy Alex Grönholm.
2106
2107        .. seealso::
2108
2109            :ref:`change_3292`
2110
2111            :ref:`change_3095`
2112
2113    .. change::
2114        :tags: change, postgresql
2115
2116        The ``sqlalchemy.dialects.postgres`` module, long deprecated, is
2117        removed; this has emitted a warning for many years and projects
2118        should be calling upon ``sqlalchemy.dialects.postgresql``.
2119        Engine URLs of the form ``postgres://`` will still continue to function,
2120        however.
2121
2122    .. change::
2123        :tags: bug, sqlite
2124        :tickets: 3634
2125
2126        The workaround for right-nested joins on SQLite, where they are rewritten
2127        as subqueries in order to work around SQLite's lack of support for this
2128        syntax, is lifted when SQLite version 3.7.16 or greater is detected.
2129
2130        .. seealso::
2131
2132            :ref:`change_3634`
2133
2134    .. change::
2135        :tags: bug, sqlite
2136        :tickets: 3633
2137
2138        The workaround for SQLite's unexpected delivery of column names as
2139        ``tablename.columnname`` for some kinds of queries is now disabled
2140        when SQLite version 3.10.0 or greater is detected.
2141
2142        .. seealso::
2143
2144            :ref:`change_3633`
2145
2146    .. change::
2147        :tags: feature, orm
2148        :tickets: 2349
2149
2150        Added new parameter :paramref:`.orm.mapper.passive_deletes` to
2151        available mapper options.   This allows a DELETE to proceed
2152        for a joined-table inheritance mapping against the base table only,
2153        while allowing for ON DELETE CASCADE to handle deleting the row
2154        from the subclass tables.
2155
2156        .. seealso::
2157
2158            :ref:`change_2349`
2159
2160
2161    .. change::
2162        :tags: bug, sybase
2163        :tickets: 2278
2164
2165        The unsupported Sybase dialect now raises ``NotImplementedError``
2166        when attempting to compile a query that includes "offset"; Sybase
2167        has no straightforward "offset" feature.
2168
2169    .. change::
2170        :tags: feature, orm
2171        :tickets: 3631
2172
2173        Calling str() on a core SQL construct has been made more "friendly",
2174        when the construct contains non-standard SQL elements such as
2175        RETURNING, array index operations, or dialect-specific or custom
2176        datatypes.  A string is now returned in these cases rendering an
2177        approximation of the construct (typically the PostgreSQL-style
2178        version of it) rather than raising an error.
2179
2180        .. seealso::
2181
2182            :ref:`change_3631`
2183
2184    .. change::
2185        :tags: bug, orm
2186        :tickets: 3630
2187
2188        Fixed issue where two same-named relationships that refer to
2189        a base class and a concrete-inherited subclass would raise an error
2190        if those relationships were set up using "backref", while setting up the
2191        identical configuration using relationship() instead with the conflicting
2192        names would succeed, as is allowed in the case of a concrete mapping.
2193
2194        .. seealso::
2195
2196            :ref:`change_3630`
2197
2198    .. change::
2199        :tags: feature, orm
2200        :tickets: 3081
2201
2202        The ``str()`` call for :class:`.Query` will now take into account
2203        the :class:`.Engine` to which the :class:`.Session` is bound, when
2204        generating the string form of the SQL, so that the actual SQL
2205        that would be emitted to the database is shown, if possible.  Previously,
2206        only the engine associated with the :class:`.MetaData` to which the
2207        mappings are associated would be used, if present.  If
2208        no bind can be located either on the :class:`.Session` or on
2209        the :class:`.MetaData` to which the mappings are associated, then
2210        the "default" dialect is used to render the SQL, as was the case
2211        previously.
2212
2213        .. seealso::
2214
2215            :ref:`change_3081`
2216
2217    .. change::
2218        :tags: feature, sql
2219        :tickets: 3501
2220
2221        A deep improvement to the recently added :meth:`.TextClause.columns`
2222        method, and its interaction with result-row processing, now allows
2223        the columns passed to the method to be positionally matched with the
2224        result columns in the statement, rather than matching on name alone.
2225        The advantage to this includes that when linking a textual SQL statement
2226        to an ORM or Core table model, no system of labeling or de-duping of
2227        common column names needs to occur, which also means there's no need
2228        to worry about how label names match to ORM columns and so-forth.  In
2229        addition, the :class:`.ResultProxy` has been further enhanced to
2230        map column and string keys to a row with greater precision in some
2231        cases.
2232
2233        .. seealso::
2234
2235            :ref:`change_3501` - feature overview
2236
2237            :ref:`behavior_change_3501` - backwards compatibility remarks
2238
2239    .. change::
2240        :tags: feature, engine
2241        :tickets: 2685
2242
2243        Multi-tenancy schema translation for :class:`.Table` objects is added.
2244        This supports the use case of an application that uses the same set of
2245        :class:`.Table` objects in many schemas, such as schema-per-user.
2246        A new execution option
2247        :paramref:`.Connection.execution_options.schema_translate_map` is
2248        added.
2249
2250        .. seealso::
2251
2252            :ref:`change_2685`
2253
2254    .. change::
2255        :tags: feature, engine
2256        :tickets: 3536
2257
2258        Added a new entrypoint system to the engine to allow "plugins" to
2259        be stated in the query string for a URL.   Custom plugins can
2260        be written which will be given the chance up front to alter and/or
2261        consume the engine's URL and keyword arguments, and then at engine
2262        create time will be given the engine itself to allow additional
2263        modifications or event registration.  Plugins are written as a
2264        subclass of :class:`.CreateEnginePlugin`; see that class for
2265        details.
2266
2267    .. change::
2268        :tags: feature, mysql
2269        :tickets: 3547
2270
2271        Added :class:`.mysql.JSON` for MySQL 5.7.  The JSON type provides
2272        persistence of JSON values in MySQL as well as basic operator support
2273        of "getitem" and "getpath", making use of the ``JSON_EXTRACT``
2274        function in order to refer to individual paths in a JSON structure.
2275
2276        .. seealso::
2277
2278            :ref:`change_3547`
2279
2280    .. change::
2281        :tags: feature, sql
2282        :tickets: 3619
2283
2284        Added a new type to core :class:`.types.JSON`.  This is the
2285        base of the PostgreSQL :class:`.postgresql.JSON` type as well as that
2286        of the new :class:`.mysql.JSON` type, so that a PG/MySQL-agnostic
2287        JSON column may be used.  The type features basic index and path
2288        searching support.
2289
2290        .. seealso::
2291
2292            :ref:`change_3619`
2293
2294    .. change::
2295        :tags: bug, sql
2296        :tickets: 3616
2297
2298        Fixed an assertion that would raise somewhat inappropriately
2299        if a :class:`.Index` were associated with a :class:`.Column` that
2300        is associated with a lower-case-t :class:`.TableClause`; the
2301        association should be ignored for the purposes of associating
2302        the index with a :class:`.Table`.
2303
2304    .. change::
2305        :tags: bug, orm
2306        :tickets: 3601
2307
2308        The :meth:`.Session.merge` method now tracks pending objects by
2309        primary key before emitting an INSERT, and merges distinct objects with
2310        duplicate primary keys together as they are encountered, which is
2311        essentially semi-deterministic at best.   This behavior
2312        matches what happens already with persistent objects.
2313
2314        .. seealso::
2315
2316            :ref:`change_3601`
2317
2318    .. change::
2319        :tags: bug, postgresql
2320        :tickets: 3587
2321
2322        Added support for reflecting the source of materialized views
2323        to the PostgreSQL version of the :meth:`.Inspector.get_view_definition`
2324        method.
2325
2326    .. change::
2327        :tags: bug, orm
2328        :tickets: 3582
2329
2330        Fixed bug where the "single table inheritance" criteria would be
2331        added onto the end of a query in some inappropriate situations, such
2332        as when querying from an exists() of a single-inheritance subclass.
2333
2334        .. seealso::
2335
2336            :ref:`change_3582`
2337
2338    .. change::
2339        :tags: enhancement, schema
2340
2341        The default generation functions passed to :class:`.Column` objects
2342        are now run through "update_wrapper", or an equivalent function
2343        if a callable non-function is passed, so that introspection tools
2344        preserve the name and docstring of the wrapped function.  Pull
2345        request courtesy hsum.
2346
2347    .. change::
2348        :tags: change, sql, mysql
2349        :tickets: 3216
2350
2351        The system by which a :class:`.Column` considers itself to be an
2352        "auto increment" column has been changed, such that autoincrement
2353        is no longer implicitly enabled for a :class:`.Table` that has a
2354        composite primary key.  In order to accommodate being able to enable
2355        autoincrement for a composite PK member column while at the same time
2356        maintaining SQLAlchemy's long standing behavior of enabling
2357        implicit autoincrement for a single integer primary key, a third
2358        state has been added to the :paramref:`.Column.autoincrement` parameter
2359        ``"auto"``, which is now the default.
2360
2361        .. seealso::
2362
2363            :ref:`change_3216`
2364
2365            :ref:`change_mysql_3216`
2366
2367    .. change::
2368        :tags: change, mysql
2369        :tickets: 3216
2370
2371        The MySQL dialect no longer generates an extra "KEY" directive when
2372        generating CREATE TABLE DDL for a table using InnoDB with a
2373        composite primary key with AUTO_INCREMENT on a column that isn't the
2374        first column;  to overcome InnoDB's limitation here, the PRIMARY KEY
2375        constraint is now generated with the AUTO_INCREMENT column placed
2376        first in the list of columns.
2377
2378        .. seealso::
2379
2380            :ref:`change_mysql_3216`
2381
2382            :ref:`change_3216`
2383
2384    .. change::
2385        :tags: change, sqlite
2386
2387        Added support to the SQLite dialect for the
2388        :meth:`.Inspector.get_schema_names` method to work with SQLite;
2389        pull request courtesy Brian Van Klaveren.  Also repaired support
2390        for creation of indexes with schemas as well as reflection of
2391        foreign key constraints in schema-bound tables.
2392
2393        .. seealso::
2394
2395            :ref:`change_sqlite_schemas`
2396
2397    .. change::
2398        :tags: change, mssql
2399        :tickets: 3434
2400
2401        The ``legacy_schema_aliasing`` flag, introduced in version 1.0.5
2402        as part of :ticket:`3424` to allow disabling of the MSSQL dialect's
2403        attempts to create aliases for schema-qualified tables, now defaults
2404        to False; the old behavior is now disabled unless explicitly turned on.
2405
2406        .. seealso::
2407
2408            :ref:`change_3434`
2409
2410    .. change::
2411        :tags: bug, orm
2412        :tickets: 3250
2413
2414        Added a new type-level modifier :meth:`.TypeEngine.evaluates_none`
2415        which indicates to the ORM that a positive set of None should be
2416        persisted as the value NULL, instead of omitting the column from
2417        the INSERT statement.  This feature is used both as part of the
2418        implementation for :ticket:`3514` as well as a standalone feature
2419        available on any type.
2420
2421        .. seealso::
2422
2423            :ref:`change_3250`
2424
2425    .. change::
2426        :tags: bug, postgresql
2427        :tickets: 2729
2428
2429        The use of a :class:`.postgresql.ARRAY` object that refers
2430        to a :class:`.types.Enum` or :class:`.postgresql.ENUM` subtype
2431        will now emit the expected "CREATE TYPE" and "DROP TYPE" DDL when
2432        the type is used within a "CREATE TABLE" or "DROP TABLE".
2433
2434        .. seealso::
2435
2436            :ref:`change_2729`
2437
2438    .. change::
2439        :tags: bug, sql
2440        :tickets: 3531
2441
2442        The :func:`.type_coerce` construct is now a fully fledged Core
2443        expression element which is late-evaluated at compile time.  Previously,
2444        the function was only a conversion function which would handle different
2445        expression inputs by returning either a :class:`.Label` of a column-oriented
2446        expression or a copy of a given :class:`.BindParameter` object,
2447        which in particular prevented the operation from being logically
2448        maintained when an ORM-level expression transformation would convert
2449        a column to a bound parameter (e.g. for lazy loading).
2450
2451        .. seealso::
2452
2453            :ref:`change_3531`
2454
2455    .. change::
2456        :tags: bug, orm
2457        :tickets: 3526
2458
2459        Internal calls to "bookkeeping" functions within
2460        :meth:`.Session.bulk_save_objects` and related bulk methods have
2461        been scaled back to the extent that this functionality is not
2462        currently used, e.g. checks for column default values to be
2463        fetched after an INSERT or UPDATE statement.
2464
2465    .. change::
2466        :tags: feature, orm
2467        :tickets: 2677
2468
2469        The :class:`.SessionEvents` suite now includes events to allow
2470        unambiguous tracking of all object lifecycle state transitions
2471        in terms of the :class:`.Session` itself, e.g. pending,
2472        transient,  persistent, detached.   The state of the object
2473        within each event is also defined.
2474
2475        .. seealso::
2476
2477            :ref:`change_2677`
2478
2479    .. change::
2480        :tags: feature, orm
2481        :tickets: 2677
2482
2483        Added a new session lifecycle state :term:`deleted`.  This new state
2484        represents an object that has been deleted from the :term:`persistent`
2485        state and will move to the :term:`detached` state once the transaction
2486        is committed.  This resolves the long-standing issue that objects
2487        which were deleted existed in a gray area between persistent and
2488        detached.   The :attr:`.InstanceState.persistent` accessor will
2489        **no longer** report on a deleted object as persistent; the
2490        :attr:`.InstanceState.deleted` accessor will instead be True for
2491        these objects, until they become detached.
2492
2493        .. seealso::
2494
2495            :ref:`change_2677`
2496
2497    .. change::
2498        :tags: change, orm
2499        :tickets: 2677
2500
2501        The :paramref:`.Session.weak_identity_map` parameter is deprecated.
2502        See the new recipe at :ref:`session_referencing_behavior` for
2503        an event-based approach to maintaining strong identity map behavior.
2504
2505        .. seealso::
2506
2507            :ref:`change_2677`
2508
2509    .. change::
2510        :tags: bug, sql
2511        :tickets: 2919
2512
2513        The :class:`.TypeDecorator` type extender will now work in conjunction
2514        with a :class:`.SchemaType` implementation, typically :class:`.Enum`
2515        or :class:`.Boolean` with regards to ensuring that the per-table
2516        events are propagated from the implementation type to the outer type.
2517        These events are used
2518        to ensure that the constraints or PostgreSQL types (e.g. ENUM)
2519        are correctly created (and possibly dropped) along with the parent
2520        table.
2521
2522        .. seealso::
2523
2524            :ref:`change_2919`
2525
2526    .. change::
2527        :tags: feature, sql
2528        :tickets: 1370
2529
2530        Added support for "set-aggregate" functions of the form
2531        ``<function> WITHIN GROUP (ORDER BY <criteria>)``, using the
2532        method :meth:`.FunctionElement.within_group`.  A series of common
2533        set-aggregate functions with return types derived from the set have
2534        been added. This includes functions like :class:`.percentile_cont`,
2535        :class:`.dense_rank` and others.
2536
2537        .. seealso::
2538
2539            :ref:`change_3132`
2540
2541    .. change::
2542        :tags: feature, sql, postgresql
2543        :tickets: 3132
2544
2545        Added support for the SQL-standard function :class:`.array_agg`,
2546        which automatically returns an :class:`.postgresql.ARRAY` of the correct type
2547        and supports index / slice operations, as well as
2548        :func:`.postgresql.array_agg`, which returns a :class:`.postgresql.ARRAY`
2549        with additional comparison features.   As arrays are only
2550        supported on PostgreSQL at the moment, only actually works on
2551        PostgreSQL.  Also added a new construct
2552        :class:`.postgresql.aggregate_order_by` in support of PG's
2553        "ORDER BY" extension.
2554
2555        .. seealso::
2556
2557            :ref:`change_3132`
2558
2559    .. change::
2560        :tags: feature, sql
2561        :tickets: 3516
2562
2563        Added a new type to core :class:`.types.ARRAY`.  This is the
2564        base of the PostgreSQL :class:`.postgresql.ARRAY` type, and is now part of Core
2565        to begin supporting various SQL-standard array-supporting features
2566        including some functions and eventual support for native arrays
2567        on other databases that have an "array" concept, such as DB2 or Oracle.
2568        Additionally, new operators :func:`.expression.any_` and
2569        :func:`.expression.all_` have been added.  These support not just
2570        array constructs on PostgreSQL, but also subqueries that are usable
2571        on MySQL (but sadly not on PostgreSQL).
2572
2573        .. seealso::
2574
2575            :ref:`change_3516`
2576
2577    .. change::
2578        :tags: feature, orm
2579        :tickets: 3321
2580
2581        Added new checks for the common error case of passing mapped classes
2582        or mapped instances into contexts where they are interpreted as
2583        SQL bound parameters; a new exception is raised for this.
2584
2585        .. seealso::
2586
2587            :ref:`change_3321`
2588
2589    .. change::
2590        :tags: bug, postgresql
2591        :tickets: 3499
2592
2593        The "hashable" flag on special datatypes such as :class:`.postgresql.ARRAY`,
2594        :class:`.postgresql.JSON` and :class:`.postgresql.HSTORE` is now
2595        set to False, which allows these types to be fetchable in ORM
2596        queries that include entities within the row.
2597
2598        .. seealso::
2599
2600            :ref:`change_3499`
2601
2602            :ref:`change_3499_postgresql`
2603
2604    .. change::
2605        :tags: bug, postgresql
2606        :tickets: 3487
2607
2608        The PostgreSQL :class:`.postgresql.ARRAY` type now supports multidimensional
2609        indexed access, e.g. expressions such as ``somecol[5][6]`` without
2610        any need for explicit casts or type coercions, provided
2611        that the :paramref:`.postgresql.ARRAY.dimensions` parameter is set to the
2612        desired number of dimensions.
2613
2614        .. seealso::
2615
2616            :ref:`change_3503`
2617
2618    .. change::
2619        :tags: bug, postgresql
2620        :tickets: 3503
2621
2622        The return type for the :class:`.postgresql.JSON` and :class:`.postgresql.JSONB`
2623        when using indexed access has been fixed to work like PostgreSQL itself,
2624        and returns an expression that itself is of type :class:`.postgresql.JSON`
2625        or :class:`.postgresql.JSONB`.  Previously, the accessor would return
2626        :class:`.NullType` which disallowed subsequent JSON-like operators to be
2627        used.
2628
2629        .. seealso::
2630
2631            :ref:`change_3503`
2632
2633    .. change::
2634        :tags: bug, postgresql
2635        :tickets: 3503
2636
2637        The :class:`.postgresql.JSON`, :class:`.postgresql.JSONB` and
2638        :class:`.postgresql.HSTORE` datatypes now allow full control over the
2639        return type from an indexed textual access operation, either ``column[someindex].astext``
2640        for a JSON type or ``column[someindex]`` for an HSTORE type,
2641        via the :paramref:`.postgresql.JSON.astext_type` and
2642        :paramref:`.postgresql.HSTORE.text_type` parameters.
2643
2644        .. seealso::
2645
2646            :ref:`change_3503`
2647
2648
2649    .. change::
2650        :tags: bug, postgresql
2651        :tickets: 3503
2652
2653        The :attr:`.postgresql.JSON.Comparator.astext` modifier no longer
2654        calls upon :meth:`.ColumnElement.cast` implicitly, as PG's JSON/JSONB
2655        types allow cross-casting between each other as well.  Code that
2656        makes use of :meth:`.ColumnElement.cast` on JSON indexed access,
2657        e.g. ``col[someindex].cast(Integer)``, will need to be changed
2658        to call :attr:`.postgresql.JSON.Comparator.astext` explicitly.
2659
2660        .. seealso::
2661
2662            :ref:`change_3503_cast`
2663
2664
2665    .. change::
2666        :tags: bug, orm, postgresql
2667        :tickets: 3514
2668
2669        Additional fixes have been made regarding the value of ``None``
2670        in conjunction with the PostgreSQL :class:`.postgresql.JSON` type.  When
2671        the :paramref:`.JSON.none_as_null` flag is left at its default
2672        value of ``False``, the ORM will now correctly insert the JSON
2673        "'null'" string into the column whenever the value on the ORM
2674        object is set to the value ``None`` or when the value ``None``
2675        is used with :meth:`.Session.bulk_insert_mappings`,
2676        **including** if the column has a default or server default on it.
2677
2678        .. seealso::
2679
2680            :ref:`change_3514`
2681
2682            :ref:`change_3250`
2683
2684    .. change::
2685        :tags: feature, postgresql
2686        :tickets: 3514
2687
2688        Added a new constant :attr:`.postgresql.JSON.NULL`, indicating
2689        that the JSON NULL value should be used for a value
2690        regardless of other settings.
2691
2692        .. seealso::
2693
2694            :ref:`change_3514_jsonnull`
2695
2696    .. change::
2697        :tags: bug, sql
2698        :tickets: 2528
2699
2700        The behavior of the :func:`.union` construct and related constructs
2701        such as :meth:`.Query.union` now handle the case where the embedded
2702        SELECT statements need to be parenthesized due to the fact that they
2703        include LIMIT, OFFSET and/or ORDER BY.   These queries **do not work
2704        on SQLite**, and will fail on that backend as they did before, but
2705        should now work on all other backends.
2706
2707        .. seealso::
2708
2709            :ref:`change_2528`
2710
2711    .. change::
2712        :tags: feature, orm
2713        :tickets: 3512
2714
2715        Added new relationship loading strategy :func:`.orm.raiseload` (also
2716        accessible via ``lazy='raise'``).  This strategy behaves almost like
2717        :func:`.orm.noload` but instead of returning ``None`` it raises an
2718        InvalidRequestError.  Pull request courtesy Adrian Moennich.
2719
2720        .. seealso::
2721
2722            :ref:`change_3512`
2723
2724    .. change::
2725        :tags: bug, mssql
2726        :tickets: 3504
2727
2728        Fixed issue where the SQL Server dialect would reflect a string-
2729        or other variable-length column type with unbounded length
2730        by assigning the token ``"max"`` to the
2731        length attribute of the string.   While using the ``"max"`` token
2732        explicitly is supported by the SQL Server dialect, it isn't part
2733        of the normal contract of the base string types, and instead the
2734        length should just be left as None.   The dialect now assigns the
2735        length to None on reflection of the type so that the type behaves
2736        normally in other contexts.
2737
2738        .. seealso::
2739
2740            :ref:`change_3504`
2741