1============= 20.9 Changelog 3============= 4 5.. changelog_imports:: 6 7 .. include:: changelog_08.rst 8 :start-line: 5 9 10 11 .. include:: changelog_07.rst 12 :start-line: 5 13 14 15.. _unreleased_changelog:: 16 :version: 0.9.11 17 18 .. change:: 19 :tags: bug, oracle, py3k 20 :tickets: 3491 21 :versions: 1.0.9 22 23 Fixed support for cx_Oracle version 5.2, which was tripping 24 up SQLAlchemy's version detection under Python 3 and inadvertently 25 not using the correct unicode mode for Python 3. This would cause 26 issues such as bound variables mis-interpreted as NULL and rows 27 silently not being returned. 28 29 .. change:: 30 :tags: bug, engine 31 :tickets: 3497 32 :versions: 1.0.8 33 34 Fixed critical issue whereby the pool "checkout" event handler 35 may be called against a stale connection without the "connect" 36 event handler having been called, in the case where the pool 37 attempted to reconnect after being invalidated and failed; the stale 38 connection would remain present and would be used on a subsequent 39 attempt. This issue has a greater impact in the 1.0 series subsequent 40 to 1.0.2, as it also delivers a blanked-out ``.info`` dictionary to 41 the event handler; prior to 1.0.2 the ``.info`` dictionary is still 42 the previous one. 43 44.. changelog:: 45 :version: 0.9.10 46 :released: July 22, 2015 47 48 .. change:: 49 :tags: bug, sqlite 50 :tickets: 3495 51 :versions: 1.0.8 52 53 Fixed bug in SQLite dialect where reflection of UNIQUE constraints 54 that included non-alphabetic characters in the names, like dots or 55 spaces, would not be reflected with their name. 56 57 .. change:: 58 :tags: feature, sql 59 :tickets: 3418 60 :versions: 1.0.5 61 62 Added official support for a CTE used by the SELECT present 63 inside of :meth:`_expression.Insert.from_select`. This behavior worked 64 accidentally up until 0.9.9, when it no longer worked due to 65 unrelated changes as part of :ticket:`3248`. Note that this 66 is the rendering of the WITH clause after the INSERT, before the 67 SELECT; the full functionality of CTEs rendered at the top 68 level of INSERT, UPDATE, DELETE is a new feature targeted for a 69 later release. 70 71 .. change:: 72 :tags: bug, ext 73 :tickets: 3408 74 :versions: 1.0.4 75 76 Fixed bug where when using extended attribute instrumentation system, 77 the correct exception would not be raised when :func:`.class_mapper` 78 were called with an invalid input that also happened to not 79 be weak referencable, such as an integer. 80 81 .. change:: 82 :tags: bug, tests, pypy 83 :tickets: 3406 84 :versions: 1.0.4 85 86 Fixed an import that prevented "pypy setup.py test" from working 87 correctly. 88 89 .. change:: 90 :tags: bug, engine 91 :tickets: 3375 92 :versions: 1.0.1 93 94 Added the string value ``"none"`` to those accepted by the 95 :paramref:`_pool.Pool.reset_on_return` parameter as a synonym for ``None``, 96 so that string values can be used for all settings, allowing 97 utilities like :func:`.engine_from_config` to be usable without 98 issue. 99 100 .. change:: 101 :tags: bug, sql 102 :tickets: 3362 103 :versions: 1.0.0 104 105 Fixed issue where a :class:`_schema.MetaData` object that used a naming 106 convention would not properly work with pickle. The attribute was 107 skipped leading to inconsistencies and failures if the unpickled 108 :class:`_schema.MetaData` object were used to base additional tables 109 from. 110 111 .. change:: 112 :tags: bug, postgresql 113 :tickets: 3354 114 :versions: 1.0.0 115 116 Fixed a long-standing bug where the :class:`.Enum` type as used 117 with the psycopg2 dialect in conjunction with non-ascii values 118 and ``native_enum=False`` would fail to decode return results properly. 119 This stemmed from when the PG :class:`_postgresql.ENUM` type used 120 to be a standalone type without a "non native" option. 121 122 .. change:: 123 :tags: bug, orm 124 :tickets: 3349 125 126 :class:`_query.Query` doesn't support joins, subselects, or special 127 FROM clauses when using the :meth:`_query.Query.update` or 128 :meth:`_query.Query.delete` methods; instead of silently ignoring these 129 fields if methods like :meth:`_query.Query.join` or 130 :meth:`_query.Query.select_from` has been called, a warning is emitted. 131 As of 1.0.0b5 this will raise an error. 132 133 .. change:: 134 :tags: bug, orm 135 :tickets: 3352 136 :versions: 1.0.0b5 137 138 Fixed bug where the state tracking within multiple, nested 139 :meth:`.Session.begin_nested` operations would fail to propagate 140 the "dirty" flag for an object that had been updated within 141 the inner savepoint, such that if the enclosing savepoint were 142 rolled back, the object would not be part of the state that was 143 expired and therefore reverted to its database state. 144 145 .. change:: 146 :tags: bug, mysql, pymysql 147 :tickets: 3337 148 :versions: 1.0.0b4 149 150 Fixed unicode support for PyMySQL when using an "executemany" 151 operation with unicode parameters. SQLAlchemy now passes both 152 the statement as well as the bound parameters as unicode 153 objects, as PyMySQL generally uses string interpolation 154 internally to produce the final statement, and in the case of 155 executemany does the "encode" step only on the final statement. 156 157 .. change:: 158 :tags: bug, py3k, mysql 159 :tickets: 3333 160 :versions: 1.0.0b2 161 162 Fixed the :class:`.mysql.BIT` type on Py3K which was not using the 163 ``ord()`` function correctly. Pull request courtesy David Marin. 164 165 .. change:: 166 :tags: bug, ext 167 :tickets: 3324 168 169 Fixed regression from 0.9.9 where the :func:`.as_declarative` 170 symbol was removed from the ``sqlalchemy.ext.declarative`` 171 namespace. 172 173 .. change:: 174 :tags: feature, orm 175 :tickets: 3320 176 :versions: 1.0.0b1 177 178 Added a new entry ``"entity"`` to the dictionaries returned by 179 :attr:`_query.Query.column_descriptions`. This refers to the primary ORM 180 mapped class or aliased class that is referred to by the expression. 181 Compared to the existing entry for ``"type"``, it will always be 182 a mapped entity, even if extracted from a column expression, or 183 None if the given expression is a pure core expression. 184 See also :ticket:`3403` which repaired a regression in this feature 185 which was unreleased in 0.9.10 but was released in the 1.0 version. 186 187 188.. changelog:: 189 :version: 0.9.9 190 :released: March 10, 2015 191 192 .. change:: 193 :tags: feature, postgresql 194 :versions: 1.0.0b1 195 196 Added support for the ``CONCURRENTLY`` keyword with PostgreSQL 197 indexes, established using ``postgresql_concurrently``. Pull 198 request courtesy Iuri de Silvio. 199 200 .. seealso:: 201 202 :ref:`postgresql_index_concurrently` 203 204 .. change:: 205 :tags: bug, ext, py3k 206 :versions: 1.0.0b1 207 208 Fixed bug where the association proxy list class would not interpret 209 slices correctly under Py3K. Pull request courtesy 210 Gilles Dartiguelongue. 211 212 .. change:: 213 :tags: feature, sqlite 214 :versions: 1.0.0b1 215 216 Added support for partial indexes (e.g. with a WHERE clause) on 217 SQLite. Pull request courtesy Kai Groner. 218 219 .. seealso:: 220 221 :ref:`sqlite_partial_index` 222 223 .. change:: 224 :tags: bug, orm 225 :tickets: 3310 226 :versions: 1.0.0b1 227 228 Fixed bugs in ORM object comparisons where comparison of 229 many-to-one ``!= None`` would fail if the source were an aliased 230 class, or if the query needed to apply special aliasing to the 231 expression due to aliased joins or polymorphic querying; also fixed 232 bug in the case where comparing a many-to-one to an object state 233 would fail if the query needed to apply special aliasing 234 due to aliased joins or polymorphic querying. 235 236 .. change:: 237 :tags: bug, orm 238 :tickets: 3309 239 :versions: 1.0.0b1 240 241 Fixed bug where internal assertion would fail in the case where 242 an ``after_rollback()`` handler for a :class:`.Session` incorrectly 243 adds state to that :class:`.Session` within the handler, and the task 244 to warn and remove this state (established by :ticket:`2389`) attempts 245 to proceed. 246 247 .. change:: 248 :tags: bug, orm 249 :versions: 1.0.0b1 250 251 Fixed bug where TypeError raised when :meth:`_query.Query.join` called 252 with unknown kw arguments would raise its own TypeError due 253 to broken formatting. Pull request courtesy Malthe Borch. 254 255 .. change:: 256 :tags: bug, engine 257 :tickets: 3302 258 :versions: 1.0.0b1 259 260 Fixed bug in :class:`_engine.Connection` and pool where the 261 :meth:`_engine.Connection.invalidate` method, or an invalidation due 262 to a database disconnect, would fail if the 263 ``isolation_level`` parameter had been used with 264 :meth:`_engine.Connection.execution_options`; the "finalizer" that resets 265 the isolation level would be called on the no longer opened connection. 266 267 .. change:: 268 :tags: feature, orm 269 :tickets: 3296 270 :versions: 1.0.0b1 271 272 Added new parameter :paramref:`.Session.connection.execution_options` 273 which may be used to set up execution options on a :class:`_engine.Connection` 274 when it is first checked out, before the transaction has begun. 275 This is used to set up options such as isolation level on the 276 connection before the transaction starts. 277 278 .. seealso:: 279 280 :ref:`session_transaction_isolation` - new documentation section 281 detailing best practices for setting transaction isolation with 282 sessions. 283 284 .. change:: 285 :tags: bug, engine 286 :tickets: 3296 287 :versions: 1.0.0b1 288 289 A warning is emitted if the ``isolation_level`` parameter is used 290 with :meth:`_engine.Connection.execution_options` when a :class:`.Transaction` 291 is in play; DBAPIs and/or SQLAlchemy dialects such as psycopg2, 292 MySQLdb may implicitly rollback or commit the transaction, or 293 not change the setting til next transaction, so this is never safe. 294 295 .. change:: 296 :tags: bug, orm 297 :tickets: 3300 298 :versions: 1.0.0b1 299 300 Fixed bug in lazy loading SQL construction whereby a complex 301 primaryjoin that referred to the same "local" column multiple 302 times in the "column that points to itself" style of self-referential 303 join would not be substituted in all cases. The logic to determine 304 substitutions here has been reworked to be more open-ended. 305 306 .. change:: 307 :tags: bug, postgresql 308 :tickets: 2940 309 :versions: 1.0.0b1 310 311 Repaired support for PostgreSQL UUID types in conjunction with 312 the ARRAY type when using psycopg2. The psycopg2 dialect now 313 employs use of the psycopg2.extras.register_uuid() hook 314 so that UUID values are always passed to/from the DBAPI as 315 UUID() objects. The :paramref:`.UUID.as_uuid` flag is still 316 honored, except with psycopg2 we need to convert returned 317 UUID objects back into strings when this is disabled. 318 319 .. change:: 320 :tags: bug, postgresql 321 :versions: 1.0.0b1 322 323 Added support for the :class:`postgresql.JSONB` datatype when 324 using psycopg2 2.5.4 or greater, which features native conversion 325 of JSONB data so that SQLAlchemy's converters must be disabled; 326 additionally, the newly added psycopg2 extension 327 ``extras.register_default_jsonb`` is used to establish a JSON 328 deserializer passed to the dialect via the ``json_deserializer`` 329 argument. Also repaired the PostgreSQL integration tests which 330 weren't actually round-tripping the JSONB type as opposed to the 331 JSON type. Pull request courtesy Mateusz Susik. 332 333 .. change:: 334 :tags: bug, postgresql 335 :versions: 1.0.0b1 336 337 Repaired the use of the "array_oid" flag when registering the 338 HSTORE type with older psycopg2 versions < 2.4.3, which does not 339 support this flag, as well as use of the native json serializer 340 hook "register_default_json" with user-defined ``json_deserializer`` 341 on psycopg2 versions < 2.5, which does not include native json. 342 343 .. change:: 344 :tags: bug, schema 345 :tickets: 3298, 1765 346 347 Fixed bug in 0.9's foreign key setup system, such that 348 the logic used to link a :class:`_schema.ForeignKey` to its parent could fail 349 when the foreign key used "link_to_name=True" in conjunction with 350 a target :class:`_schema.Table` that would not receive its parent column until 351 later, such as within a reflection + "useexisting" scenario, 352 if the target column in fact had a key value different from its name, 353 as would occur in reflection if column reflect events were used to 354 alter the .key of reflected :class:`_schema.Column` objects so that the 355 link_to_name becomes significant. Also repaired support for column 356 type via FK transmission in a similar way when target columns had a 357 different key and were referenced using link_to_name. 358 359 .. change:: 360 :tags: feature, engine 361 :versions: 1.0.0b1 362 363 Added new user-space accessors for viewing transaction isolation 364 levels; :meth:`_engine.Connection.get_isolation_level`, 365 :attr:`_engine.Connection.default_isolation_level`. 366 367 .. change:: 368 :tags: bug, postgresql 369 :versions: 1.0.0b1 370 :tickets: 3174 371 372 Fixed bug where PostgreSQL dialect would fail to render an 373 expression in an :class:`.Index` that did not correspond directly 374 to a table-bound column; typically when a :func:`_expression.text` construct 375 was one of the expressions within the index; or could misinterpret the 376 list of expressions if one or more of them were such an expression. 377 378 .. change:: 379 :tags: bug, orm 380 :versions: 1.0.0b1 381 :tickets: 3287 382 383 The "wildcard" loader options, in particular the one set up by 384 the :func:`_orm.load_only` option to cover all attributes not 385 explicitly mentioned, now takes into account the superclasses 386 of a given entity, if that entity is mapped with inheritance mapping, 387 so that attribute names within the superclasses are also omitted 388 from the load. Additionally, the polymorphic discriminator column 389 is unconditionally included in the list, just in the same way that 390 primary key columns are, so that even with load_only() set up, 391 polymorphic loading of subtypes continues to function correctly. 392 393 .. change:: 394 :tags: bug, sql 395 :versions: 1.0.0b1 396 397 Added the ``native_enum`` flag to the ``__repr__()`` output 398 of :class:`.Enum`, which is mostly important when using it with 399 Alembic autogenerate. Pull request courtesy Dimitris Theodorou. 400 401 .. change:: 402 :tags: bug, orm, pypy 403 :versions: 1.0.0b1 404 :tickets: 3285 405 406 Fixed bug where if an exception were thrown at the start of a 407 :class:`_query.Query` before it fetched results, particularly when 408 row processors can't be formed, the cursor would stay open with 409 results pending and not actually be closed. This is typically only 410 an issue on an interpreter like PyPy where the cursor isn't 411 immediately GC'ed, and can in some circumstances lead to transactions/ 412 locks being open longer than is desirable. 413 414 .. change:: 415 :tags: change, mysql 416 :versions: 1.0.0b1 417 :tickets: 3275 418 419 The ``gaerdbms`` dialect is no longer necessary, and emits a 420 deprecation warning. Google now recommends using the MySQLdb 421 dialect directly. 422 423 .. change:: 424 :tags: bug, sql 425 :versions: 1.0.0b1 426 :tickets: 3278 427 428 Fixed bug where using a :class:`.TypeDecorator` that implemented 429 a type that was also a :class:`.TypeDecorator` would fail with 430 Python's "Cannot create a consistent method resolution order (MRO)" 431 error, when any kind of SQL comparison expression were used against 432 an object using this type. 433 434 .. change:: 435 :tags: bug, mysql 436 :versions: 1.0.0b1 437 :tickets: 3274 438 439 Added a version check to the MySQLdb dialect surrounding the 440 check for 'utf8_bin' collation, as this fails on MySQL server < 5.0. 441 442 .. change:: 443 :tags: feature, orm 444 :versions: 1.0.0b1 445 446 Added new method :meth:`.Session.invalidate`, functions similarly 447 to :meth:`.Session.close`, except also calls 448 :meth:`_engine.Connection.invalidate` 449 on all connections, guaranteeing that they will not be returned to 450 the connection pool. This is useful in situations e.g. dealing 451 with gevent timeouts when it is not safe to use the connection further, 452 even for rollbacks. 453 454 .. change:: 455 :tags: bug, examples 456 :versions: 1.0.0b1 457 458 Updated the :ref:`examples_versioned_history` example such that 459 mapped columns are re-mapped to 460 match column names as well as grouping of columns; in particular, 461 this allows columns that are explicitly grouped in a same-column-named 462 joined inheritance scenario to be mapped in the same way in the 463 history mappings, avoiding warnings added in the 0.9 series 464 regarding this pattern and allowing the same view of attribute 465 keys. 466 467 .. change:: 468 :tags: bug, examples 469 :versions: 1.0.0b1 470 471 Fixed a bug in the examples/generic_associations/discriminator_on_association.py 472 example, where the subclasses of AddressAssociation were not being 473 mapped as "single table inheritance", leading to problems when trying 474 to use the mappings further. 475 476 .. change:: 477 :tags: bug, orm 478 :versions: 1.0.0b1 479 :tickets: 3251 480 481 Fixed a leak which would occur in the unsupported and highly 482 non-recommended use case of replacing a relationship on a fixed 483 mapped class many times, referring to an arbitrarily growing number of 484 target mappers. A warning is emitted when the old relationship is 485 replaced, however if the mapping were already used for querying, the 486 old relationship would still be referenced within some registries. 487 488 .. change:: 489 :tags: bug, sql 490 :versions: 1.0.0b1 491 :tickets: 3248 492 493 Fixed issue where the columns from a SELECT embedded in an 494 INSERT, either through the values clause or as a "from select", 495 would pollute the column types used in the result set produced by 496 the RETURNING clause when columns from both statements shared the 497 same name, leading to potential errors or mis-adaptation when 498 retrieving the returning rows. 499 500 .. change:: 501 :tags: bug, orm, sqlite 502 :versions: 1.0.0b1 503 :tickets: 3241 504 505 Fixed bug regarding expression mutations which could express 506 itself as a "Could not locate column" error when using 507 :class:`_query.Query` to select from multiple, anonymous column 508 entities when querying against SQLite, as a side effect of the 509 "join rewriting" feature used by the SQLite dialect. 510 511 .. change:: 512 :tags: feature, sqlite 513 :versions: 1.0.0b1 514 515 Added a new SQLite backend for the SQLCipher backend. This backend 516 provides for encrypted SQLite databases using the pysqlcipher Python 517 driver, which is very similar to the pysqlite driver. 518 519 .. seealso:: 520 521 :mod:`~sqlalchemy.dialects.sqlite.pysqlcipher` 522 523 .. change:: 524 :tags: bug, orm 525 :tickets: 3232 526 :versions: 1.0.0b1 527 528 Fixed bug where the ON clause for :meth:`_query.Query.join`, 529 and :meth:`_query.Query.outerjoin` to a single-inheritance subclass 530 using ``of_type()`` would not render the "single table criteria" in 531 the ON clause if the ``from_joinpoint=True`` flag were set. 532 533.. changelog:: 534 :version: 0.9.8 535 :released: October 13, 2014 536 537 .. change:: 538 :tags: bug, mysql, mysqlconnector 539 :versions: 1.0.0b1 540 541 Mysqlconnector as of version 2.0, probably as a side effect of 542 the python 3 merge, now does not expect percent signs (e.g. 543 as used as the modulus operator and others) to be doubled, 544 even when using the "pyformat" bound parameter format (this 545 change is not documented by Mysqlconnector). The dialect now 546 checks for py2k and for mysqlconnector less than version 2.0 547 when detecting if the modulus operator should be rendered as 548 ``%%`` or ``%``. 549 550 .. change:: 551 :tags: bug, mysql, mysqlconnector 552 :versions: 1.0.0b1 553 554 Unicode SQL is now passed for MySQLconnector version 2.0 and above; 555 for Py2k and MySQL < 2.0, strings are encoded. 556 557 558 .. change:: 559 :tags: bug, oracle 560 :versions: 1.0.0b1 561 :tickets: 2138 562 563 Fixed long-standing bug in Oracle dialect where bound parameter 564 names that started with numbers would not be quoted, as Oracle 565 doesn't like numerics in bound parameter names. 566 567 .. change:: 568 :tags: bug, sql 569 :versions: 1.0.0b1 570 :tickets: 3195 571 572 Fixed bug where a fair number of SQL elements within 573 the sql package would fail to ``__repr__()`` successfully, 574 due to a missing ``description`` attribute that would then invoke 575 a recursion overflow when an internal AttributeError would then 576 re-invoke ``__repr__()``. 577 578 .. change:: 579 :tags: bug, declarative, orm 580 :versions: 1.0.0b1 581 :tickets: 3185 582 583 Fixed "'NoneType' object has no attribute 'concrete'" error 584 when using :class:`.AbstractConcreteBase` in conjunction with 585 a subclass that declares ``__abstract__``. 586 587 .. change:: 588 :tags: bug, engine 589 :versions: 1.0.0b1 590 :tickets: 3200 591 592 The execution options passed to an :class:`_engine.Engine` either via 593 :paramref:`_sa.create_engine.execution_options` or 594 :meth:`_engine.Engine.update_execution_options` are not passed to the 595 special :class:`_engine.Connection` used to initialize the dialect 596 within the "first connect" event; dialects will usually 597 perform their own queries in this phase, and none of the 598 current available options should be applied here. In 599 particular, the "autocommit" option was causing an attempt to 600 autocommit within this initial connect which would fail with 601 an AttributeError due to the non-standard state of the 602 :class:`_engine.Connection`. 603 604 .. change:: 605 :tags: bug, sqlite 606 :versions: 1.0.0b1 607 :tickets: 3211 608 609 When selecting from a UNION using an attached database file, 610 the pysqlite driver reports column names in cursor.description 611 as 'dbname.tablename.colname', instead of 'tablename.colname' as 612 it normally does for a UNION (note that it's supposed to just be 613 'colname' for both, but we work around it). The column translation 614 logic here has been adjusted to retrieve the rightmost token, rather 615 than the second token, so it works in both cases. Workaround 616 courtesy Tony Roberts. 617 618 .. change:: 619 :tags: bug, postgresql 620 :versions: 1.0.0b1 621 :tickets: 3021 622 623 A revisit to this issue first patched in 0.9.5, apparently 624 psycopg2's ``.closed`` accessor is not as reliable as we assumed, 625 so we have added an explicit check for the exception messages 626 "SSL SYSCALL error: Bad file descriptor" and 627 "SSL SYSCALL error: EOF detected" when detecting an 628 is-disconnect scenario. We will continue to consult psycopg2's 629 connection.closed as a first check. 630 631 .. change:: 632 :tags: bug, orm, engine 633 :versions: 1.0.0b1 634 :tickets: 3197 635 636 Fixed bug that affected generally the same classes of event 637 as that of :ticket:`3199`, when the ``named=True`` parameter 638 would be used. Some events would fail to register, and others 639 would not invoke the event arguments correctly, generally in the 640 case of when an event was "wrapped" for adaption in some other way. 641 The "named" mechanics have been rearranged to not interfere with 642 the argument signature expected by internal wrapper functions. 643 644 .. change:: 645 :tags: bug, declarative 646 :versions: 1.0.0b1 647 :tickets: 3208 648 649 Fixed an unlikely race condition observed in some exotic end-user 650 setups, where the attempt to check for "duplicate class name" in 651 declarative would hit upon a not-totally-cleaned-up weak reference 652 related to some other class being removed; the check here now ensures 653 the weakref still references an object before calling upon it further. 654 655 .. change:: 656 :tags: bug, orm 657 :versions: 1.0.0b1 658 :tickets: 3199 659 660 Fixed bug that affected many classes of event, particularly 661 ORM events but also engine events, where the usual logic of 662 "de duplicating" a redundant call to :func:`.event.listen` 663 with the same arguments would fail, for those events where the 664 listener function is wrapped. An assertion would be hit within 665 registry.py. This assertion has now been integrated into the 666 deduplication check, with the added bonus of a simpler means 667 of checking deduplication across the board. 668 669 .. change:: 670 :tags: bug, mssql 671 :versions: 1.0.0b1 672 :tickets: 3151 673 674 Fixed the version string detection in the pymssql dialect to 675 work with Microsoft SQL Azure, which changes the word "SQL Server" 676 to "SQL Azure". 677 678 .. change:: 679 :tags: bug, orm 680 :versions: 1.0.0b1 681 :tickets: 3194 682 683 Fixed warning that would emit when a complex self-referential 684 primaryjoin contained functions, while at the same time remote_side 685 was specified; the warning would suggest setting "remote side". 686 It now only emits if remote_side isn't present. 687 688 .. change:: 689 :tags: bug, ext 690 :versions: 1.0.0b1 691 :tickets: 3191 692 693 Fixed bug in ordering list where the order of items would be 694 thrown off during a collection replace event, if the 695 reorder_on_append flag were set to True. The fix ensures that the 696 ordering list only impacts the list that is explicitly associated 697 with the object. 698 699 .. change:: 700 :tags: bug, sql 701 :versions: 1.0.0b1 702 :tickets: 3180 703 704 An adjustment to table/index reflection such that if an index 705 reports a column that isn't found to be present in the table, 706 a warning is emitted and the column is skipped. This can occur 707 for some special system column situations as has been observed 708 with Oracle. 709 710 .. change:: 711 :tags: bug, ext 712 :versions: 1.0.0b1 713 714 Fixed bug where :class:`.ext.mutable.MutableDict` 715 failed to implement the ``update()`` dictionary method, thus 716 not catching changes. Pull request courtesy Matt Chisholm. 717 718 .. change:: 719 :tags: bug, ext 720 :versions: 1.0.0b1 721 722 Fixed bug where a custom subclass of :class:`.ext.mutable.MutableDict` 723 would not show up in a "coerce" operation, and would instead 724 return a plain :class:`.ext.mutable.MutableDict`. Pull request 725 courtesy Matt Chisholm. 726 727 .. change:: 728 :tags: bug, pool 729 :versions: 1.0.0b1 730 :tickets: 3168 731 732 Fixed bug in connection pool logging where the "connection checked out" 733 debug logging message would not emit if the logging were set up using 734 ``logging.setLevel()``, rather than using the ``echo_pool`` flag. 735 Tests to assert this logging have been added. This is a 736 regression that was introduced in 0.9.0. 737 738 .. change:: 739 :tags: feature, postgresql, pg8000 740 :versions: 1.0.0b1 741 742 Support is added for "sane multi row count" with the pg8000 driver, 743 which applies mostly to when using versioning with the ORM. 744 The feature is version-detected based on pg8000 1.9.14 or greater 745 in use. Pull request courtesy Tony Locke. 746 747 .. change:: 748 :tags: bug, engine 749 :versions: 1.0.0b1 750 :tickets: 3165 751 752 The string keys that are used to determine the columns impacted 753 for an INSERT or UPDATE are now sorted when they contribute towards 754 the "compiled cache" cache key. These keys were previously not 755 deterministically ordered, meaning the same statement could be 756 cached multiple times on equivalent keys, costing both in terms of 757 memory as well as performance. 758 759 .. change:: 760 :tags: bug, postgresql 761 :versions: 1.0.0b1 762 :tickets: 3159 763 764 Fixed bug where PostgreSQL JSON type was not able to persist or 765 otherwise render a SQL NULL column value, rather than a JSON-encoded 766 ``'null'``. To support this case, changes are as follows: 767 768 * The value :func:`.null` can now be specified, which will always 769 result in a NULL value resulting in the statement. 770 771 * A new parameter :paramref:`_types.JSON.none_as_null` is added, which 772 when True indicates that the Python ``None`` value should be 773 persisted as SQL NULL, rather than JSON-encoded ``'null'``. 774 775 Retrieval of NULL as None is also repaired for DBAPIs other than 776 psycopg2, namely pg8000. 777 778 .. change:: 779 :tags: bug, sql 780 :versions: 1.0.0b1 781 :tickets: 3154 782 783 Fixed bug in CTE where ``literal_binds`` compiler argument would not 784 be always be correctly propagated when one CTE referred to another 785 aliased CTE in a statement. 786 787 .. change:: 788 :tags: bug, postgresql 789 :versions: 1.0.0b1 790 :tickets: 3075 791 792 The exception wrapping system for DBAPI errors can now accommodate 793 non-standard DBAPI exceptions, such as the psycopg2 794 TransactionRollbackError. These exceptions will now be raised 795 using the closest available subclass in ``sqlalchemy.exc``, in the 796 case of TransactionRollbackError, ``sqlalchemy.exc.OperationalError``. 797 798 .. change:: 799 :tags: bug, sql 800 :versions: 1.0.0b1 801 :tickets: 3144, 3067 802 803 Fixed 0.9.7 regression caused by :ticket:`3067` in conjunction with 804 a mis-named unit test such that so-called "schema" types like 805 :class:`.Boolean` and :class:`.Enum` could no longer be pickled. 806 807 .. change:: 808 :tags: bug, postgresql 809 :versions: 1.0.0b1 810 :tickets: 3141 811 812 Fixed bug in :class:`_postgresql.array` object where comparison 813 to a plain Python list would fail to use the correct array constructor. 814 Pull request courtesy Andrew. 815 816 .. change:: 817 :tags: bug, postgresql 818 :versions: 1.0.0b1 819 :tickets: 3137 820 821 Added a supported :meth:`.FunctionElement.alias` method to functions, 822 e.g. the ``func`` construct. Previously, behavior for this method 823 was undefined. The current behavior mimics that of pre-0.9.4, 824 which is that the function is turned into a single-column FROM 825 clause with the given alias name, where the column itself is 826 anonymously named. 827 828.. changelog:: 829 :version: 0.9.7 830 :released: July 22, 2014 831 832 .. change:: 833 :tags: bug, postgresql, pg8000 834 :tickets: 3134 835 :versions: 1.0.0b1 836 837 Fixed bug introduced in 0.9.5 by new pg8000 isolation level feature 838 where engine-level isolation level parameter would raise an error 839 on connect. 840 841 .. change:: 842 :tags: bug, oracle, tests 843 :tickets: 3128 844 :versions: 1.0.0b1 845 846 Fixed bug in oracle dialect test suite where in one test, 847 'username' was assumed to be in the database URL, even though 848 this might not be the case. 849 850 .. change:: 851 :tags: bug, orm, eagerloading 852 :tickets: 3131 853 :versions: 1.0.0b1 854 855 Fixed a regression caused by :ticket:`2976` released in 0.9.4 where 856 the "outer join" propagation along a chain of joined eager loads 857 would incorrectly convert an "inner join" along a sibling join path 858 into an outer join as well, when only descendant paths should be 859 receiving the "outer join" propagation; additionally, fixed related 860 issue where "nested" join propagation would take place inappropriately 861 between two sibling join paths. 862 863 .. change:: 864 :tags: bug, sqlite 865 :tickets: 3130 866 :versions: 1.0.0b1 867 868 Fixed a SQLite join rewriting issue where a subquery that is embedded 869 as a scalar subquery such as within an IN would receive inappropriate 870 substitutions from the enclosing query, if the same table were present 871 inside the subquery as were in the enclosing query such as in a 872 joined inheritance scenario. 873 874 .. change:: 875 :tags: bug, sql 876 :tickets: 3067 877 :versions: 1.0.0b1 878 879 Fix bug in naming convention feature where using a check 880 constraint convention that includes ``constraint_name`` would 881 then force all :class:`.Boolean` and :class:`.Enum` types to 882 require names as well, as these implicitly create a 883 constraint, even if the ultimate target backend were one that does 884 not require generation of the constraint such as PostgreSQL. 885 The mechanics of naming conventions for these particular 886 constraints has been reorganized such that the naming 887 determination is done at DDL compile time, rather than at 888 constraint/table construction time. 889 890 .. change:: 891 :tags: bug, mssql 892 :tickets: 3025 893 894 Fixed a regression from 0.9.5 caused by :ticket:`3025` where the 895 query used to determine "default schema" is invalid in SQL Server 2000. 896 For SQL Server 2000 we go back to defaulting to the "schema name" 897 parameter of the dialect, which is configurable but defaults 898 to 'dbo'. 899 900 .. change:: 901 :tags: bug, orm 902 :tickets: 3083, 2736 903 :versions: 1.0.0b1 904 905 Fixed a regression from 0.9.0 due to :ticket:`2736` where the 906 :meth:`_query.Query.select_from` method no longer set up the "from 907 entity" of the :class:`_query.Query` object correctly, so that 908 subsequent :meth:`_query.Query.filter_by` or :meth:`_query.Query.join` 909 calls would fail to check the appropriate "from" entity when 910 searching for attributes by string name. 911 912 .. change:: 913 :tags: bug, sql 914 :tickets: 3090 915 :versions: 1.0.0b1 916 917 Fixed bug in common table expressions whereby positional bound 918 parameters could be expressed in the wrong final order 919 when CTEs were nested in certain ways. 920 921 .. change:: 922 :tags: bug, sql 923 :tickets: 3069 924 :versions: 1.0.0b1 925 926 Fixed bug where multi-valued :class:`_expression.Insert` construct would fail 927 to check subsequent values entries beyond the first one given 928 for literal SQL expressions. 929 930 .. change:: 931 :tags: bug, sql 932 :tickets: 3123 933 :versions: 1.0.0b1 934 935 Added a "str()" step to the dialect_kwargs iteration for 936 Python version < 2.6.5, working around the 937 "no unicode keyword arg" bug as these args are passed along as 938 keyword args within some reflection processes. 939 940 .. change:: 941 :tags: bug, sql 942 :tickets: 3122 943 :versions: 1.0.0b1 944 945 The :meth:`.TypeEngine.with_variant` method will now accept a 946 type class as an argument which is internally converted to an 947 instance, using the same convention long established by other 948 constructs such as :class:`_schema.Column`. 949 950 .. change:: 951 :tags: bug, orm 952 :tickets: 3117 953 954 The "evaluator" for query.update()/delete() won't work with multi-table 955 updates, and needs to be set to `synchronize_session=False` or 956 `synchronize_session='fetch'`; a warning is now emitted. In 957 1.0 this will be promoted to a full exception. 958 959 .. change:: 960 :tags: bug, tests 961 :versions: 1.0.0b1 962 963 Fixed bug where "python setup.py test" wasn't calling into 964 distutils appropriately, and errors would be emitted at the end 965 of the test suite. 966 967 .. change:: 968 :tags: feature, postgresql 969 :versions: 1.0.0b1 970 :tickets: 3078 971 972 Added kw argument ``postgresql_regconfig`` to the 973 :meth:`.ColumnOperators.match` operator, allows the "reg config" argument 974 to be specified to the ``to_tsquery()`` function emitted. 975 Pull request courtesy Jonathan Vanasco. 976 977 .. change:: 978 :tags: feature, postgresql 979 :versions: 1.0.0b1 980 981 Added support for PostgreSQL JSONB via :class:`_postgresql.JSONB`. Pull request 982 courtesy Damian Dimmich. 983 984 .. change:: 985 :tags: feature, mssql 986 :versions: 1.0.0b1 987 988 Enabled "multivalues insert" for SQL Server 2008. Pull request 989 courtesy Albert Cervin. Also expanded the checks for "IDENTITY INSERT" 990 mode to include when the identity key is present in the 991 VALUEs clause of the statement. 992 993 .. change:: 994 :tags: feature, engine 995 :tickets: 3076 996 :versions: 1.0.0b1 997 998 Added new event :meth:`_events.ConnectionEvents.handle_error`, a more 999 fully featured and comprehensive replacement for 1000 :meth:`_events.ConnectionEvents.dbapi_error`. 1001 1002 .. change:: 1003 :tags: bug, orm 1004 :tickets: 3108 1005 :versions: 1.0.0b1 1006 1007 Fixed bug where items that were persisted, deleted, or had a 1008 primary key change within a savepoint block would not 1009 participate in being restored to their former state (not in 1010 session, in session, previous PK) after the outer transaction 1011 were rolled back. 1012 1013 .. change:: 1014 :tags: bug, orm 1015 :tickets: 3106 1016 :versions: 1.0.0b1 1017 1018 Fixed bug in subquery eager loading in conjunction with 1019 :func:`.with_polymorphic`, the targeting of entities and columns 1020 in the subquery load has been made more accurate with respect 1021 to this type of entity and others. 1022 1023 .. change:: 1024 :tags: bug, orm 1025 :tickets: 3099 1026 1027 Fixed bug involving dynamic attributes, that was again a regression 1028 of :ticket:`3060` from version 0.9.5. A self-referential relationship 1029 with lazy='dynamic' would raise a TypeError within a flush operation. 1030 1031 .. change:: 1032 :tags: bug, declarative 1033 :tickets: 3097 1034 :versions: 1.0.0b1 1035 1036 Fixed bug when the declarative ``__abstract__`` flag was not being 1037 distinguished for when it was actually the value ``False``. 1038 The ``__abstract__`` flag needs to actually evaluate to a True 1039 value at the level being tested. 1040 1041.. changelog:: 1042 :version: 0.9.6 1043 :released: June 23, 2014 1044 1045 .. change:: 1046 :tags: bug, orm 1047 :tickets: 3060 1048 1049 Reverted the change for :ticket:`3060` - this is a unit of work 1050 fix that is updated more comprehensively in 1.0 via :ticket:`3061`. 1051 The fix in :ticket:`3060` unfortunately produces a new issue whereby 1052 an eager load of a many-to-one attribute can produce an event 1053 that is interpreted into an attribute change. 1054 1055.. changelog:: 1056 :version: 0.9.5 1057 :released: June 23, 2014 1058 1059 .. change:: 1060 :tags: bug, orm 1061 :tickets: 3042 1062 :versions: 1.0.0b1 1063 1064 Additional checks have been added for the case where an inheriting 1065 mapper is implicitly combining one of its column-based attributes 1066 with that of the parent, where those columns normally don't necessarily 1067 share the same value. This is an extension of an existing check that 1068 was added via :ticket:`1892`; however this new check emits only a 1069 warning, instead of an exception, to allow for applications that may 1070 be relying upon the existing behavior. 1071 1072 .. seealso:: 1073 1074 :ref:`faq_combining_columns` 1075 1076 .. change:: 1077 :tags: bug, sql 1078 :tickets: 3023 1079 :versions: 1.0.0b1 1080 1081 The :paramref:`_schema.Column.nullable` flag is implicitly set to ``False`` 1082 when that :class:`_schema.Column` is referred to in an explicit 1083 :class:`.PrimaryKeyConstraint` for that table. This behavior now 1084 matches that of when the :class:`_schema.Column` itself has the 1085 :paramref:`_schema.Column.primary_key` flag set to ``True``, which is 1086 intended to be an exactly equivalent case. 1087 1088 .. change:: 1089 :tags: enhancement, postgresql 1090 :tickets: 3002 1091 :versions: 1.0.0b1 1092 1093 Added a new type :class:`_postgresql.OID` to the PostgreSQL dialect. 1094 While "oid" is generally a private type within PG that is not exposed 1095 in modern versions, there are some PG use cases such as large object 1096 support where these types might be exposed, as well as within some 1097 user-reported schema reflection use cases. 1098 1099 .. change:: 1100 :tags: bug, orm 1101 :tickets: 3080 1102 :versions: 1.0.0b1 1103 1104 Modified the behavior of :func:`_orm.load_only` such that primary key 1105 columns are always added to the list of columns to be "undeferred"; 1106 otherwise, the ORM can't load the row's identity. Apparently, 1107 one can defer the mapped primary keys and the ORM will fail, that 1108 hasn't been changed. But as load_only is essentially saying 1109 "defer all but X", it's more critical that PK cols not be part of this 1110 deferral. 1111 1112 .. change:: 1113 :tags: feature, examples 1114 :versions: 1.0.0b1 1115 1116 Added a new example illustrating materialized paths, using the 1117 latest relationship features. Example courtesy Jack Zhou. 1118 1119 .. change:: 1120 :tags: bug, testsuite 1121 :versions: 1.0.0b1 1122 1123 In public test suite, changed to use of ``String(40)`` from 1124 less-supported ``Text`` in ``StringTest.test_literal_backslashes``. 1125 Pullreq courtesy Jan. 1126 1127 .. change:: 1128 :tags: bug, engine 1129 :versions: 1.0.0b1 1130 :tickets: 3063 1131 1132 Fixed bug which would occur if a DBAPI exception 1133 occurs when the engine first connects and does its initial checks, 1134 and the exception is not a disconnect exception, yet the cursor 1135 raises an error when we try to close it. In this case the real 1136 exception would be quashed as we tried to log the cursor close 1137 exception via the connection pool and failed, as we were trying 1138 to access the pool's logger in a way that is inappropriate 1139 in this very specific scenario. 1140 1141 .. change:: 1142 :tags: feature, postgresql 1143 :versions: 1.0.0b1 1144 1145 Added support for AUTOCOMMIT isolation level when using the pg8000 1146 DBAPI. Pull request courtesy Tony Locke. 1147 1148 .. change:: 1149 :tags: bug, postgresql 1150 :tickets: 3021 1151 :versions: 1.0.0b1 1152 1153 The psycopg2 ``.closed`` accessor is now consulted when determining 1154 if an exception is a "disconnect" error; ideally, this should remove 1155 the need for any other inspection of the exception message to detect 1156 disconnect, however we will leave those existing messages in place 1157 as a fallback. This should be able to handle newer cases like 1158 "SSL EOF" conditions. Pull request courtesy Dirk Mueller. 1159 1160 .. change:: 1161 :tags: bug, orm 1162 :tickets: 3060 1163 :versions: 1.0.0b1 1164 1165 Fixed a few edge cases which arise in the so-called "row switch" 1166 scenario, where an INSERT/DELETE can be turned into an UPDATE. 1167 In this situation, a many-to-one relationship set to None, or 1168 in some cases a scalar attribute set to None, may not be detected 1169 as a net change in value, and therefore the UPDATE would not reset 1170 what was on the previous row. This is due to some as-yet 1171 unresolved side effects of the way attribute history works in terms 1172 of implicitly assuming None isn't really a "change" for a previously 1173 un-set attribute. See also :ticket:`3061`. 1174 1175 .. note:: 1176 1177 This change has been **REVERTED** in 0.9.6. The full fix 1178 will be in version 1.0 of SQLAlchemy. 1179 1180 1181 .. change:: 1182 :tags: bug, orm 1183 :versions: 1.0.0b1 1184 1185 Related to :ticket:`3060`, an adjustment has been made to the unit 1186 of work such that loading for related many-to-one objects is slightly 1187 more aggressive, in the case of a graph of self-referential objects 1188 that are to be deleted; the load of related objects is to help 1189 determine the correct order for deletion if passive_deletes is 1190 not set. 1191 1192 .. change:: 1193 :tags: bug, orm 1194 :tickets: 3057 1195 :versions: 1.0.0b1 1196 1197 Fixed bug in SQLite join rewriting where anonymized column names 1198 due to repeats would not correctly be rewritten in subqueries. 1199 This would affect SELECT queries with any kind of subquery + join. 1200 1201 .. change:: 1202 :tags: bug, sql 1203 :tickets: 3012 1204 :versions: 1.0.0b1 1205 1206 Fixed bug where the :meth:`.Operators.__and__`, 1207 :meth:`.Operators.__or__` and :meth:`.Operators.__invert__` 1208 operator overload methods could not be overridden within a custom 1209 :class:`.TypeEngine.Comparator` implementation. 1210 1211 .. change:: 1212 :tags: feature, postgresql 1213 :tickets: 2785 1214 :versions: 1.0.0b1 1215 1216 Added a new flag :paramref:`_types.ARRAY.zero_indexes` to the PostgreSQL 1217 :class:`_types.ARRAY` type. When set to ``True``, a value of one will be 1218 added to all array index values before passing to the database, allowing 1219 better interoperability between Python style zero-based indexes and 1220 PostgreSQL one-based indexes. Pull request courtesy Alexey Terentev. 1221 1222 .. change:: 1223 :tags: bug, engine 1224 :tickets: 3043 1225 :versions: 1.0.0b1 1226 1227 Fixed some "double invalidate" situations were detected where 1228 a connection invalidation could occur within an already critical section 1229 like a connection.close(); ultimately, these conditions are caused 1230 by the change in :ticket:`2907`, in that the "reset on return" feature 1231 calls out to the Connection/Transaction in order to handle it, where 1232 "disconnect detection" might be caught. However, it's possible that 1233 the more recent change in :ticket:`2985` made it more likely for this 1234 to be seen as the "connection invalidate" operation is much quicker, 1235 as the issue is more reproducible on 0.9.4 than 0.9.3. 1236 1237 Checks are now added within any section that 1238 an invalidate might occur to halt further disallowed operations 1239 on the invalidated connection. This includes two fixes both at the 1240 engine level and at the pool level. While the issue was observed 1241 with highly concurrent gevent cases, it could in theory occur in 1242 any kind of scenario where a disconnect occurs within the connection 1243 close operation. 1244 1245 .. change:: 1246 :tags: feature, orm 1247 :tickets: 3029 1248 :versions: 1.0.0b1 1249 1250 The "primaryjoin" model has been stretched a bit further to allow 1251 a join condition that is strictly from a single column to itself, 1252 translated through some kind of SQL function or expression. This 1253 is kind of experimental, but the first proof of concept is a 1254 "materialized path" join condition where a path string is compared 1255 to itself using "like". The :meth:`.ColumnOperators.like` operator has 1256 also been added to the list of valid operators to use in a primaryjoin 1257 condition. 1258 1259 .. change:: 1260 :tags: feature, sql 1261 :tickets: 3028 1262 :versions: 1.0.0b1 1263 1264 Liberalized the contract for :class:`.Index` a bit in that you can 1265 specify a :func:`_expression.text` expression as the target; the index no longer 1266 needs to have a table-bound column present if the index is to be 1267 manually added to the table, either via inline declaration or via 1268 :meth:`_schema.Table.append_constraint`. 1269 1270 .. change:: 1271 :tags: bug, firebird 1272 :tickets: 3038 1273 1274 Fixed bug where the combination of "limit" rendering as 1275 "SELECT FIRST n ROWS" using a bound parameter (only firebird has both), 1276 combined with column-level subqueries 1277 which also feature "limit" as well as "positional" bound parameters 1278 (e.g. qmark style) would erroneously assign the subquery-level positions 1279 before that of the enclosing SELECT, thus returning parameters which 1280 are out of order. 1281 1282 .. change:: 1283 :tags: bug, mssql 1284 :tickets: 3025 1285 :versions: 1.0.0b1 1286 1287 Revised the query used to determine the current default schema name 1288 to use the ``database_principal_id()`` function in conjunction with 1289 the ``sys.database_principals`` view so that we can determine 1290 the default schema independently of the type of login in progress 1291 (e.g., SQL Server, Windows, etc). 1292 1293 .. change:: 1294 :tags: bug, sql 1295 :tickets: 3024 1296 :versions: 1.0.0b1 1297 1298 Fixed bug in new :meth:`.DialectKWArgs.argument_for` method where 1299 adding an argument for a construct not previously included for any 1300 special arguments would fail. 1301 1302 .. change:: 1303 :tags: bug, py3k, tests 1304 :tickets: 2830 1305 :versions: 1.0.0b1 1306 1307 Corrected for some deprecation warnings involving the ``imp`` 1308 module and Python 3.3 or greater, when running tests. Pull 1309 request courtesy Matt Chisholm. 1310 1311 .. change:: 1312 :tags: bug, sql 1313 :tickets: 3020, 1068 1314 :versions: 1.0.0b1 1315 1316 Fixed regression introduced in 0.9 where new "ORDER BY <labelname>" 1317 feature from :ticket:`1068` would not apply quoting rules to the 1318 label name as rendered in the ORDER BY. 1319 1320 .. change:: 1321 :tags: feature, orm 1322 :tickets: 3017 1323 :versions: 1.0.0b1 1324 1325 Added new utility function :func:`.make_transient_to_detached` which can 1326 be used to manufacture objects that behave as though they were loaded 1327 from a session, then detached. Attributes that aren't present 1328 are marked as expired, and the object can be added to a Session 1329 where it will act like a persistent one. 1330 1331 .. change:: 1332 :tags: bug, sql 1333 :versions: 1.0.0b1 1334 1335 Restored the import for :class:`.Function` to the ``sqlalchemy.sql.expression`` 1336 import namespace, which was removed at the beginning of 0.9. 1337 1338 .. change:: 1339 :tags: bug, orm, sql 1340 :tickets: 3013 1341 :versions: 1.0.0b1 1342 1343 Fixes to the newly enhanced boolean coercion in :ticket:`2804` where 1344 the new rules for "where" and "having" woudn't take effect for the 1345 "whereclause" and "having" kw arguments of the :func:`_expression.select` construct, 1346 which is also what :class:`_query.Query` uses so wasn't working in the 1347 ORM either. 1348 1349 .. change:: 1350 :tags: feature, sql 1351 :tickets: 2990 1352 :versions: 1.0.0b1 1353 1354 Added new flag :paramref:`.expression.between.symmetric`, when set to True 1355 renders "BETWEEN SYMMETRIC". Also added a new negation operator 1356 "notbetween_op", which now allows an expression like ``~col.between(x, y)`` 1357 to render as "col NOT BETWEEN x AND y", rather than a parenthesized NOT 1358 string. 1359 1360.. changelog:: 1361 :version: 0.9.4 1362 :released: March 28, 2014 1363 1364 .. change:: 1365 :tags: feature, orm 1366 :tickets: 3007 1367 1368 Added new parameter :paramref:`.orm.mapper.confirm_deleted_rows`. Defaults 1369 to True, indicates that a series of DELETE statements should confirm 1370 that the cursor rowcount matches the number of primary keys that should 1371 have matched; this behavior had been taken off in most cases 1372 (except when version_id is used) to support the unusual edge case of 1373 self-referential ON DELETE CASCADE; to accommodate this, the message 1374 is now just a warning, not an exception, and the flag can be used 1375 to indicate a mapping that expects self-referential cascaded 1376 deletes of this nature. See also :ticket:`2403` for background on the 1377 original change. 1378 1379 .. change:: 1380 :tags: bug, ext, automap 1381 :tickets: 3004 1382 1383 Added support to automap for the case where a relationship should 1384 not be created between two classes that are in a joined inheritance 1385 relationship, for those foreign keys that link the subclass back to 1386 the superclass. 1387 1388 .. change:: 1389 :tags: bug, orm 1390 :tickets: 2948 1391 1392 Fixed a very old behavior where the lazy load emitted for a one-to-many 1393 could inappropriately pull in the parent table, and also return results 1394 inconsistent based on what's in the parent table, when the primaryjoin 1395 includes some kind of discriminator against the parent table, such 1396 as ``and_(parent.id == child.parent_id, parent.deleted == False)``. 1397 While this primaryjoin doesn't make that much sense for a one-to-many, 1398 it is slightly more common when applied to the many-to-one side, and 1399 the one-to-many comes as a result of a backref. 1400 Loading rows from ``child`` in this case would keep ``parent.deleted == False`` 1401 as is within the query, thereby yanking it into the FROM clause 1402 and doing a cartesian product. The new behavior will now substitute 1403 the value of the local "parent.deleted" for that parameter as is 1404 appropriate. Though typically, a real-world app probably wants to use a 1405 different primaryjoin for the o2m side in any case. 1406 1407 .. change:: 1408 :tags: bug, orm 1409 :tickets: 2965 1410 1411 Improved the check for "how to join from A to B" such that when 1412 a table has multiple, composite foreign keys targeting a parent table, 1413 the :paramref:`_orm.relationship.foreign_keys` argument will be properly 1414 interpreted in order to resolve the ambiguity; previously this condition 1415 would raise that there were multiple FK paths when in fact the 1416 foreign_keys argument should be establishing which one is expected. 1417 1418 .. change:: 1419 :tags: bug, mysql 1420 1421 Tweaked the settings for mysql-connector-python; in Py2K, the 1422 "supports unicode statements" flag is now False, so that SQLAlchemy 1423 will encode the *SQL string* (note: *not* the parameters) 1424 to bytes before sending to the database. This seems to allow 1425 all unicode-related tests to pass for mysql-connector, including those 1426 that use non-ascii table/column names, as well as some tests for the 1427 TEXT type using unicode under cursor.executemany(). 1428 1429 .. change:: 1430 :tags: feature, engine 1431 1432 Added some new event mechanics for dialect-level events; the initial 1433 implementation allows an event handler to redefine the specific mechanics 1434 by which an arbitrary dialect invokes execute() or executemany() on a 1435 DBAPI cursor. The new events, at this point semi-public and experimental, 1436 are in support of some upcoming transaction-related extensions. 1437 1438 .. change:: 1439 :tags: feature, engine 1440 :tickets: 2978 1441 1442 An event listener can now be associated with a :class:`_engine.Engine`, 1443 after one or more :class:`_engine.Connection` objects have been created 1444 (such as by an orm :class:`.Session` or via explicit connect) 1445 and the listener will pick up events from those connections. 1446 Previously, performance concerns pushed the event transfer from 1447 :class:`_engine.Engine` to :class:`_engine.Connection` at init-time only, but 1448 we've inlined a bunch of conditional checks to make this possible 1449 without any additional function calls. 1450 1451 .. change:: 1452 :tags: bug, tests 1453 :tickets: 2980 1454 1455 Fixed a few errant ``u''`` strings that would prevent tests from passing 1456 in Py3.2. Patch courtesy Arfrever Frehtes Taifersar Arahesis. 1457 1458 .. change:: 1459 :tags: bug, engine 1460 :tickets: 2985 1461 1462 A major improvement made to the mechanics by which the :class:`_engine.Engine` 1463 recycles the connection pool when a "disconnect" condition is detected; 1464 instead of discarding the pool and explicitly closing out connections, 1465 the pool is retained and a "generational" timestamp is updated to 1466 reflect the current time, thereby causing all existing connections 1467 to be recycled when they are next checked out. This greatly simplifies 1468 the recycle process, removes the need for "waking up" connect attempts 1469 waiting on the old pool and eliminates the race condition that many 1470 immediately-discarded "pool" objects could be created during the 1471 recycle operation. 1472 1473 .. change:: 1474 :tags: bug, oracle 1475 :tickets: 2987 1476 1477 Added new datatype :class:`_oracle.DATE`, which is a subclass of 1478 :class:`.DateTime`. As Oracle has no "datetime" type per se, 1479 it instead has only ``DATE``, it is appropriate here that the 1480 ``DATE`` type as present in the Oracle dialect be an instance of 1481 :class:`.DateTime`. This issue doesn't change anything as far as 1482 the behavior of the type, as data conversion is handled by the 1483 DBAPI in any case, however the improved subclass layout will help 1484 the use cases of inspecting types for cross-database compatibility. 1485 Also removed uppercase ``DATETIME`` from the Oracle dialect as this 1486 type isn't functional in that context. 1487 1488 .. change:: 1489 :tags: bug, sql 1490 :tickets: 2988 1491 1492 Fixed an 0.9 regression where a :class:`_schema.Table` that failed to 1493 reflect correctly wouldn't be removed from the parent 1494 :class:`_schema.MetaData`, even though in an invalid state. Pullreq 1495 courtesy Roman Podoliaka. 1496 1497 .. change:: 1498 :tags: bug, engine 1499 1500 The :meth:`_events.ConnectionEvents.after_cursor_execute` event is now 1501 emitted for the "_cursor_execute()" method of :class:`_engine.Connection`; 1502 this is the "quick" executor that is used for things like 1503 when a sequence is executed ahead of an INSERT statement, as well as 1504 for dialect startup checks like unicode returns, charset, etc. 1505 the :meth:`_events.ConnectionEvents.before_cursor_execute` event was already 1506 invoked here. The "executemany" flag is now always set to False 1507 here, as this event always corresponds to a single execution. 1508 Previously the flag could be True if we were acting on behalf of 1509 an executemany INSERT statement. 1510 1511 .. change:: 1512 :tags: bug, orm 1513 1514 Added support for the not-quite-yet-documented ``insert=True`` 1515 flag for :func:`.event.listen` to work with mapper / instance events. 1516 1517 .. change:: 1518 :tags: feature, sql 1519 1520 Added support for literal rendering of boolean values, e.g. 1521 "true" / "false" or "1" / "0". 1522 1523 .. change:: 1524 :tags: feature, sql 1525 1526 Added a new feature :func:`_schema.conv`, the purpose of which is to 1527 mark a constraint name as already having had a naming convention applied. 1528 This token will be used by Alembic migrations as of Alembic 0.6.4 1529 in order to render constraints in migration scripts with names marked 1530 as already having been subject to a naming convention. 1531 1532 .. change:: 1533 :tags: bug, sql 1534 1535 :paramref:`_schema.MetaData.naming_convention` feature will now also 1536 apply to :class:`.CheckConstraint` objects that are associated 1537 directly with a :class:`_schema.Column` instead of just on the 1538 :class:`_schema.Table`. 1539 1540 .. change:: 1541 :tags: bug, sql 1542 :tickets: 2991 1543 1544 Fixed bug in new :paramref:`_schema.MetaData.naming_convention` feature 1545 where the name of a check constraint making use of the 1546 `"%(constraint_name)s"` token would get doubled up for the 1547 constraint generated by a boolean or enum type, and overall 1548 duplicate events would cause the `"%(constraint_name)s"` token 1549 to keep compounding itself. 1550 1551 .. change:: 1552 :tags: feature, orm 1553 1554 A warning is emitted if the :meth:`.MapperEvents.before_configured` 1555 or :meth:`.MapperEvents.after_configured` events are applied to a 1556 specific mapper or mapped class, as the events are only invoked 1557 for the :class:`_orm.Mapper` target at the general level. 1558 1559 .. change:: 1560 :tags: feature, orm 1561 1562 Added a new keyword argument ``once=True`` to :func:`.event.listen` 1563 and :func:`.event.listens_for`. This is a convenience feature which 1564 will wrap the given listener such that it is only invoked once. 1565 1566 .. change:: 1567 :tags: feature, oracle 1568 :tickets: 2911 1569 1570 Added a new engine option ``coerce_to_unicode=True`` to the 1571 cx_Oracle dialect, which restores the cx_Oracle outputtypehandler 1572 approach to Python unicode conversion under Python 2, which was 1573 removed in 0.9.2 as a result of :ticket:`2911`. Some use cases would 1574 prefer that unicode coercion is unconditional for all string values, 1575 despite performance concerns. Pull request courtesy 1576 Christoph Zwerschke. 1577 1578 .. change:: 1579 :tags: bug, pool 1580 1581 Fixed small issue in :class:`.SingletonThreadPool` where the current 1582 connection to be returned might get inadvertently cleaned out during 1583 the "cleanup" process. Patch courtesy jd23. 1584 1585 .. change:: 1586 :tags: bug, ext, py3k 1587 1588 Fixed bug in association proxy where assigning an empty slice 1589 (e.g. ``x[:] = [...]``) would fail on Py3k. 1590 1591 .. change:: 1592 :tags: bug, general 1593 :tickets: 2979 1594 1595 Fixed some test/feature failures occurring in Python 3.4, 1596 in particular the logic used to wrap "column default" callables 1597 wouldn't work properly for Python built-ins. 1598 1599 .. change:: 1600 :tags: feature, general 1601 1602 Support has been added for pytest to run tests. This runner 1603 is currently being supported in addition to nose, and will likely 1604 be preferred to nose going forward. The nose plugin system used 1605 by SQLAlchemy has been split out so that it works under pytest as 1606 well. There are no plans to drop support for nose at the moment 1607 and we hope that the test suite itself can continue to remain as 1608 agnostic of testing platform as possible. See the file 1609 README.unittests.rst for updated information on running tests 1610 with pytest. 1611 1612 The test plugin system has also been enhanced to support running 1613 tests against multiple database URLs at once, by specifying the ``--db`` 1614 and/or ``--dburi`` flags multiple times. This does not run the entire test 1615 suite for each database, but instead allows test cases that are specific 1616 to certain backends make use of that backend as the test is run. 1617 When using pytest as the test runner, the system will also run 1618 specific test suites multiple times, once for each database, particularly 1619 those tests within the "dialect suite". The plan is that the enhanced 1620 system will also be used by Alembic, and allow Alembic to run 1621 migration operation tests against multiple backends in one run, including 1622 third-party backends not included within Alembic itself. 1623 Third party dialects and extensions are also encouraged to standardize 1624 on SQLAlchemy's test suite as a basis; see the file README.dialects.rst 1625 for background on building out from SQLAlchemy's test platform. 1626 1627 .. change:: 1628 :tags: feature, orm 1629 :tickets: 2976 1630 1631 Added a new option to :paramref:`_orm.relationship.innerjoin` which is 1632 to specify the string ``"nested"``. When set to ``"nested"`` as opposed 1633 to ``True``, the "chaining" of joins will parenthesize the inner join on the 1634 right side of an existing outer join, instead of chaining as a string 1635 of outer joins. This possibly should have been the default behavior 1636 when 0.9 was released, as we introduced the feature of right-nested 1637 joins in the ORM, however we are keeping it as a non-default for now 1638 to avoid further surprises. 1639 1640 .. seealso:: 1641 1642 :ref:`feature_2976` 1643 1644 .. change:: 1645 :tags: bug, ext 1646 :tickets: 2810 1647 1648 Fixed a regression in association proxy caused by :ticket:`2810` which 1649 caused a user-provided "getter" to no longer receive values of ``None`` 1650 when fetching scalar values from a target that is non-present. The 1651 check for None introduced by this change is now moved into the default 1652 getter, so a user-provided getter will also again receive values of 1653 None. 1654 1655 .. change:: 1656 :tags: bug, sql 1657 :tickets: 2974 1658 1659 Adjusted the logic which applies names to the .c collection when 1660 a no-name :class:`.BindParameter` is received, e.g. via :func:`_expression.literal` 1661 or similar; the "key" of the bind param is used as the key within 1662 .c. rather than the rendered name. Since these binds have "anonymous" 1663 names in any case, this allows individual bound parameters to 1664 have their own name within a selectable if they are otherwise unlabeled. 1665 1666 .. change:: 1667 :tags: bug, sql 1668 :tickets: 2974 1669 1670 Some changes to how the :attr:`_expression.FromClause.c` collection behaves 1671 when presented with duplicate columns. The behavior of emitting a 1672 warning and replacing the old column with the same name still 1673 remains to some degree; the replacement in particular is to maintain 1674 backwards compatibility. However, the replaced column still remains 1675 associated with the ``c`` collection now in a collection ``._all_columns``, 1676 which is used by constructs such as aliases and unions, to deal with 1677 the set of columns in ``c`` more towards what is actually in the 1678 list of columns rather than the unique set of key names. This helps 1679 with situations where SELECT statements with same-named columns 1680 are used in unions and such, so that the union can match the columns 1681 up positionally and also there's some chance of :meth:`_expression.FromClause.corresponding_column` 1682 still being usable here (it can now return a column that is only 1683 in selectable.c._all_columns and not otherwise named). 1684 The new collection is underscored as we still need to decide where this 1685 list might end up. Theoretically it 1686 would become the result of iter(selectable.c), however this would mean 1687 that the length of the iteration would no longer match the length of 1688 keys(), and that behavior needs to be checked out. 1689 1690 .. change:: 1691 :tags: bug, sql 1692 1693 Fixed issue in new :meth:`_expression.TextClause.columns` method where the ordering 1694 of columns given positionally would not be preserved. This could 1695 have potential impact in positional situations such as applying the 1696 resulting :class:`.TextAsFrom` object to a union. 1697 1698 .. change:: 1699 :tags: feature, sql 1700 :tickets: 2962, 2866 1701 1702 The new dialect-level keyword argument system for schema-level 1703 constructs has been enhanced in order to assist with existing 1704 schemes that rely upon addition of ad-hoc keyword arguments to 1705 constructs. 1706 1707 E.g., a construct such as :class:`.Index` will again accept 1708 ad-hoc keyword arguments within the :attr:`.Index.kwargs` collection, 1709 after construction:: 1710 1711 idx = Index('a', 'b') 1712 idx.kwargs['mysql_someargument'] = True 1713 1714 To suit the use case of allowing custom arguments at construction time, 1715 the :meth:`.DialectKWArgs.argument_for` method now allows this registration:: 1716 1717 Index.argument_for('mysql', 'someargument', False) 1718 1719 idx = Index('a', 'b', mysql_someargument=True) 1720 1721 .. seealso:: 1722 1723 :meth:`.DialectKWArgs.argument_for` 1724 1725 .. change:: 1726 :tags: bug, orm, engine 1727 :tickets: 2973 1728 1729 Fixed bug where events set to listen at the class 1730 level (e.g. on the :class:`_orm.Mapper` or :class:`.ClassManager` 1731 level, as opposed to on an individual mapped class, and also on 1732 :class:`_engine.Connection`) that also made use of internal argument conversion 1733 (which is most within those categories) would fail to be removable. 1734 1735 .. change:: 1736 :tags: bug, orm 1737 1738 Fixed regression from 0.8 where using an option like 1739 :func:`_orm.lazyload` with the "wildcard" expression, e.g. ``"*"``, 1740 would raise an assertion error in the case where the query didn't 1741 contain any actual entities. This assertion is meant for other cases 1742 and was catching this one inadvertently. 1743 1744 .. change:: 1745 :tags: bug, examples 1746 1747 Fixed bug in the versioned_history example where column-level INSERT 1748 defaults would prevent history values of NULL from being written. 1749 1750 .. change:: 1751 :tags: orm, bug, sqlite 1752 :tickets: 2969 1753 1754 More fixes to SQLite "join rewriting"; the fix from :ticket:`2967` 1755 implemented right before the release of 0.9.3 affected the case where 1756 a UNION contained nested joins in it. "Join rewriting" is a feature 1757 with a wide range of possibilities and is the first intricate 1758 "SQL rewriting" feature we've introduced in years, so we're sort of 1759 going through a lot of iterations with it (not unlike eager loading 1760 back in the 0.2/0.3 series, polymorphic loading in 0.4/0.5). We should 1761 be there soon so thanks for bearing with us :). 1762 1763 1764.. changelog:: 1765 :version: 0.9.3 1766 :released: February 19, 2014 1767 1768 .. change:: 1769 :tags: orm, bug, sqlite 1770 :tickets: 2967 1771 1772 Fixed bug in SQLite "join rewriting" where usage of an exists() construct 1773 would fail to be rewritten properly, such as when the exists is 1774 mapped to a column_property in an intricate nested-join scenario. 1775 Also fixed a somewhat related issue where join rewriting would fail 1776 on the columns clause of the SELECT statement if the targets were 1777 aliased tables, as opposed to individual aliased columns. 1778 1779 .. change:: 1780 :tags: sqlite, bug 1781 1782 The SQLite dialect will now skip unsupported arguments when reflecting 1783 types; such as if it encounters a string like ``INTEGER(5)``, the 1784 :class:`_types.INTEGER` type will be instantiated without the "5" being included, 1785 based on detecting a ``TypeError`` on the first attempt. 1786 1787 .. change:: 1788 :tags: sqlite, bug 1789 1790 Support has been added to SQLite type reflection to fully support 1791 the "type affinity" contract specified at http://www.sqlite.org/datatype3.html. 1792 In this scheme, keywords like ``INT``, ``CHAR``, ``BLOB`` or 1793 ``REAL`` located in the type name generically associate the type with 1794 one of five affinities. Pull request courtesy Erich Blume. 1795 1796 .. seealso:: 1797 1798 :ref:`sqlite_type_reflection` 1799 1800 .. change:: 1801 :tags: postgresql, feature 1802 1803 Added the :attr:`.TypeEngine.python_type` convenience accessor onto the 1804 :class:`_postgresql.ARRAY` type. Pull request courtesy Alexey Terentev. 1805 1806 .. change:: 1807 :tags: examples, feature 1808 1809 Added optional "changed" column to the versioned rows example, as well 1810 as support for when the versioned :class:`_schema.Table` has an explicit 1811 :paramref:`_schema.Table.schema` argument. Pull request 1812 courtesy jplaverdure. 1813 1814 .. change:: 1815 :tags: bug, postgresql 1816 :tickets: 2946 1817 1818 Added server version detection to the newly added dialect startup 1819 query for "show standard_conforming_strings"; as this variable was 1820 added as of PG 8.2, we skip the query for PG versions who report a 1821 version string earlier than that. 1822 1823 .. change:: 1824 :tags: bug, orm, declarative 1825 :tickets: 2950 1826 1827 Fixed bug where :class:`.AbstractConcreteBase` would fail to be 1828 fully usable within declarative relationship configuration, as its 1829 string classname would not be available in the registry of classnames 1830 at mapper configuration time. The class now explicitly adds itself 1831 to the class registry, and additionally both :class:`.AbstractConcreteBase` 1832 as well as :class:`.ConcreteBase` set themselves up *before* mappers 1833 are configured within the :func:`.configure_mappers` setup, using 1834 the new :meth:`.MapperEvents.before_configured` event. 1835 1836 .. change:: 1837 :tags: feature, orm 1838 1839 Added new :meth:`.MapperEvents.before_configured` event which allows 1840 an event at the start of :func:`.configure_mappers`, as well 1841 as ``__declare_first__()`` hook within declarative to complement 1842 ``__declare_last__()``. 1843 1844 .. change:: 1845 :tags: bug, mysql, cymysql 1846 :tickets: 2934 1847 1848 Fixed bug in cymysql dialect where a version string such as 1849 ``'33a-MariaDB'`` would fail to parse properly. Pull request 1850 courtesy Matt Schmidt. 1851 1852 .. change:: 1853 :tags: bug, orm 1854 :tickets: 2949 1855 1856 Fixed an 0.9 regression where ORM instance or mapper events applied 1857 to a base class such as a declarative base with the propagate=True 1858 flag would fail to apply to existing mapped classes which also 1859 used inheritance due to an assertion. Additionally, repaired an 1860 attribute error which could occur during removal of such an event, 1861 depending on how it was first assigned. 1862 1863 .. change:: 1864 :tags: bug, ext 1865 1866 Fixed bug where the :class:`.AutomapBase` class of the 1867 new automap extension would fail if classes 1868 were pre-arranged in single or potentially joined inheritance patterns. 1869 The repaired joined inheritance issue could also potentially apply when 1870 using :class:`.DeferredReflection` as well. 1871 1872 1873 .. change:: 1874 :tags: bug, sql 1875 1876 Fixed regression in new "naming convention" feature where conventions 1877 would fail if the referred table in a foreign key contained a schema 1878 name. Pull request courtesy Thomas Farvour. 1879 1880 .. change:: 1881 :tags: bug, sql 1882 1883 Fixed bug where so-called "literal render" of :func:`.bindparam` 1884 constructs would fail if the bind were constructed with a callable, 1885 rather than a direct value. This prevented ORM expressions 1886 from being rendered with the "literal_binds" compiler flag. 1887 1888 .. change:: 1889 :tags: bug, orm 1890 :tickets: 2935 1891 1892 Improved the initialization logic of composite attributes such that 1893 calling ``MyClass.attribute`` will not require that the configure 1894 mappers step has occurred, e.g. it will just work without throwing 1895 any error. 1896 1897 .. change:: 1898 :tags: bug, orm 1899 :tickets: 2932 1900 1901 More issues with [ticket:2932] first resolved in 0.9.2 where 1902 using a column key of the form ``<tablename>_<columnname>`` 1903 matching that of an aliased column in the text would still not 1904 match at the ORM level, which is ultimately due to a core 1905 column-matching issue. Additional rules have been added so that the 1906 column ``_label`` is taken into account when working with a 1907 :class:`.TextAsFrom` construct or with literal columns. 1908 1909.. changelog:: 1910 :version: 0.9.2 1911 :released: February 2, 2014 1912 1913 .. change:: 1914 :tags: bug, examples 1915 1916 Added a tweak to the "history_meta" example where the check for 1917 "history" on a relationship-bound attribute will now no longer emit 1918 any SQL if the relationship is unloaded. 1919 1920 .. change:: 1921 :tags: feature, sql 1922 1923 Added :paramref:`.MetaData.reflect.**dialect_kwargs` 1924 to support dialect-level reflection options for all :class:`_schema.Table` 1925 objects reflected. 1926 1927 .. change:: 1928 :tags: feature, postgresql 1929 :tickets: 2922 1930 1931 Added a new dialect-level argument ``postgresql_ignore_search_path``; 1932 this argument is accepted by both the :class:`_schema.Table` constructor 1933 as well as by the :meth:`_schema.MetaData.reflect` method. When in use 1934 against PostgreSQL, a foreign-key referenced table which specifies 1935 a remote schema name will retain that schema name even if the name 1936 is present in the ``search_path``; the default behavior since 0.7.3 1937 has been that schemas present in ``search_path`` would not be copied 1938 to reflected :class:`_schema.ForeignKey` objects. The documentation has been 1939 updated to describe in detail the behavior of the ``pg_get_constraintdef()`` 1940 function and how the ``postgresql_ignore_search_path`` feature essentially 1941 determines if we will honor the schema qualification reported by 1942 this function or not. 1943 1944 .. seealso:: 1945 1946 :ref:`postgresql_schema_reflection` 1947 1948 .. change:: 1949 :tags: bug, sql 1950 :tickets: 2913 1951 1952 The behavior of :meth:`_schema.Table.tometadata` has been adjusted such that 1953 the schema target of a :class:`_schema.ForeignKey` will not be changed unless 1954 that schema matches that of the parent table. That is, if 1955 a table "schema_a.user" has a foreign key to "schema_b.order.id", 1956 the "schema_b" target will be maintained whether or not the 1957 "schema" argument is passed to :meth:`_schema.Table.tometadata`. However 1958 if a table "schema_a.user" refers to "schema_a.order.id", the presence 1959 of "schema_a" will be updated on both the parent and referred tables. 1960 This is a behavioral change hence isn't likely to be backported to 1961 0.8; it is assumed that the previous behavior is pretty buggy 1962 however and that it's unlikely anyone was relying upon it. 1963 1964 Additionally, a new parameter has been added 1965 :paramref:`.Table.tometadata.referred_schema_fn`. This refers to a 1966 callable function which will be used to determine the new referred 1967 schema for any :class:`_schema.ForeignKeyConstraint` encountered in the 1968 tometadata operation. This callable can be used to revert to the 1969 previous behavior or to customize how referred schemas are treated 1970 on a per-constraint basis. 1971 1972 .. change:: 1973 :tags: bug, orm 1974 :tickets: 2932 1975 1976 Fixed bug in new :class:`.TextAsFrom` construct where :class:`_schema.Column`- 1977 oriented row lookups were not matching up to the ad-hoc :class:`.ColumnClause` 1978 objects that :class:`.TextAsFrom` generates, thereby making it not 1979 usable as a target in :meth:`_query.Query.from_statement`. Also fixed 1980 :meth:`_query.Query.from_statement` mechanics to not mistake a :class:`.TextAsFrom` 1981 for a :class:`_expression.Select` construct. This bug is also an 0.9 regression 1982 as the :meth:`_expression.TextClause.columns` method is called to accommodate the 1983 :paramref:`_expression.text.typemap` argument. 1984 1985 .. change:: 1986 :tags: feature, sql 1987 :tickets: 2923 1988 1989 Added a new feature which allows automated naming conventions to be 1990 applied to :class:`.Constraint` and :class:`.Index` objects. Based 1991 on a recipe in the wiki, the new feature uses schema-events to set up 1992 names as various schema objects are associated with each other. The 1993 events then expose a configuration system through a new argument 1994 :paramref:`_schema.MetaData.naming_convention`. This system allows production 1995 of both simple and custom naming schemes for constraints and indexes 1996 on a per-:class:`_schema.MetaData` basis. 1997 1998 .. seealso:: 1999 2000 :ref:`constraint_naming_conventions` 2001 2002 .. change:: 2003 :tags: bug, orm 2004 :tickets: 2921 2005 2006 Added a new directive used within the scope of an attribute "set" operation 2007 to disable autoflush, in the case that the attribute needs to lazy-load 2008 the "old" value, as in when replacing one-to-one values or some 2009 kinds of many-to-one. A flush at this point otherwise occurs 2010 at the point that the attribute is None and can cause NULL violations. 2011 2012 .. change:: 2013 :tags: feature, orm 2014 2015 Added a new parameter :paramref:`.Operators.op.is_comparison`. This 2016 flag allows a custom op from :meth:`.Operators.op` to be considered 2017 as a "comparison" operator, thus usable for custom 2018 :paramref:`_orm.relationship.primaryjoin` conditions. 2019 2020 .. seealso:: 2021 2022 :ref:`relationship_custom_operator` 2023 2024 .. change:: 2025 :tags: bug, sqlite 2026 2027 Fixed bug whereby SQLite compiler failed to propagate compiler arguments 2028 such as "literal binds" into a CAST expression. 2029 2030 .. change:: 2031 :tags: bug, sql 2032 2033 Fixed bug whereby binary type would fail in some cases 2034 if used with a "test" dialect, such as a DefaultDialect or other 2035 dialect with no DBAPI. 2036 2037 .. change:: 2038 :tags: bug, sql, py3k 2039 2040 Fixed bug where "literal binds" wouldn't work with a bound parameter 2041 that's a binary type. A similar, but different, issue is fixed 2042 in 0.8. 2043 2044 .. change:: 2045 :tags: bug, sql 2046 :tickets: 2927 2047 2048 Fixed regression whereby the "annotation" system used by the ORM was leaking 2049 into the names used by standard functions in :mod:`sqlalchemy.sql.functions`, 2050 such as ``func.coalesce()`` and ``func.max()``. Using these functions 2051 in ORM attributes and thus producing annotated versions of them could 2052 corrupt the actual function name rendered in the SQL. 2053 2054 .. change:: 2055 :tags: bug, sql 2056 :tickets: 2924, 2848 2057 2058 Fixed 0.9 regression where the new sortable support for :class:`.RowProxy` 2059 would lead to ``TypeError`` when compared to non-tuple types as it attempted 2060 to apply tuple() to the "other" object unconditionally. The 2061 full range of Python comparison operators have now been implemented on 2062 :class:`.RowProxy`, using an approach that guarantees a comparison 2063 system that is equivalent to that of a tuple, and the "other" object 2064 is only coerced if it's an instance of RowProxy. 2065 2066 .. change:: 2067 :tags: bug, orm 2068 :tickets: 2918 2069 2070 Fixed an 0.9 regression where the automatic aliasing applied by 2071 :class:`_query.Query` and in other situations where selects or joins 2072 were aliased (such as joined table inheritance) could fail if a 2073 user-defined :class:`_schema.Column` subclass were used in the expression. 2074 In this case, the subclass would fail to propagate ORM-specific 2075 "annotations" along needed by the adaptation. The "expression 2076 annotations" system has been corrected to account for this case. 2077 2078 .. change:: 2079 :tags: feature, orm 2080 2081 Support is improved for supplying a :func:`_expression.join` construct as the 2082 target of :paramref:`_orm.relationship.secondary` for the purposes 2083 of creating very complex :func:`_orm.relationship` join conditions. 2084 The change includes adjustments to query joining, joined eager loading 2085 to not render a SELECT subquery, changes to lazy loading such that 2086 the "secondary" target is properly included in the SELECT, and 2087 changes to declarative to better support specification of a 2088 join() object with classes as targets. 2089 2090 The new use case is somewhat experimental, but a new documentation section 2091 has been added. 2092 2093 .. seealso:: 2094 2095 :ref:`composite_secondary_join` 2096 2097 .. change:: 2098 :tags: bug, mysql, sql 2099 :tickets: 2917 2100 2101 Added new test coverage for so-called "down adaptions" of SQL types, 2102 where a more specific type is adapted to a more generic one - this 2103 use case is needed by some third party tools such as ``sqlacodegen``. 2104 The specific cases that needed repair within this test suite were that 2105 of :class:`.mysql.ENUM` being downcast into a :class:`_types.Enum`, 2106 and that of SQLite date types being cast into generic date types. 2107 The ``adapt()`` method needed to become more specific here to counteract 2108 the removal of a "catch all" ``**kwargs`` collection on the base 2109 :class:`.TypeEngine` class that was removed in 0.9. 2110 2111 .. change:: 2112 :tags: feature, sql 2113 :tickets: 2910 2114 2115 Options can now be specified on a :class:`.PrimaryKeyConstraint` object 2116 independently of the specification of columns in the table with 2117 the ``primary_key=True`` flag; use a :class:`.PrimaryKeyConstraint` 2118 object with no columns in it to achieve this result. 2119 2120 Previously, an explicit :class:`.PrimaryKeyConstraint` would have the 2121 effect of those columns marked as ``primary_key=True`` being ignored; 2122 since this is no longer the case, the :class:`.PrimaryKeyConstraint` 2123 will now assert that either one style or the other is used to specify 2124 the columns, or if both are present, that the column lists match 2125 exactly. If an inconsistent set of columns in the 2126 :class:`.PrimaryKeyConstraint` 2127 and within the :class:`_schema.Table` marked as ``primary_key=True`` are 2128 present, a warning is emitted, and the list of columns is taken 2129 only from the :class:`.PrimaryKeyConstraint` alone as was the case 2130 in previous releases. 2131 2132 2133 2134 .. seealso:: 2135 2136 :class:`.PrimaryKeyConstraint` 2137 2138 .. change:: 2139 :tags: feature, sql 2140 :tickets: 2866 2141 2142 The system by which schema constructs and certain SQL constructs 2143 accept dialect-specific keyword arguments has been enhanced. This 2144 system includes commonly the :class:`_schema.Table` and :class:`.Index` constructs, 2145 which accept a wide variety of dialect-specific arguments such as 2146 ``mysql_engine`` and ``postgresql_where``, as well as the constructs 2147 :class:`.PrimaryKeyConstraint`, :class:`.UniqueConstraint`, 2148 :class:`_expression.Update`, :class:`_expression.Insert` and :class:`_expression.Delete`, and also 2149 newly added kwarg capability to :class:`_schema.ForeignKeyConstraint` 2150 and :class:`_schema.ForeignKey`. The change is that participating dialects 2151 can now specify acceptable argument lists for these constructs, allowing 2152 an argument error to be raised if an invalid keyword is specified for 2153 a particular dialect. If the dialect portion of the keyword is unrecognized, 2154 a warning is emitted only; while the system will actually make use 2155 of setuptools entrypoints in order to locate non-local dialects, 2156 the use case where certain dialect-specific arguments are used 2157 in an environment where that third-party dialect is uninstalled remains 2158 supported. Dialects also have to explicitly opt-in to this system, 2159 so that external dialects which aren't making use of this system 2160 will remain unaffected. 2161 2162 .. change:: 2163 :tags: bug, sql 2164 2165 A :class:`.UniqueConstraint` created inline with a :class:`_schema.Table` 2166 that has no columns within it will be skipped. Pullreq courtesy 2167 Derek Harland. 2168 2169 .. change:: 2170 :tags: feature, mssql 2171 2172 Added an option ``mssql_clustered`` to the :class:`.UniqueConstraint` 2173 and :class:`.PrimaryKeyConstraint` constructs; on SQL Server, this adds 2174 the ``CLUSTERED`` keyword to the constraint construct within DDL. 2175 Pullreq courtesy Derek Harland. 2176 2177 .. change:: 2178 :tags: bug, sql, orm 2179 :tickets: 2912 2180 2181 Fixed the multiple-table "UPDATE..FROM" construct, only usable on 2182 MySQL, to correctly render the SET clause among multiple columns 2183 with the same name across tables. This also changes the name used for 2184 the bound parameter in the SET clause to "<tablename>_<colname>" for 2185 the non-primary table only; as this parameter is typically specified 2186 using the :class:`_schema.Column` object directly this should not have an 2187 impact on applications. The fix takes effect for both 2188 :meth:`_schema.Table.update` as well as :meth:`_query.Query.update` in the ORM. 2189 2190 .. change:: 2191 :tags: bug, oracle 2192 :tickets: 2911 2193 2194 It's been observed that the usage of a cx_Oracle "outputtypehandler" 2195 in Python 2.xx in order to coerce string values to Unicode is inordinately 2196 expensive; even though cx_Oracle is written in C, when you pass the 2197 Python ``unicode`` primitive to cursor.var() and associate with an output 2198 handler, the library counts every conversion as a Python function call 2199 with all the requisite overhead being recorded; this *despite* the fact 2200 when running in Python 3, all strings are also unconditionally coerced 2201 to unicode but it does *not* incur this overhead, 2202 meaning that cx_Oracle is failing to use performant techniques in Py2K. 2203 As SQLAlchemy cannot easily select for this style of type handler on a 2204 per-column basis, the handler was assembled unconditionally thereby 2205 adding the overhead to all string access. 2206 2207 So this logic has been replaced with SQLAlchemy's own unicode 2208 conversion system, which now 2209 only takes effect in Py2K for columns that are requested as unicode. 2210 When C extensions are used, SQLAlchemy's system appears to be 2-3x faster than 2211 cx_Oracle's. Additionally, SQLAlchemy's unicode conversion has been 2212 enhanced such that when the "conditional" converter is required 2213 (now needed for the Oracle backend), the check for "already unicode" is now 2214 performed in C and no longer introduces significant overhead. 2215 2216 This change has two impacts on the cx_Oracle backend. One is that 2217 string values in Py2K which aren't specifically requested with the 2218 Unicode type or convert_unicode=True will now come back as ``str``, 2219 not ``unicode`` - this behavior is similar to a backend such as 2220 MySQL. Additionally, when unicode values are requested with the cx_Oracle 2221 backend, if the C extensions are *not* used, there is now an additional 2222 overhead of an isinstance() check per column. This tradeoff has been 2223 made as it can be worked around and no longer places a performance burden 2224 on the likely majority of Oracle result columns that are non-unicode 2225 strings. 2226 2227 .. change:: 2228 :tags: bug, orm 2229 :tickets: 2908 2230 2231 Fixed a bug involving the new flattened JOIN structures which 2232 are used with :func:`_orm.joinedload()` (thereby causing a regression 2233 in joined eager loading) as well as :func:`.aliased` 2234 in conjunction with the ``flat=True`` flag and joined-table inheritance; 2235 basically multiple joins across a "parent JOIN sub" entity using different 2236 paths to get to a target class wouldn't form the correct ON conditions. 2237 An adjustment / simplification made in the mechanics of figuring 2238 out the "left side" of the join in the case of an aliased, joined-inh 2239 class repairs the issue. 2240 2241 .. change:: 2242 :tags: bug, mysql 2243 2244 The MySQL CAST compilation now takes into account aspects of a string 2245 type such as "charset" and "collation". While MySQL wants all character- 2246 based CAST calls to use the CHAR type, we now create a real CHAR 2247 object at CAST time and copy over all the parameters it has, so that 2248 an expression like ``cast(x, mysql.TEXT(charset='utf8'))`` will 2249 render ``CAST(t.col AS CHAR CHARACTER SET utf8)``. 2250 2251 .. change:: 2252 :tags: bug, mysql 2253 :tickets: 2906 2254 2255 Added new "unicode returns" detection to the MySQL dialect and 2256 to the default dialect system overall, such that any dialect 2257 can add extra "tests" to the on-first-connect "does this DBAPI 2258 return unicode directly?" detection. In this case, we are 2259 adding a check specifically against the "utf8" encoding with 2260 an explicit "utf8_bin" collation type (after checking that 2261 this collation is available) to test for some buggy unicode 2262 behavior observed with MySQLdb version 1.2.3. While MySQLdb 2263 has resolved this issue as of 1.2.4, the check here should 2264 guard against regressions. The change also allows the "unicode" 2265 checks to log in the engine logs, which was not previously 2266 the case. 2267 2268 .. change:: 2269 :tags: bug, mysql, pool, engine 2270 :tickets: 2907 2271 2272 :class:`_engine.Connection` now associates a new 2273 :class:`.RootTransaction` or :class:`.TwoPhaseTransaction` 2274 with its immediate :class:`._ConnectionFairy` as a "reset handler" 2275 for the span of that transaction, which takes over the task 2276 of calling commit() or rollback() for the "reset on return" behavior 2277 of :class:`_pool.Pool` if the transaction was not otherwise completed. 2278 This resolves the issue that a picky transaction 2279 like that of MySQL two-phase will be 2280 properly closed out when the connection is closed without an 2281 explicit rollback or commit (e.g. no longer raises "XAER_RMFAIL" 2282 in this case - note this only shows up in logging as the exception 2283 is not propagated within pool reset). 2284 This issue would arise e.g. when using an orm 2285 :class:`.Session` with ``twophase`` set, and then 2286 :meth:`.Session.close` is called without an explicit rollback or 2287 commit. The change also has the effect that you will now see 2288 an explicit "ROLLBACK" in the logs when using a :class:`.Session` 2289 object in non-autocommit mode regardless of how that session was 2290 discarded. Thanks to Jeff Dairiki and Laurence Rowe for isolating 2291 the issue here. 2292 2293 .. change:: 2294 :tags: feature, pool, engine 2295 2296 Added a new pool event :meth:`_events.PoolEvents.invalidate`. Called when 2297 a DBAPI connection is to be marked as "invalidated" and discarded 2298 from the pool. 2299 2300 .. change:: 2301 :tags: bug, pool 2302 2303 The argument names for the :meth:`_events.PoolEvents.reset` event have been 2304 renamed to ``dbapi_connection`` and ``connection_record`` in order 2305 to maintain consistency with all the other pool events. It is expected 2306 that any existing listeners for this relatively new and 2307 seldom-used event are using positional style to receive arguments in 2308 any case. 2309 2310 .. change:: 2311 :tags: bug, py3k, cextensions 2312 2313 Fixed an issue where the C extensions in Py3K are using the wrong API 2314 to specify the top-level module function, which breaks 2315 in Python 3.4b2. Py3.4b2 changes PyMODINIT_FUNC to return 2316 "void" instead of ``PyObject *``, so we now make sure to use 2317 "PyMODINIT_FUNC" instead of ``PyObject *`` directly. Pull request 2318 courtesy cgohlke. 2319 2320 .. change:: 2321 :tags: bug, schema 2322 2323 Restored :class:`sqlalchemy.schema.SchemaVisitor` to the ``.schema`` 2324 module. Pullreq courtesy Sean Dague. 2325 2326.. changelog:: 2327 :version: 0.9.1 2328 :released: January 5, 2014 2329 2330 .. change:: 2331 :tags: bug, orm, events 2332 :tickets: 2905 2333 2334 Fixed regression where using a ``functools.partial()`` with the event 2335 system would cause a recursion overflow due to usage of inspect.getargspec() 2336 on it in order to detect a legacy calling signature for certain events, 2337 and apparently there's no way to do this with a partial object. Instead 2338 we skip the legacy check and assume the modern style; the check itself 2339 now only occurs for the SessionEvents.after_bulk_update and 2340 SessionEvents.after_bulk_delete events. Those two events will require 2341 the new signature style if assigned to a "partial" event listener. 2342 2343 .. change:: 2344 :tags: feature, orm, extensions 2345 2346 A new, **experimental** extension :mod:`sqlalchemy.ext.automap` is added. 2347 This extension expands upon the functionality of Declarative as well as 2348 the :class:`.DeferredReflection` class to produce a base class which 2349 automatically generates mapped classes *and relationships* based on 2350 table metadata. 2351 2352 .. seealso:: 2353 2354 :ref:`feature_automap` 2355 2356 :ref:`automap_toplevel` 2357 2358 .. change:: 2359 :tags: feature, sql 2360 2361 Conjunctions like :func:`.and_` and :func:`.or_` can now accept 2362 Python generators as a single argument, e.g.:: 2363 2364 and_(x == y for x, y in tuples) 2365 2366 The logic here looks for a single argument ``*args`` where the first 2367 element is an instance of ``types.GeneratorType``. 2368 2369 .. change:: 2370 :tags: feature, schema 2371 2372 The :paramref:`_schema.Table.extend_existing` and :paramref:`_schema.Table.autoload_replace` 2373 parameters are now available on the :meth:`_schema.MetaData.reflect` 2374 method. 2375 2376 .. change:: 2377 :tags: bug, orm, declarative 2378 2379 Fixed an extremely unlikely memory issue where when using 2380 :class:`.DeferredReflection` 2381 to define classes pending for reflection, if some subset of those 2382 classes were discarded before the :meth:`.DeferredReflection.prepare` 2383 method were called to reflect and map the class, a strong reference 2384 to the class would remain held within the declarative internals. 2385 This internal collection of "classes to map" now uses weak 2386 references against the classes themselves. 2387 2388 .. change:: 2389 :tags: bug, orm 2390 2391 Fixed bug where using new :attr:`.Session.info` attribute would fail 2392 if the ``.info`` argument were only passed to the :class:`.sessionmaker` 2393 creation call but not to the object itself. Courtesy Robin Schoonover. 2394 2395 .. change:: 2396 :tags: bug, orm 2397 :tickets: 2901 2398 2399 Fixed regression where we don't check the given name against the 2400 correct string class when setting up a backref based on a name, 2401 therefore causing the error "too many values to unpack". This was 2402 related to the Py3k conversion. 2403 2404 .. change:: 2405 :tags: bug, orm, declarative 2406 :tickets: 2900 2407 2408 A quasi-regression where apparently in 0.8 you can set a class-level 2409 attribute on declarative to simply refer directly to an :class:`.InstrumentedAttribute` 2410 on a superclass or on the class itself, and it 2411 acts more or less like a synonym; in 0.9, this fails to set up enough 2412 bookkeeping to keep up with the more liberalized backref logic 2413 from :ticket:`2789`. Even though this use case was never directly 2414 considered, it is now detected by declarative at the "setattr()" level 2415 as well as when setting up a subclass, and the mirrored/renamed attribute 2416 is now set up as a :func:`.synonym` instead. 2417 2418 .. change:: 2419 :tags: bug, orm 2420 :tickets: 2903 2421 2422 Fixed regression where we apparently still create an implicit 2423 alias when saying query(B).join(B.cs), where "C" is a joined inh 2424 class; however, this implicit alias was created only considering 2425 the immediate left side, and not a longer chain of joins along different 2426 joined-inh subclasses of the same base. As long as we're still 2427 implicitly aliasing in this case, the behavior is dialed back a bit 2428 so that it will alias the right side in a wider variety of cases. 2429 2430.. changelog:: 2431 :version: 0.9.0 2432 :released: December 30, 2013 2433 2434 .. change:: 2435 :tags: bug, orm, declarative 2436 :tickets: 2828 2437 2438 Declarative does an extra check to detect if the same 2439 :class:`_schema.Column` is mapped multiple times under different properties 2440 (which typically should be a :func:`.synonym` instead) or if two 2441 or more :class:`_schema.Column` objects are given the same name, raising 2442 a warning if this condition is detected. 2443 2444 .. change:: 2445 :tags: bug, firebird 2446 :tickets: 2898 2447 2448 Changed the queries used by Firebird to list table and view names 2449 to query from the ``rdb$relations`` view instead of the 2450 ``rdb$relation_fields`` and ``rdb$view_relations`` views. 2451 Variants of both the old and new queries are mentioned on many 2452 FAQ and blogs, however the new queries are taken straight from 2453 the "Firebird FAQ" which appears to be the most official source 2454 of info. 2455 2456 .. change:: 2457 :tags: bug, mysql 2458 :tickets: 2893 2459 2460 Improvements to the system by which SQL types generate within 2461 ``__repr__()``, particularly with regards to the MySQL integer/numeric/ 2462 character types which feature a wide variety of keyword arguments. 2463 The ``__repr__()`` is important for use with Alembic autogenerate 2464 for when Python code is rendered in a migration script. 2465 2466 .. change:: 2467 :tags: feature, postgresql 2468 :tickets: 2581 2469 2470 Support for PostgreSQL JSON has been added, using the new 2471 :class:`_types.JSON` type. Huge thanks to Nathan Rice for 2472 implementing and testing this. 2473 2474 .. change:: 2475 :tags: bug, sql 2476 2477 The :func:`.cast` function, when given a plain literal value, 2478 will now apply the given type to the given literal value on the 2479 bind parameter side according to the type given to the cast, 2480 in the same manner as that of the :func:`.type_coerce` function. 2481 However unlike :func:`.type_coerce`, this only takes effect if a 2482 non-clauseelement value is passed to :func:`.cast`; an existing typed 2483 construct will retain its type. 2484 2485 .. change:: 2486 :tags: bug, postgresql 2487 2488 Now using psycopg2 UNICODEARRAY extension for handling unicode arrays 2489 with psycopg2 + normal "native unicode" mode, in the same way the 2490 UNICODE extension is used. 2491 2492 .. change:: 2493 :tags: bug, sql 2494 :tickets: 2883 2495 2496 The :class:`_schema.ForeignKey` class more aggressively checks the given 2497 column argument. If not a string, it checks that the object is 2498 at least a :class:`.ColumnClause`, or an object that resolves to one, 2499 and that the ``.table`` attribute, if present, refers to a 2500 :class:`_expression.TableClause` or subclass, and not something like an 2501 :class:`_expression.Alias`. Otherwise, a :class:`.ArgumentError` is raised. 2502 2503 2504 .. change:: 2505 :tags: feature, orm 2506 2507 The :class:`.exc.StatementError` or DBAPI-related subclass 2508 now can accommodate additional information about the "reason" for 2509 the exception; the :class:`.Session` now adds some detail to it 2510 when the exception occurs within an autoflush. This approach 2511 is taken as opposed to combining :class:`.FlushError` with 2512 a Python 3 style "chained exception" approach so as to maintain 2513 compatibility both with Py2K code as well as code that already 2514 catches ``IntegrityError`` or similar. 2515 2516 .. change:: 2517 :tags: feature, postgresql 2518 2519 Added support for PostgreSQL TSVECTOR via the 2520 :class:`_postgresql.TSVECTOR` type. Pull request courtesy 2521 Noufal Ibrahim. 2522 2523 .. change:: 2524 :tags: feature, engine 2525 :tickets: 2875 2526 2527 The :func:`.engine_from_config` function has been improved so that 2528 we will be able to parse dialect-specific arguments from string 2529 configuration dictionaries. Dialect classes can now provide their 2530 own list of parameter types and string-conversion routines. 2531 The feature is not yet used by the built-in dialects, however. 2532 2533 .. change:: 2534 :tags: bug, sql 2535 :tickets: 2879 2536 2537 The precedence rules for the :meth:`.ColumnOperators.collate` operator 2538 have been modified, such that the COLLATE operator is now of lower 2539 precedence than the comparison operators. This has the effect that 2540 a COLLATE applied to a comparison will not render parenthesis 2541 around the comparison, which is not parsed by backends such as 2542 MSSQL. The change is backwards incompatible for those setups that 2543 were working around the issue by applying :meth:`.Operators.collate` 2544 to an individual element of the comparison expression, 2545 rather than the comparison expression as a whole. 2546 2547 .. seealso:: 2548 2549 :ref:`migration_2879` 2550 2551 .. change:: 2552 :tags: bug, orm, declarative 2553 :tickets: 2865 2554 2555 The :class:`.DeferredReflection` class has been enhanced to provide 2556 automatic reflection support for the "secondary" table referred 2557 to by a :func:`_orm.relationship`. "secondary", when specified 2558 either as a string table name, or as a :class:`_schema.Table` object with 2559 only a name and :class:`_schema.MetaData` object will also be included 2560 in the reflection process when :meth:`.DeferredReflection.prepare` 2561 is called. 2562 2563 .. change:: 2564 :tags: feature, orm, backrefs 2565 :tickets: 1535 2566 2567 Added new argument ``include_backrefs=True`` to the 2568 :func:`.validates` function; when set to False, a validation event 2569 will not be triggered if the event was initiated as a backref to 2570 an attribute operation from the other side. 2571 2572 .. seealso:: 2573 2574 :ref:`feature_1535` 2575 2576 .. change:: 2577 :tags: bug, orm, collections, py3k 2578 2579 Added support for the Python 3 method ``list.clear()`` within 2580 the ORM collection instrumentation system; pull request 2581 courtesy Eduardo Schettino. 2582 2583 .. change:: 2584 :tags: bug, postgresql 2585 :tickets: 2878 2586 2587 Fixed bug where values within an ENUM weren't escaped for single 2588 quote signs. Note that this is backwards-incompatible for existing 2589 workarounds that manually escape the single quotes. 2590 2591 .. seealso:: 2592 2593 :ref:`migration_2878` 2594 2595 .. change:: 2596 :tags: bug, orm, declarative 2597 2598 Fixed bug where in Py2K a unicode literal would not be accepted 2599 as the string name of a class or other argument within 2600 declarative using :func:`_orm.relationship`. 2601 2602 .. change:: 2603 :tags: feature, sql 2604 :tickets: 2877, 2882 2605 2606 New improvements to the :func:`_expression.text` construct, including 2607 more flexible ways to set up bound parameters and return types; 2608 in particular, a :func:`_expression.text` can now be turned into a full 2609 FROM-object, embeddable in other statements as an alias or CTE 2610 using the new method :meth:`_expression.TextClause.columns`. The :func:`_expression.text` 2611 construct can also render "inline" bound parameters when the construct 2612 is compiled in a "literal bound" context. 2613 2614 .. seealso:: 2615 2616 :ref:`feature_2877` 2617 2618 .. change:: 2619 :tags: feature, sql 2620 2621 A new API for specifying the ``FOR UPDATE`` clause of a ``SELECT`` 2622 is added with the new :meth:`_expression.GenerativeSelect.with_for_update` method. 2623 This method supports a more straightforward system of setting 2624 dialect-specific options compared to the ``for_update`` keyword 2625 argument of :func:`_expression.select`, and also includes support for the 2626 SQL standard ``FOR UPDATE OF`` clause. The ORM also includes 2627 a new corresponding method :meth:`_query.Query.with_for_update`. 2628 Pull request courtesy Mario Lassnig. 2629 2630 .. seealso:: 2631 2632 :ref:`feature_github_42` 2633 2634 .. change:: 2635 :tags: feature, orm 2636 2637 A new API for specifying the ``FOR UPDATE`` clause of a ``SELECT`` 2638 is added with the new :meth:`_query.Query.with_for_update` method, 2639 to complement the new :meth:`_expression.GenerativeSelect.with_for_update` method. 2640 Pull request courtesy Mario Lassnig. 2641 2642 .. seealso:: 2643 2644 :ref:`feature_github_42` 2645 2646 .. change:: 2647 :tags: bug, engine 2648 :tickets: 2873 2649 2650 The :func:`_sa.create_engine` routine and the related 2651 :func:`.make_url` function no longer considers the ``+`` sign 2652 to be a space within the password field. The parsing has been 2653 adjusted to match RFC 1738 exactly, in that both ``username`` 2654 and ``password`` expect only ``:``, ``@``, and ``/`` to be 2655 encoded. 2656 2657 .. seealso:: 2658 2659 :ref:`migration_2873` 2660 2661 2662 .. change:: 2663 :tags: bug, orm 2664 :tickets: 2872 2665 2666 Some refinements to the :class:`.AliasedClass` construct with regards 2667 to descriptors, like hybrids, synonyms, composites, user-defined 2668 descriptors, etc. The attribute 2669 adaptation which goes on has been made more robust, such that if a descriptor 2670 returns another instrumented attribute, rather than a compound SQL 2671 expression element, the operation will still proceed. 2672 Additionally, the "adapted" operator will retain its class; previously, 2673 a change in class from ``InstrumentedAttribute`` to ``QueryableAttribute`` 2674 (a superclass) would interact with Python's operator system such that 2675 an expression like ``aliased(MyClass.x) > MyClass.x`` would reverse itself 2676 to read ``myclass.x < myclass_1.x``. The adapted attribute will also 2677 refer to the new :class:`.AliasedClass` as its parent which was not 2678 always the case before. 2679 2680 .. change:: 2681 :tags: feature, sql 2682 :tickets: 2867 2683 2684 The precision used when coercing a returned floating point value to 2685 Python ``Decimal`` via string is now configurable. The 2686 flag ``decimal_return_scale`` is now supported by all :class:`.Numeric` 2687 and :class:`.Float` types, which will ensure this many digits are taken 2688 from the native floating point value when it is converted to string. 2689 If not present, the type will make use of the value of ``.scale``, if 2690 the type supports this setting and it is non-None. Otherwise the original 2691 default length of 10 is used. 2692 2693 .. seealso:: 2694 2695 :ref:`feature_2867` 2696 2697 .. change:: 2698 :tags: bug, schema 2699 :tickets: 2868 2700 2701 Fixed a regression caused by :ticket:`2812` where the repr() for 2702 table and column names would fail if the name contained non-ascii 2703 characters. 2704 2705 .. change:: 2706 :tags: bug, engine 2707 :tickets: 2848 2708 2709 The :class:`.RowProxy` object is now sortable in Python as a regular 2710 tuple is; this is accomplished via ensuring tuple() conversion on 2711 both sides within the ``__eq__()`` method as well as 2712 the addition of a ``__lt__()`` method. 2713 2714 .. seealso:: 2715 2716 :ref:`migration_2848` 2717 2718 .. change:: 2719 :tags: bug, orm 2720 :tickets: 2833 2721 2722 The ``viewonly`` flag on :func:`_orm.relationship` will now prevent 2723 attribute history from being written on behalf of the target attribute. 2724 This has the effect of the object not being written to the 2725 Session.dirty list if it is mutated. Previously, the object would 2726 be present in Session.dirty, but no change would take place on behalf 2727 of the modified attribute during flush. The attribute still emits 2728 events such as backref events and user-defined events and will still 2729 receive mutations from backrefs. 2730 2731 .. seealso:: 2732 2733 :ref:`migration_2833` 2734 2735 .. change:: 2736 :tags: bug, orm 2737 2738 Added support for new :attr:`.Session.info` attribute to 2739 :class:`.scoped_session`. 2740 2741 .. change:: 2742 :tags: removed 2743 2744 The "informix" and "informixdb" dialects have been removed; the code 2745 is now available as a separate repository on Bitbucket. The IBM-DB 2746 project has provided production-level Informix support since the 2747 informixdb dialect was first added. 2748 2749 .. change:: 2750 :tags: bug, orm 2751 2752 Fixed bug where usage of new :class:`.Bundle` object would cause 2753 the :attr:`_query.Query.column_descriptions` attribute to fail. 2754 2755 .. change:: 2756 :tags: bug, examples 2757 2758 Fixed bug which prevented history_meta recipe from working with 2759 joined inheritance schemes more than one level deep. 2760 2761 .. change:: 2762 :tags: bug, orm, sql, sqlite 2763 :tickets: 2858 2764 2765 Fixed a regression introduced by the join rewriting feature of 2766 :ticket:`2369` and :ticket:`2587` where a nested join with one side 2767 already an aliased select would fail to translate the ON clause on the 2768 outside correctly; in the ORM this could be seen when using a 2769 SELECT statement as a "secondary" table. 2770 2771.. changelog:: 2772 :version: 0.9.0b1 2773 :released: October 26, 2013 2774 2775 .. change:: 2776 :tags: feature, orm 2777 :tickets: 2810 2778 2779 The association proxy now returns ``None`` when fetching a scalar 2780 attribute off of a scalar relationship, where the scalar relationship 2781 itself points to ``None``, instead of raising an ``AttributeError``. 2782 2783 .. seealso:: 2784 2785 :ref:`migration_2810` 2786 2787 .. change:: 2788 :tags: feature, sql, postgresql, mysql 2789 :tickets: 2183 2790 2791 The PostgreSQL and MySQL dialects now support reflection/inspection 2792 of foreign key options, including ON UPDATE, ON DELETE. PostgreSQL 2793 also reflects MATCH, DEFERRABLE, and INITIALLY. Courtesy ijl. 2794 2795 .. change:: 2796 :tags: bug, mysql 2797 :tickets: 2839 2798 2799 Fix and test parsing of MySQL foreign key options within reflection; 2800 this complements the work in :ticket:`2183` where we begin to support 2801 reflection of foreign key options such as ON UPDATE/ON DELETE 2802 cascade. 2803 2804 .. change:: 2805 :tags: bug, orm 2806 :tickets: 2787 2807 2808 :func:`.attributes.get_history()` when used with a scalar column-mapped 2809 attribute will now honor the "passive" flag 2810 passed to it; as this defaults to ``PASSIVE_OFF``, the function will 2811 by default query the database if the value is not present. 2812 This is a behavioral change vs. 0.8. 2813 2814 .. seealso:: 2815 2816 :ref:`change_2787` 2817 2818 .. change:: 2819 :tags: feature, orm 2820 :tickets: 2787 2821 2822 Added new method :meth:`.AttributeState.load_history`, works like 2823 :attr:`.AttributeState.history` but also fires loader callables. 2824 2825 .. seealso:: 2826 2827 :ref:`change_2787` 2828 2829 2830 .. change:: 2831 :tags: feature, sql 2832 :tickets: 2850 2833 2834 A :func:`.bindparam` construct with a "null" type (e.g. no type 2835 specified) is now copied when used in a typed expression, and the 2836 new copy is assigned the actual type of the compared column. Previously, 2837 this logic would occur on the given :func:`.bindparam` in place. 2838 Additionally, a similar process now occurs for :func:`.bindparam` constructs 2839 passed to :meth:`.ValuesBase.values` for an :class:`_expression.Insert` or 2840 :class:`_expression.Update` construct, within the compilation phase of the 2841 construct. 2842 2843 These are both subtle behavioral changes which may impact some 2844 usages. 2845 2846 .. seealso:: 2847 2848 :ref:`migration_2850` 2849 2850 .. change:: 2851 :tags: feature, sql 2852 :tickets: 2804, 2823, 2734 2853 2854 An overhaul of expression handling for special symbols particularly 2855 with conjunctions, e.g. 2856 ``None`` :func:`_expression.null` :func:`_expression.true` 2857 :func:`_expression.false`, including consistency in rendering NULL 2858 in conjunctions, "short-circuiting" of :func:`.and_` and :func:`.or_` 2859 expressions which contain boolean constants, and rendering of 2860 boolean constants and expressions as compared to "1" or "0" for backends 2861 that don't feature ``true``/``false`` constants. 2862 2863 .. seealso:: 2864 2865 :ref:`migration_2804` 2866 2867 .. change:: 2868 :tags: feature, sql 2869 :tickets: 2838 2870 2871 The typing system now handles the task of rendering "literal bind" values, 2872 e.g. values that are normally bound parameters but due to context must 2873 be rendered as strings, typically within DDL constructs such as 2874 CHECK constraints and indexes (note that "literal bind" values 2875 become used by DDL as of :ticket:`2742`). A new method 2876 :meth:`.TypeEngine.literal_processor` serves as the base, and 2877 :meth:`.TypeDecorator.process_literal_param` is added to allow wrapping 2878 of a native literal rendering method. 2879 2880 .. seealso:: 2881 2882 :ref:`change_2838` 2883 2884 .. change:: 2885 :tags: feature, sql 2886 :tickets: 2716 2887 2888 The :meth:`_schema.Table.tometadata` method now produces copies of 2889 all :attr:`.SchemaItem.info` dictionaries from all :class:`.SchemaItem` 2890 objects within the structure including columns, constraints, 2891 foreign keys, etc. As these dictionaries 2892 are copies, they are independent of the original dictionary. 2893 Previously, only the ``.info`` dictionary of :class:`_schema.Column` was transferred 2894 within this operation, and it was only linked in place, not copied. 2895 2896 .. change:: 2897 :tags: feature, postgresql 2898 :tickets: 2840 2899 2900 Added support for rendering ``SMALLSERIAL`` when a :class:`.SmallInteger` 2901 type is used on a primary key autoincrement column, based on server 2902 version detection of PostgreSQL version 9.2 or greater. 2903 2904 .. change:: 2905 :tags: feature, mysql 2906 :tickets: 2817 2907 2908 The MySQL :class:`.mysql.SET` type now features the same auto-quoting 2909 behavior as that of :class:`.mysql.ENUM`. Quotes are not required when 2910 setting up the value, but quotes that are present will be auto-detected 2911 along with a warning. This also helps with Alembic where 2912 the SET type doesn't render with quotes. 2913 2914 .. change:: 2915 :tags: feature, sql 2916 2917 The ``default`` argument of :class:`_schema.Column` now accepts a class 2918 or object method as an argument, in addition to a standalone function; 2919 will properly detect if the "context" argument is accepted or not. 2920 2921 .. change:: 2922 :tags: bug, sql 2923 :tickets: 2835 2924 2925 The "name" attribute is set on :class:`.Index` before the "attach" 2926 events are called, so that attachment events can be used to dynamically 2927 generate a name for the index based on the parent table and/or 2928 columns. 2929 2930 .. change:: 2931 :tags: bug, engine 2932 :tickets: 2748 2933 2934 The method signature of :meth:`.Dialect.reflecttable`, which in 2935 all known cases is provided by :class:`.DefaultDialect`, has been 2936 tightened to expect ``include_columns`` and ``exclude_columns`` 2937 arguments without any kw option, reducing ambiguity - previously 2938 ``exclude_columns`` was missing. 2939 2940 .. change:: 2941 :tags: bug, sql 2942 :tickets: 2831 2943 2944 The erroneous kw arg "schema" has been removed from the :class:`_schema.ForeignKey` 2945 object. this was an accidental commit that did nothing; a warning is raised 2946 in 0.8.3 when this kw arg is used. 2947 2948 .. change:: 2949 :tags: feature, orm 2950 :tickets: 1418 2951 2952 Added a new load option :func:`_orm.load_only`. This allows a series 2953 of column names to be specified as loading "only" those attributes, 2954 deferring the rest. 2955 2956 .. change:: 2957 :tags: feature, orm 2958 :tickets: 1418 2959 2960 The system of loader options has been entirely rearchitected to build 2961 upon a much more comprehensive base, the :class:`_orm.Load` object. This 2962 base allows any common loader option like :func:`_orm.joinedload`, 2963 :func:`.defer`, etc. to be used in a "chained" style for the purpose 2964 of specifying options down a path, such as ``joinedload("foo").subqueryload("bar")``. 2965 The new system supersedes the usage of dot-separated path names, 2966 multiple attributes within options, and the usage of ``_all()`` options. 2967 2968 .. seealso:: 2969 2970 :ref:`feature_1418` 2971 2972 .. change:: 2973 :tags: feature, orm 2974 :tickets: 2824 2975 2976 The :func:`.composite` construct now maintains the return object 2977 when used in a column-oriented :class:`_query.Query`, rather than expanding 2978 out into individual columns. This makes use of the new :class:`.Bundle` 2979 feature internally. This behavior is backwards incompatible; to 2980 select from a composite column which will expand out, use 2981 ``MyClass.some_composite.clauses``. 2982 2983 .. seealso:: 2984 2985 :ref:`migration_2824` 2986 2987 .. change:: 2988 :tags: feature, orm 2989 :tickets: 2824 2990 2991 A new construct :class:`.Bundle` is added, which allows for specification 2992 of groups of column expressions to a :class:`_query.Query` construct. 2993 The group of columns are returned as a single tuple by default. The 2994 behavior of :class:`.Bundle` can be overridden however to provide 2995 any sort of result processing to the returned row. The behavior 2996 of :class:`.Bundle` is also embedded into composite attributes now 2997 when they are used in a column-oriented :class:`_query.Query`. 2998 2999 .. seealso:: 3000 3001 :ref:`change_2824` 3002 3003 :ref:`migration_2824` 3004 3005 .. change:: 3006 :tags: bug, sql 3007 :tickets: 2812 3008 3009 A rework to the way that "quoted" identifiers are handled, in that 3010 instead of relying upon various ``quote=True`` flags being passed around, 3011 these flags are converted into rich string objects with quoting information 3012 included at the point at which they are passed to common schema constructs 3013 like :class:`_schema.Table`, :class:`_schema.Column`, etc. This solves the issue 3014 of various methods that don't correctly honor the "quote" flag such 3015 as :meth:`_engine.Engine.has_table` and related methods. The :class:`.quoted_name` 3016 object is a string subclass that can also be used explicitly if needed; 3017 the object will hold onto the quoting preferences passed and will 3018 also bypass the "name normalization" performed by dialects that 3019 standardize on uppercase symbols, such as Oracle, Firebird and DB2. 3020 The upshot is that the "uppercase" backends can now work with force-quoted 3021 names, such as lowercase-quoted names and new reserved words. 3022 3023 .. seealso:: 3024 3025 :ref:`change_2812` 3026 3027 .. change:: 3028 :tags: feature, orm 3029 :tickets: 2793 3030 3031 The ``version_id_generator`` parameter of ``Mapper`` can now be specified 3032 to rely upon server generated version identifiers, using triggers 3033 or other database-provided versioning features, or via an optional programmatic 3034 value, by setting ``version_id_generator=False``. 3035 When using a server-generated version identifier, the ORM will use RETURNING when 3036 available to immediately 3037 load the new version value, else it will emit a second SELECT. 3038 3039 .. change:: 3040 :tags: feature, orm 3041 :tickets: 2793 3042 3043 The ``eager_defaults`` flag of :class:`_orm.Mapper` will now allow the 3044 newly generated default values to be fetched using an inline 3045 RETURNING clause, rather than a second SELECT statement, for backends 3046 that support RETURNING. 3047 3048 .. change:: 3049 :tags: feature, core 3050 :tickets: 2793 3051 3052 Added a new variant to :meth:`.UpdateBase.returning` called 3053 :meth:`.ValuesBase.return_defaults`; this allows arbitrary columns 3054 to be added to the RETURNING clause of the statement without interfering 3055 with the compilers usual "implicit returning" feature, which is used to 3056 efficiently fetch newly generated primary key values. For supporting 3057 backends, a dictionary of all fetched values is present at 3058 :attr:`_engine.ResultProxy.returned_defaults`. 3059 3060 .. change:: 3061 :tags: bug, mysql 3062 3063 Improved support for the cymysql driver, supporting version 0.6.5, 3064 courtesy Hajime Nakagami. 3065 3066 .. change:: 3067 :tags: general 3068 3069 A large refactoring of packages has reorganized 3070 the import structure of many Core modules as well as some aspects 3071 of the ORM modules. In particular ``sqlalchemy.sql`` has been broken 3072 out into several more modules than before so that the very large size 3073 of ``sqlalchemy.sql.expression`` is now pared down. The effort 3074 has focused on a large reduction in import cycles. Additionally, 3075 the system of API functions in ``sqlalchemy.sql.expression`` and 3076 ``sqlalchemy.orm`` has been reorganized to eliminate redundancy 3077 in documentation between the functions vs. the objects they produce. 3078 3079 .. change:: 3080 :tags: orm, feature, orm 3081 3082 Added a new attribute :attr:`.Session.info` to :class:`.Session`; 3083 this is a dictionary where applications can store arbitrary 3084 data local to a :class:`.Session`. 3085 The contents of :attr:`.Session.info` can be also be initialized 3086 using the ``info`` argument of :class:`.Session` or 3087 :class:`.sessionmaker`. 3088 3089 3090 .. change:: 3091 :tags: feature, general, py3k 3092 :tickets: 2161 3093 3094 The C extensions are ported to Python 3 and will build under 3095 any supported CPython 2 or 3 environment. 3096 3097 .. change:: 3098 :tags: feature, orm 3099 :tickets: 2268 3100 3101 Removal of event listeners is now implemented. The feature is 3102 provided via the :func:`.event.remove` function. 3103 3104 .. seealso:: 3105 3106 :ref:`feature_2268` 3107 3108 .. change:: 3109 :tags: feature, orm 3110 :tickets: 2789 3111 3112 The mechanism by which attribute events pass along an 3113 :class:`.AttributeImpl` as an "initiator" token has been changed; 3114 the object is now an event-specific object called :class:`.attributes.Event`. 3115 Additionally, the attribute system no longer halts events based 3116 on a matching "initiator" token; this logic has been moved to be 3117 specific to ORM backref event handlers, which are the typical source 3118 of the re-propagation of an attribute event onto subsequent append/set/remove 3119 operations. End user code which emulates the behavior of backrefs 3120 must now ensure that recursive event propagation schemes are halted, 3121 if the scheme does not use the backref handlers. Using this new system, 3122 backref handlers can now perform a 3123 "two-hop" operation when an object is appended to a collection, 3124 associated with a new many-to-one, de-associated with the previous 3125 many-to-one, and then removed from a previous collection. Before this 3126 change, the last step of removal from the previous collection would 3127 not occur. 3128 3129 .. seealso:: 3130 3131 :ref:`migration_2789` 3132 3133 .. change:: 3134 :tags: feature, sql 3135 :tickets: 722 3136 3137 Added new method to the :func:`_expression.insert` construct 3138 :meth:`_expression.Insert.from_select`. Given a list of columns and 3139 a selectable, renders ``INSERT INTO (table) (columns) SELECT ..``. 3140 While this feature is highlighted as part of 0.9 it is also 3141 backported to 0.8.3. 3142 3143 .. seealso:: 3144 3145 :ref:`feature_722` 3146 3147 .. change:: 3148 :tags: feature, engine 3149 :tickets: 2770 3150 3151 New events added to :class:`_events.ConnectionEvents`: 3152 3153 * :meth:`_events.ConnectionEvents.engine_connect` 3154 * :meth:`_events.ConnectionEvents.set_connection_execution_options` 3155 * :meth:`_events.ConnectionEvents.set_engine_execution_options` 3156 3157 .. change:: 3158 :tags: bug, sql 3159 :tickets: 1765 3160 3161 The resolution of :class:`_schema.ForeignKey` objects to their 3162 target :class:`_schema.Column` has been reworked to be as 3163 immediate as possible, based on the moment that the 3164 target :class:`_schema.Column` is associated with the same 3165 :class:`_schema.MetaData` as this :class:`_schema.ForeignKey`, rather 3166 than waiting for the first time a join is constructed, 3167 or similar. This along with other improvements allows 3168 earlier detection of some foreign key configuration 3169 issues. Also included here is a rework of the 3170 type-propagation system, so that 3171 it should be reliable now to set the type as ``None`` 3172 on any :class:`_schema.Column` that refers to another via 3173 :class:`_schema.ForeignKey` - the type will be copied from the 3174 target column as soon as that other column is associated, 3175 and now works for composite foreign keys as well. 3176 3177 .. seealso:: 3178 3179 :ref:`migration_1765` 3180 3181 .. change:: 3182 :tags: feature, sql 3183 :tickets: 2744, 2734 3184 3185 Provided a new attribute for :class:`.TypeDecorator` 3186 called :attr:`.TypeDecorator.coerce_to_is_types`, 3187 to make it easier to control how comparisons using 3188 ``==`` or ``!=`` to ``None`` and boolean types goes 3189 about producing an ``IS`` expression, or a plain 3190 equality expression with a bound parameter. 3191 3192 .. change:: 3193 :tags: feature, pool 3194 :tickets: 2752 3195 3196 Added pool logging for "rollback-on-return" and the less used 3197 "commit-on-return". This is enabled with the rest of pool 3198 "debug" logging. 3199 3200 .. change:: 3201 :tags: bug, orm, associationproxy 3202 :tickets: 2751 3203 3204 Added additional criterion to the ==, != comparators, used with 3205 scalar values, for comparisons to None to also take into account 3206 the association record itself being non-present, in addition to the 3207 existing test for the scalar endpoint on the association record 3208 being NULL. Previously, comparing ``Cls.scalar == None`` would return 3209 records for which ``Cls.associated`` were present and 3210 ``Cls.associated.scalar`` is None, but not rows for which 3211 ``Cls.associated`` is non-present. More significantly, the 3212 inverse operation ``Cls.scalar != None`` *would* return ``Cls`` 3213 rows for which ``Cls.associated`` was non-present. 3214 3215 The case for ``Cls.scalar != 'somevalue'`` is also modified 3216 to act more like a direct SQL comparison; only rows for 3217 which ``Cls.associated`` is present and ``Associated.scalar`` 3218 is non-NULL and not equal to ``'somevalue'`` are returned. 3219 Previously, this would be a simple ``NOT EXISTS``. 3220 3221 Also added a special use case where you 3222 can call ``Cls.scalar.has()`` with no arguments, 3223 when ``Cls.scalar`` is a column-based value - this returns whether or 3224 not ``Cls.associated`` has any rows present, regardless of whether 3225 or not ``Cls.associated.scalar`` is NULL or not. 3226 3227 .. seealso:: 3228 3229 :ref:`migration_2751` 3230 3231 3232 .. change:: 3233 :tags: feature, orm 3234 :tickets: 2587 3235 3236 A major change regarding how the ORM constructs joins where 3237 the right side is itself a join or left outer join. The ORM 3238 is now configured to allow simple nesting of joins of 3239 the form ``a JOIN (b JOIN c ON b.id=c.id) ON a.id=b.id``, 3240 rather than forcing the right side into a ``SELECT`` subquery. 3241 This should allow significant performance improvements on most 3242 backends, most particularly MySQL. The one database backend 3243 that has for many years held back this change, SQLite, is now addressed by 3244 moving the production of the ``SELECT`` subquery from the 3245 ORM to the SQL compiler; so that a right-nested join on SQLite will still 3246 ultimately render with a ``SELECT``, while all other backends 3247 are no longer impacted by this workaround. 3248 3249 As part of this change, a new argument ``flat=True`` has been added 3250 to the :func:`_orm.aliased`, :meth:`_expression.Join.alias`, and 3251 :func:`_orm.with_polymorphic` functions, which allows an "alias" of a 3252 JOIN to be produced which applies an anonymous alias to each component 3253 table within the join, rather than producing a subquery. 3254 3255 .. seealso:: 3256 3257 :ref:`feature_joins_09` 3258 3259 3260 .. change:: 3261 :tags: bug, orm 3262 :tickets: 2369 3263 3264 Fixed an obscure bug where the wrong results would be 3265 fetched when joining/joinedloading across a many-to-many 3266 relationship to a single-table-inheriting 3267 subclass with a specific discriminator value, due to "secondary" 3268 rows that would come back. The "secondary" and right-side 3269 tables are now inner joined inside of parenthesis for all 3270 ORM joins on many-to-many relationships so that the left->right 3271 join can accurately filtered. This change was made possible 3272 by finally addressing the issue with right-nested joins 3273 outlined in :ticket:`2587`. 3274 3275 .. seealso:: 3276 3277 :ref:`feature_joins_09` 3278 3279 .. change:: 3280 :tags: bug, mssql, pyodbc 3281 :tickets: 2355 3282 3283 Fixes to MSSQL with Python 3 + pyodbc, including that statements 3284 are passed correctly. 3285 3286 .. change:: 3287 :tags: feature, sql 3288 :tickets: 1068 3289 3290 A :func:`~sqlalchemy.sql.expression.label` construct will now render as its name alone 3291 in an ``ORDER BY`` clause, if that label is also referred to 3292 in the columns clause of the select, instead of rewriting the 3293 full expression. This gives the database a better chance to 3294 optimize the evaluation of the same expression in two different 3295 contexts. 3296 3297 .. seealso:: 3298 3299 :ref:`migration_1068` 3300 3301 .. change:: 3302 :tags: feature, firebird 3303 :tickets: 2504 3304 3305 The ``fdb`` dialect is now the default dialect when 3306 specified without a dialect qualifier, i.e. ``firebird://``, 3307 per the Firebird project publishing ``fdb`` as their 3308 official Python driver. 3309 3310 .. change:: 3311 :tags: feature, general, py3k 3312 :tickets: 2671 3313 3314 The codebase is now "in-place" for Python 3315 2 and 3, the need to run 2to3 has been removed. 3316 Compatibility is now against Python 2.6 on forward. 3317 3318 .. change:: 3319 :tags: feature, oracle, py3k 3320 3321 The Oracle unit tests with cx_oracle now pass 3322 fully under Python 3. 3323 3324 .. change:: 3325 :tags: bug, orm 3326 :tickets: 2736 3327 3328 The "auto-aliasing" behavior of the :meth:`_query.Query.select_from` 3329 method has been turned off. The specific behavior is now 3330 available via a new method :meth:`_query.Query.select_entity_from`. 3331 The auto-aliasing behavior here was never well documented and 3332 is generally not what's desired, as :meth:`_query.Query.select_from` 3333 has become more oriented towards controlling how a JOIN is 3334 rendered. :meth:`_query.Query.select_entity_from` will also be made 3335 available in 0.8 so that applications which rely on the auto-aliasing 3336 can shift their applications to use this method. 3337 3338 .. seealso:: 3339 3340 :ref:`migration_2736` 3341