1============= 20.6 Changelog 3============= 4 5.. changelog:: 6 :version: 0.6.9 7 :released: Sat May 05 2012 8 9 .. change:: 10 :tags: general 11 :tickets: 2279 12 13 Adjusted the "importlater" mechanism, which is 14 used internally to resolve import cycles, 15 such that the usage of __import__ is completed 16 when the import of sqlalchemy or sqlalchemy.orm 17 is done, thereby avoiding any usage of __import__ 18 after the application starts new threads, 19 fixes. 20 21 .. change:: 22 :tags: orm 23 :tickets: 2197 24 25 Fixed bug whereby the source clause 26 used by query.join() would be inconsistent 27 if against a column expression that combined 28 multiple entities together. 29 30 .. change:: 31 :tags: orm, bug 32 :tickets: 2310 33 34 fixed inappropriate evaluation of user-mapped 35 object in a boolean context within query.get(). 36 37 .. change:: 38 :tags: orm 39 :tickets: 2228 40 41 Fixed bug apparent only in Python 3 whereby 42 sorting of persistent + pending objects during 43 flush would produce an illegal comparison, 44 if the persistent object primary key 45 is not a single integer. 46 47 .. change:: 48 :tags: orm 49 :tickets: 2234 50 51 Fixed bug where query.join() + aliased=True 52 from a joined-inh structure to itself on 53 relationship() with join condition on the child 54 table would convert the lead entity into the 55 joined one inappropriately. 56 57 .. change:: 58 :tags: orm 59 :tickets: 2287 60 61 Fixed bug whereby mapper.order_by attribute would 62 be ignored in the "inner" query within a 63 subquery eager load. . 64 65 .. change:: 66 :tags: orm 67 :tickets: 2215 68 69 Fixed bug whereby if a mapped class 70 redefined __hash__() or __eq__() to something 71 non-standard, which is a supported use case 72 as SQLA should never consult these, 73 the methods would be consulted if the class 74 was part of a "composite" (i.e. non-single-entity) 75 result set. 76 77 .. change:: 78 :tags: orm 79 :tickets: 2188 80 81 Fixed subtle bug that caused SQL to blow 82 up if: column_property() against subquery + 83 joinedload + LIMIT + order by the column 84 property() occurred. . 85 86 .. change:: 87 :tags: orm 88 :tickets: 2207 89 90 The join condition produced by with_parent 91 as well as when using a "dynamic" relationship 92 against a parent will generate unique 93 bindparams, rather than incorrectly repeating 94 the same bindparam. . 95 96 .. change:: 97 :tags: orm 98 :tickets: 2199 99 100 Repaired the "no statement condition" 101 assertion in Query which would attempt 102 to raise if a generative method were called 103 after from_statement() were called.. 104 105 .. change:: 106 :tags: orm 107 :tickets: 1776 108 109 Cls.column.collate("some collation") now 110 works. 111 112 .. change:: 113 :tags: orm, bug 114 :tickets: 2297 115 116 Fixed the error formatting raised when 117 a tuple is inadvertently passed to session.query(). 118 119 .. change:: 120 :tags: engine 121 :tickets: 2317 122 123 Backported the fix for introduced 124 in 0.7.4, which ensures that the connection 125 is in a valid state before attempting to call 126 rollback()/prepare()/release() on savepoint 127 and two-phase transactions. 128 129 .. change:: 130 :tags: sql 131 :tickets: 2188 132 133 Fixed two subtle bugs involving column 134 correspondence in a selectable, 135 one with the same labeled subquery repeated, the other 136 when the label has been "grouped" and 137 loses itself. Affects. 138 139 .. change:: 140 :tags: sql 141 :tickets: 142 143 Fixed bug whereby "warn on unicode" flag 144 would get set for the String type 145 when used with certain dialects. This 146 bug is not in 0.7. 147 148 .. change:: 149 :tags: sql 150 :tickets: 2270 151 152 Fixed bug whereby with_only_columns() method of 153 Select would fail if a selectable were passed.. However, the FROM behavior is 154 still incorrect here, so you need 0.7 in 155 any case for this use case to be usable. 156 157 .. change:: 158 :tags: schema 159 :tickets: 160 161 Added an informative error message when 162 ForeignKeyConstraint refers to a column name in 163 the parent that is not found. 164 165 .. change:: 166 :tags: postgresql 167 :tickets: 2291, 2141 168 169 Fixed bug related to whereby the 170 same modified index behavior in PG 9 affected 171 primary key reflection on a renamed column.. 172 173 .. change:: 174 :tags: mysql 175 :tickets: 2186 176 177 Fixed OurSQL dialect to use ansi-neutral 178 quote symbol "'" for XA commands instead 179 of '"'. . 180 181 .. change:: 182 :tags: mysql 183 :tickets: 2225 184 185 a CREATE TABLE will put the COLLATE option 186 after CHARSET, which appears to be part of 187 MySQL's arbitrary rules regarding if it will actually 188 work or not. 189 190 .. change:: 191 :tags: mssql, bug 192 :tickets: 2269 193 194 Decode incoming values when retrieving 195 list of index names and the names of columns 196 within those indexes. 197 198 .. change:: 199 :tags: oracle 200 :tickets: 2200 201 202 Added ORA-00028 to disconnect codes, use 203 cx_oracle _Error.code to get at the code,. 204 205 .. change:: 206 :tags: oracle 207 :tickets: 2220 208 209 repaired the oracle.RAW type which did not 210 generate the correct DDL. 211 212 .. change:: 213 :tags: oracle 214 :tickets: 2212 215 216 added CURRENT to reserved word list. 217 218 .. change:: 219 :tags: examples 220 :tickets: 2266 221 222 Adjusted dictlike-polymorphic.py example 223 to apply the CAST such that it works on 224 PG, other databases. 225 226.. changelog:: 227 :version: 0.6.8 228 :released: Sun Jun 05 2011 229 230 .. change:: 231 :tags: orm 232 :tickets: 2144 233 234 Calling query.get() against a column-based entity is 235 invalid, this condition now raises a deprecation warning. 236 237 .. change:: 238 :tags: orm 239 :tickets: 2151 240 241 a non_primary mapper will inherit the _identity_class 242 of the primary mapper. This so that a non_primary 243 established against a class that's normally in an 244 inheritance mapping will produce results that are 245 identity-map compatible with that of the primary 246 mapper 247 248 .. change:: 249 :tags: orm 250 :tickets: 2148 251 252 Backported 0.7's identity map implementation, which 253 does not use a mutex around removal. This as some users 254 were still getting deadlocks despite the adjustments 255 in 0.6.7; the 0.7 approach that doesn't use a mutex 256 does not appear to produce "dictionary changed size" 257 issues, the original rationale for the mutex. 258 259 .. change:: 260 :tags: orm 261 :tickets: 2163 262 263 Fixed the error message emitted for "can't 264 execute syncrule for destination column 'q'; 265 mapper 'X' does not map this column" to 266 reference the correct mapper. . 267 268 .. change:: 269 :tags: orm 270 :tickets: 2149 271 272 Fixed bug where determination of "self referential" 273 relationship would fail with no workaround 274 for joined-inh subclass related to itself, 275 or joined-inh subclass related to a subclass 276 of that with no cols in the sub-sub class 277 in the join condition. 278 279 .. change:: 280 :tags: orm 281 :tickets: 2153 282 283 mapper() will ignore non-configured foreign keys 284 to unrelated tables when determining inherit 285 condition between parent and child class. 286 This is equivalent to behavior already 287 applied to declarative. Note that 0.7 has a 288 more comprehensive solution to this, altering 289 how join() itself determines an FK error. 290 291 .. change:: 292 :tags: orm 293 :tickets: 2171 294 295 Fixed bug whereby mapper mapped to an anonymous 296 alias would fail if logging were used, due to 297 unescaped % sign in the alias name. 298 299 .. change:: 300 :tags: orm 301 :tickets: 2170 302 303 Modify the text of the message which occurs 304 when the "identity" key isn't detected on 305 flush, to include the common cause that 306 the Column isn't set up to detect 307 auto-increment correctly;. 308 309 .. change:: 310 :tags: orm 311 :tickets: 2182 312 313 Fixed bug where transaction-level "deleted" 314 collection wouldn't be cleared of expunged 315 states, raising an error if they later 316 became transient. 317 318 .. change:: 319 :tags: sql 320 :tickets: 2147 321 322 Fixed bug whereby if FetchedValue was passed 323 to column server_onupdate, it would not 324 have its parent "column" assigned, added 325 test coverage for all column default assignment 326 patterns. 327 328 .. change:: 329 :tags: sql 330 :tickets: 2167 331 332 Fixed bug whereby nesting a label of a select() 333 with another label in it would produce incorrect 334 exported columns. Among other things this would 335 break an ORM column_property() mapping against 336 another column_property(). . 337 338 .. change:: 339 :tags: engine 340 :tickets: 2178 341 342 Adjusted the __contains__() method of 343 a RowProxy result row such that no exception 344 throw is generated internally; 345 NoSuchColumnError() also will generate its 346 message regardless of whether or not the column 347 construct can be coerced to a string.. 348 349 .. change:: 350 :tags: postgresql 351 :tickets: 2141 352 353 Fixed bug affecting PG 9 whereby index reflection 354 would fail if against a column whose name 355 had changed. . 356 357 .. change:: 358 :tags: postgresql 359 :tickets: 2175 360 361 Some unit test fixes regarding numeric arrays, 362 MATCH operator. A potential floating-point 363 inaccuracy issue was fixed, and certain tests 364 of the MATCH operator only execute within an 365 EN-oriented locale for now. . 366 367 .. change:: 368 :tags: mssql 369 :tickets: 2169 370 371 Fixed bug in MSSQL dialect whereby the aliasing 372 applied to a schema-qualified table would leak 373 into enclosing select statements. 374 375 .. change:: 376 :tags: mssql 377 :tickets: 2159 378 379 Fixed bug whereby DATETIME2 type would fail on 380 the "adapt" step when used in result sets or 381 bound parameters. This issue is not in 0.7. 382 383.. changelog:: 384 :version: 0.6.7 385 :released: Wed Apr 13 2011 386 387 .. change:: 388 :tags: orm 389 :tickets: 2087 390 391 Tightened the iterate vs. remove mutex around the 392 identity map iteration, attempting to reduce the 393 chance of an (extremely rare) reentrant gc operation 394 causing a deadlock. Might remove the mutex in 395 0.7. 396 397 .. change:: 398 :tags: orm 399 :tickets: 2030 400 401 Added a `name` argument to `Query.subquery()`, to allow 402 a fixed name to be assigned to the alias object. 403 404 .. change:: 405 :tags: orm 406 :tickets: 2019 407 408 A warning is emitted when a joined-table inheriting mapper 409 has no primary keys on the locally mapped table 410 (but has pks on the superclass table). 411 412 .. change:: 413 :tags: orm 414 :tickets: 2038 415 416 Fixed bug where "middle" class in a polymorphic hierarchy 417 would have no 'polymorphic_on' column if it didn't also 418 specify a 'polymorphic_identity', leading to strange 419 errors upon refresh, wrong class loaded when querying 420 from that target. Also emits the correct WHERE criterion 421 when using single table inheritance. 422 423 .. change:: 424 :tags: orm 425 :tickets: 1995 426 427 Fixed bug where a column with a SQL or server side default 428 that was excluded from a mapping with include_properties 429 or exclude_properties would result in UnmappedColumnError. 430 431 .. change:: 432 :tags: orm 433 :tickets: 2046 434 435 A warning is emitted in the unusual case that an 436 append or similar event on a collection occurs after 437 the parent object has been dereferenced, which 438 prevents the parent from being marked as "dirty" 439 in the session. This will be an exception in 0.7. 440 441 .. change:: 442 :tags: orm 443 :tickets: 2098 444 445 Fixed bug in query.options() whereby a path 446 applied to a lazyload using string keys could 447 overlap a same named attribute on the wrong 448 entity. Note 0.7 has an updated version of this 449 fix. 450 451 .. change:: 452 :tags: orm 453 :tickets: 2063 454 455 Reworded the exception raised when a flush 456 is attempted of a subclass that is not polymorphic 457 against the supertype. 458 459 .. change:: 460 :tags: orm 461 :tickets: 2123 462 463 Some fixes to the state handling regarding 464 backrefs, typically when autoflush=False, where 465 the back-referenced collection wouldn't 466 properly handle add/removes with no net 467 change. Thanks to Richard Murri for the 468 test case + patch. 469 470 .. change:: 471 :tags: orm 472 :tickets: 2130 473 474 a "having" clause would be copied from the 475 inside to the outside query if from_self() 476 were used.. 477 478 .. change:: 479 :tags: sql 480 :tickets: 2028 481 482 Column.copy(), as used in table.tometadata(), copies the 483 'doc' attribute. 484 485 .. change:: 486 :tags: sql 487 :tickets: 2023 488 489 Added some defs to the resultproxy.c extension so that 490 the extension compiles and runs on Python 2.4. 491 492 .. change:: 493 :tags: sql 494 :tickets: 2042 495 496 The compiler extension now supports overriding the default 497 compilation of expression._BindParamClause including that 498 the auto-generated binds within the VALUES/SET clause 499 of an insert()/update() statement will also use the new 500 compilation rules. 501 502 .. change:: 503 :tags: sql 504 :tickets: 2089 505 506 Added accessors to ResultProxy "returns_rows", "is_insert" 507 508 .. change:: 509 :tags: sql 510 :tickets: 2116 511 512 The limit/offset keywords to select() as well 513 as the value passed to select.limit()/offset() 514 will be coerced to integer. 515 516 .. change:: 517 :tags: engine 518 :tickets: 2102 519 520 Fixed bug in QueuePool, SingletonThreadPool whereby 521 connections that were discarded via overflow or periodic 522 cleanup() were not explicitly closed, leaving garbage 523 collection to the task instead. This generally only 524 affects non-reference-counting backends like Jython 525 and PyPy. Thanks to Jaimy Azle for spotting 526 this. 527 528 .. change:: 529 :tags: sqlite 530 :tickets: 2115 531 532 Fixed bug where reflection of foreign key 533 created as "REFERENCES <tablename>" without 534 col name would fail. 535 536 .. change:: 537 :tags: postgresql 538 :tickets: 1083 539 540 When explicit sequence execution derives the name 541 of the auto-generated sequence of a SERIAL column, 542 which currently only occurs if implicit_returning=False, 543 now accommodates if the table + column name is greater 544 than 63 characters using the same logic PostgreSQL uses. 545 546 .. change:: 547 :tags: postgresql 548 :tickets: 2044 549 550 Added an additional libpq message to the list of "disconnect" 551 exceptions, "could not receive data from server" 552 553 .. change:: 554 :tags: postgresql 555 :tickets: 2092 556 557 Added RESERVED_WORDS for postgresql dialect. 558 559 .. change:: 560 :tags: postgresql 561 :tickets: 2073 562 563 Fixed the BIT type to allow a "length" parameter, "varying" 564 parameter. Reflection also fixed. 565 566 .. change:: 567 :tags: informix 568 :tickets: 2092 569 570 Added RESERVED_WORDS informix dialect. 571 572 .. change:: 573 :tags: mssql 574 :tickets: 2071 575 576 Rewrote the query used to get the definition of a view, 577 typically when using the Inspector interface, to 578 use sys.sql_modules instead of the information schema, 579 thereby allowing views definitions longer than 4000 580 characters to be fully returned. 581 582 .. change:: 583 :tags: mysql 584 :tickets: 2047 585 586 oursql dialect accepts the same "ssl" arguments in 587 create_engine() as that of MySQLdb. 588 589 .. change:: 590 :tags: firebird 591 :tickets: 2083 592 593 The "implicit_returning" flag on create_engine() is 594 honored if set to False. 595 596 .. change:: 597 :tags: oracle 598 :tickets: 2100 599 600 Using column names that would require quotes 601 for the column itself or for a name-generated 602 bind parameter, such as names with special 603 characters, underscores, non-ascii characters, 604 now properly translate bind parameter keys when 605 talking to cx_oracle. 606 607 .. change:: 608 :tags: oracle 609 :tickets: 2116 610 611 Oracle dialect adds use_binds_for_limits=False 612 create_engine() flag, will render the LIMIT/OFFSET 613 values inline instead of as binds, reported to 614 modify the execution plan used by Oracle. 615 616 .. change:: 617 :tags: ext 618 :tickets: 2090 619 620 The horizontal_shard ShardedSession class accepts the common 621 Session argument "query_cls" as a constructor argument, 622 to enable further subclassing of ShardedQuery. 623 624 .. change:: 625 :tags: declarative 626 :tickets: 2050 627 628 Added an explicit check for the case that the name 629 'metadata' is used for a column attribute on a 630 declarative class. 631 632 .. change:: 633 :tags: declarative 634 :tickets: 2061 635 636 Fix error message referencing old @classproperty 637 name to reference @declared_attr 638 639 .. change:: 640 :tags: declarative 641 :tickets: 2091 642 643 Arguments in __mapper_args__ that aren't "hashable" 644 aren't mistaken for always-hashable, possibly-column 645 arguments. 646 647 .. change:: 648 :tags: documentation 649 :tickets: 2029 650 651 Documented SQLite DATE/TIME/DATETIME types. 652 653 .. change:: 654 :tags: examples 655 :tickets: 2090 656 657 The Beaker caching example allows a "query_cls" argument 658 to the query_callable() function. 659 660.. changelog:: 661 :version: 0.6.6 662 :released: Sat Jan 08 2011 663 664 .. change:: 665 :tags: orm 666 :tickets: 667 668 Fixed bug whereby a non-"mutable" attribute modified event 669 which occurred on an object that was clean except for 670 preceding mutable attribute changes would fail to strongly 671 reference itself in the identity map. This would cause the 672 object to be garbage collected, losing track of any changes 673 that weren't previously saved in the "mutable changes" 674 dictionary. 675 676 .. change:: 677 :tags: orm 678 :tickets: 2013 679 680 Fixed bug whereby "passive_deletes='all'" wasn't passing 681 the correct symbols to lazy loaders during flush, thereby 682 causing an unwarranted load. 683 684 .. change:: 685 :tags: orm 686 :tickets: 1997 687 688 Fixed bug which prevented composite mapped 689 attributes from being used on a mapped select statement.. Note the workings of composite are slated to 690 change significantly in 0.7. 691 692 .. change:: 693 :tags: orm 694 :tickets: 1976 695 696 active_history flag also added to composite(). 697 The flag has no effect in 0.6, but is instead 698 a placeholder flag for forwards compatibility, 699 as it applies in 0.7 for composites. 700 701 .. change:: 702 :tags: orm 703 :tickets: 2002 704 705 Fixed uow bug whereby expired objects passed to 706 Session.delete() would not have unloaded references 707 or collections taken into account when deleting 708 objects, despite passive_deletes remaining at 709 its default of False. 710 711 .. change:: 712 :tags: orm 713 :tickets: 1987 714 715 A warning is emitted when version_id_col is specified 716 on an inheriting mapper when the inherited mapper 717 already has one, if those column expressions are not 718 the same. 719 720 .. change:: 721 :tags: orm 722 :tickets: 1954 723 724 "innerjoin" flag doesn't take effect along the chain 725 of joinedload() joins if a previous join in that chain 726 is an outer join, thus allowing primary rows without 727 a referenced child row to be correctly returned 728 in results. 729 730 .. change:: 731 :tags: orm 732 :tickets: 1964 733 734 Fixed bug regarding "subqueryload" strategy whereby 735 strategy would fail if the entity was an aliased() 736 construct. 737 738 .. change:: 739 :tags: orm 740 :tickets: 2014 741 742 Fixed bug regarding "subqueryload" strategy whereby 743 the join would fail if using a multi-level load 744 of the form from A->joined-subclass->C 745 746 .. change:: 747 :tags: orm 748 :tickets: 1968 749 750 Fixed indexing of Query objects by -1. It was erroneously 751 transformed to the empty slice -1:0 that resulted in 752 IndexError. 753 754 .. change:: 755 :tags: orm 756 :tickets: 1971 757 758 The mapper argument "primary_key" can be passed as a 759 single column as well as a list or tuple. 760 The documentation examples that illustrated it as a 761 scalar value have been changed to lists. 762 763 .. change:: 764 :tags: orm 765 :tickets: 1961 766 767 Added active_history flag to relationship() 768 and column_property(), forces attribute events to 769 always load the "old" value, so that it's available to 770 attributes.get_history(). 771 772 .. change:: 773 :tags: orm 774 :tickets: 1977 775 776 Query.get() will raise if the number of params 777 in a composite key is too large, as well as too 778 small. 779 780 .. change:: 781 :tags: orm 782 :tickets: 1992 783 784 Backport of "optimized get" fix from 0.7, 785 improves the generation of joined-inheritance 786 "load expired row" behavior. 787 788 .. change:: 789 :tags: orm 790 :tickets: 791 792 A little more verbiage to the "primaryjoin" error, 793 in an unusual condition that the join condition 794 "works" for viewonly but doesn't work for non-viewonly, 795 and foreign_keys wasn't used - adds "foreign_keys" to 796 the suggestion. Also add "foreign_keys" to the 797 suggestion for the generic "direction" error. 798 799 .. change:: 800 :tags: sql 801 :tickets: 1984 802 803 Fixed operator precedence rules for multiple 804 chains of a single non-associative operator. 805 I.e. "x - (y - z)" will compile as "x - (y - z)" 806 and not "x - y - z". Also works with labels, 807 i.e. "x - (y - z).label('foo')" 808 809 .. change:: 810 :tags: sql 811 :tickets: 1967 812 813 The 'info' attribute of Column is copied during 814 Column.copy(), i.e. as occurs when using columns 815 in declarative mixins. 816 817 .. change:: 818 :tags: sql 819 :tickets: 820 821 Added a bind processor for booleans which coerces 822 to int, for DBAPIs such as pymssql that naively call 823 str() on values. 824 825 .. change:: 826 :tags: sql 827 :tickets: 2000 828 829 CheckConstraint will copy its 'initially', 'deferrable', 830 and '_create_rule' attributes within a copy()/tometadata() 831 832 .. change:: 833 :tags: engine 834 :tickets: 835 836 The "unicode warning" against non-unicode bind data 837 is now raised only when the 838 Unicode type is used explicitly; not when 839 convert_unicode=True is used on the engine 840 or String type. 841 842 .. change:: 843 :tags: engine 844 :tickets: 1978 845 846 Fixed memory leak in C version of Decimal result 847 processor. 848 849 .. change:: 850 :tags: engine 851 :tickets: 1871 852 853 Implemented sequence check capability for the C 854 version of RowProxy, as well as 2.7 style 855 "collections.Sequence" registration for RowProxy. 856 857 .. change:: 858 :tags: engine 859 :tickets: 1998 860 861 Threadlocal engine methods rollback(), commit(), 862 prepare() won't raise if no transaction is in progress; 863 this was a regression introduced in 0.6. 864 865 .. change:: 866 :tags: engine 867 :tickets: 2004 868 869 Threadlocal engine returns itself upon begin(), 870 begin_nested(); engine then implements contextmanager 871 methods to allow the "with" statement. 872 873 .. change:: 874 :tags: postgresql 875 :tickets: 1984 876 877 Single element tuple expressions inside an IN clause 878 parenthesize correctly, also from 879 880 .. change:: 881 :tags: postgresql 882 :tickets: 1955 883 884 Ensured every numeric, float, int code, scalar + array, 885 are recognized by psycopg2 and pg8000's "numeric" 886 base type. 887 888 .. change:: 889 :tags: postgresql 890 :tickets: 1956 891 892 Added as_uuid=True flag to the UUID type, will receive 893 and return values as Python UUID() objects rather than 894 strings. Currently, the UUID type is only known to 895 work with psycopg2. 896 897 .. change:: 898 :tags: postgresql 899 :tickets: 1989 900 901 Fixed bug whereby KeyError would occur with non-ENUM 902 supported PG versions after a pool dispose+recreate 903 would occur. 904 905 .. change:: 906 :tags: mysql 907 :tickets: 1960 908 909 Fixed error handling for Jython + zxjdbc, such that 910 has_table() property works again. Regression from 911 0.6.3 (we don't have a Jython buildbot, sorry) 912 913 .. change:: 914 :tags: sqlite 915 :tickets: 1851 916 917 The REFERENCES clause in a CREATE TABLE that includes 918 a remote schema to another table with the same schema 919 name now renders the remote name without 920 the schema clause, as required by SQLite. 921 922 .. change:: 923 :tags: sqlite 924 :tickets: 925 926 On the same theme, the REFERENCES clause in a CREATE TABLE 927 that includes a remote schema to a *different* schema 928 than that of the parent table doesn't render at all, 929 as cross-schema references do not appear to be supported. 930 931 .. change:: 932 :tags: mssql 933 :tickets: 1770 934 935 The rewrite of index reflection in was 936 unfortunately not tested correctly, and returned incorrect 937 results. This regression is now fixed. 938 939 .. change:: 940 :tags: oracle 941 :tickets: 1953 942 943 The cx_oracle "decimal detection" logic, which takes place 944 for result set columns with ambiguous numeric characteristics, 945 now uses the decimal point character determined by the locale/ 946 NLS_LANG setting, using an on-first-connect detection of 947 this character. cx_oracle 5.0.3 or greater is also required 948 when using a non-period-decimal-point NLS_LANG setting.. 949 950 .. change:: 951 :tags: firebird 952 :tickets: 2012 953 954 Firebird numeric type now checks for Decimal explicitly, 955 lets float() pass right through, thereby allowing 956 special values such as float('inf'). 957 958 .. change:: 959 :tags: declarative 960 :tickets: 1972 961 962 An error is raised if __table_args__ is not in tuple 963 or dict format, and is not None. 964 965 .. change:: 966 :tags: sqlsoup 967 :tickets: 1975 968 969 Added "map_to()" method to SqlSoup, which is a "master" 970 method which accepts explicit arguments for each aspect of 971 the selectable and mapping, including a base class per 972 mapping. 973 974 .. change:: 975 :tags: sqlsoup 976 :tickets: 977 978 Mapped selectables used with the map(), with_labels(), 979 join() methods no longer put the given argument into the 980 internal "cache" dictionary. Particularly since the 981 join() and select() objects are created in the method 982 itself this was pretty much a pure memory leaking behavior. 983 984 .. change:: 985 :tags: examples 986 :tickets: 987 988 The versioning example now supports detection of changes 989 in an associated relationship(). 990 991.. changelog:: 992 :version: 0.6.5 993 :released: Sun Oct 24 2010 994 995 .. change:: 996 :tags: orm 997 :tickets: 1914 998 999 Added a new "lazyload" option "immediateload". 1000 Issues the usual "lazy" load operation automatically 1001 as the object is populated. The use case 1002 here is when loading objects to be placed in 1003 an offline cache, or otherwise used after 1004 the session isn't available, and straight 'select' 1005 loading, not 'joined' or 'subquery', is desired. 1006 1007 .. change:: 1008 :tags: orm 1009 :tickets: 1920 1010 1011 New Query methods: query.label(name), query.as_scalar(), 1012 return the query's statement as a scalar subquery 1013 with /without label; 1014 query.with_entities(\*ent), replaces the SELECT list of 1015 the query with new entities. 1016 Roughly equivalent to a generative form of query.values() 1017 which accepts mapped entities as well as column 1018 expressions. 1019 1020 .. change:: 1021 :tags: orm 1022 :tickets: 1023 1024 Fixed recursion bug which could occur when moving 1025 an object from one reference to another, with 1026 backrefs involved, where the initiating parent 1027 was a subclass (with its own mapper) of the 1028 previous parent. 1029 1030 .. change:: 1031 :tags: orm 1032 :tickets: 1918 1033 1034 Fixed a regression in 0.6.4 which occurred if you 1035 passed an empty list to "include_properties" on 1036 mapper() 1037 1038 .. change:: 1039 :tags: orm 1040 :tickets: 1041 1042 Fixed labeling bug in Query whereby the NamedTuple 1043 would mis-apply labels if any of the column 1044 expressions were un-labeled. 1045 1046 .. change:: 1047 :tags: orm 1048 :tickets: 1925 1049 1050 Patched a case where query.join() would adapt the 1051 right side to the right side of the left's join 1052 inappropriately 1053 1054 .. change:: 1055 :tags: orm 1056 :tickets: 1057 1058 Query.select_from() has been beefed up to help 1059 ensure that a subsequent call to query.join() 1060 will use the select_from() entity, assuming it's 1061 a mapped entity and not a plain selectable, 1062 as the default "left" side, not the first entity 1063 in the Query object's list of entities. 1064 1065 .. change:: 1066 :tags: orm 1067 :tickets: 1068 1069 The exception raised by Session when it is used 1070 subsequent to a subtransaction rollback (which is what 1071 happens when a flush fails in autocommit=False mode) has 1072 now been reworded (this is the "inactive due to a 1073 rollback in a subtransaction" message). In particular, 1074 if the rollback was due to an exception during flush(), 1075 the message states this is the case, and reiterates the 1076 string form of the original exception that occurred 1077 during flush. If the session is closed due to explicit 1078 usage of subtransactions (not very common), the message 1079 just states this is the case. 1080 1081 .. change:: 1082 :tags: orm 1083 :tickets: 1084 1085 The exception raised by Mapper when repeated requests to 1086 its initialization are made after initialization already 1087 failed no longer assumes the "hasattr" case, since 1088 there's other scenarios in which this message gets 1089 emitted, and the message also does not compound onto 1090 itself multiple times - you get the same message for 1091 each attempt at usage. The misnomer "compiles" is being 1092 traded out for "initialize". 1093 1094 .. change:: 1095 :tags: orm 1096 :tickets: 1935 1097 1098 Fixed bug in query.update() where 'evaluate' or 'fetch' 1099 expiration would fail if the column expression key was 1100 a class attribute with a different keyname as the 1101 actual column name. 1102 1103 .. change:: 1104 :tags: orm 1105 :tickets: 1106 1107 Added an assertion during flush which ensures 1108 that no NULL-holding identity keys were generated 1109 on "newly persistent" objects. 1110 This can occur when user defined code inadvertently 1111 triggers flushes on not-fully-loaded objects. 1112 1113 .. change:: 1114 :tags: orm 1115 :tickets: 1910 1116 1117 lazy loads for relationship attributes now use 1118 the current state, not the "committed" state, 1119 of foreign and primary key attributes 1120 when issuing SQL, if a flush is not in process. 1121 Previously, only the database-committed state would 1122 be used. In particular, this would cause a many-to-one 1123 get()-on-lazyload operation to fail, as autoflush 1124 is not triggered on these loads when the attributes are 1125 determined and the "committed" state may not be 1126 available. 1127 1128 .. change:: 1129 :tags: orm 1130 :tickets: 1131 1132 A new flag on relationship(), load_on_pending, allows 1133 the lazy loader to fire off on pending objects without a 1134 flush taking place, as well as a transient object that's 1135 been manually "attached" to the session. Note that this 1136 flag blocks attribute events from taking place when an 1137 object is loaded, so backrefs aren't available until 1138 after a flush. The flag is only intended for very 1139 specific use cases. 1140 1141 .. change:: 1142 :tags: orm 1143 :tickets: 1144 1145 Another new flag on relationship(), cascade_backrefs, 1146 disables the "save-update" cascade when the event was 1147 initiated on the "reverse" side of a bidirectional 1148 relationship. This is a cleaner behavior so that 1149 many-to-ones can be set on a transient object without 1150 it getting sucked into the child object's session, 1151 while still allowing the forward collection to 1152 cascade. We *might* default this to False in 0.7. 1153 1154 .. change:: 1155 :tags: orm 1156 :tickets: 1157 1158 Slight improvement to the behavior of 1159 "passive_updates=False" when placed only on the 1160 many-to-one side of a relationship; documentation has 1161 been clarified that passive_updates=False should really 1162 be on the one-to-many side. 1163 1164 .. change:: 1165 :tags: orm 1166 :tickets: 1167 1168 Placing passive_deletes=True on a many-to-one emits 1169 a warning, since you probably intended to put it on 1170 the one-to-many side. 1171 1172 .. change:: 1173 :tags: orm 1174 :tickets: 1175 1176 Fixed bug that would prevent "subqueryload" from 1177 working correctly with single table inheritance 1178 for a relationship from a subclass - the "where 1179 type in (x, y, z)" only gets placed on the inside, 1180 instead of repeatedly. 1181 1182 .. change:: 1183 :tags: orm 1184 :tickets: 1185 1186 When using from_self() with single table inheritance, 1187 the "where type in (x, y, z)" is placed on the outside 1188 of the query only, instead of repeatedly. May make 1189 some more adjustments to this. 1190 1191 .. change:: 1192 :tags: orm 1193 :tickets: 1924 1194 1195 scoped_session emits a warning when configure() is 1196 called if a Session is already present (checks only the 1197 current thread) 1198 1199 .. change:: 1200 :tags: orm 1201 :tickets: 1932 1202 1203 reworked the internals of mapper.cascade_iterator() to 1204 cut down method calls by about 9% in some circumstances. 1205 1206 .. change:: 1207 :tags: sql 1208 :tickets: 1209 1210 Fixed bug in TypeDecorator whereby the dialect-specific 1211 type was getting pulled in to generate the DDL for a 1212 given type, which didn't always return the correct result. 1213 1214 .. change:: 1215 :tags: sql 1216 :tickets: 1217 1218 TypeDecorator can now have a fully constructed type 1219 specified as its "impl", in addition to a type class. 1220 1221 .. change:: 1222 :tags: sql 1223 :tickets: 1224 1225 TypeDecorator will now place itself as the resulting 1226 type for a binary expression where the type coercion 1227 rules would normally return its impl type - previously, 1228 a copy of the impl type would be returned which would 1229 have the TypeDecorator embedded into it as the "dialect" 1230 impl, this was probably an unintentional way of achieving 1231 the desired effect. 1232 1233 .. change:: 1234 :tags: sql 1235 :tickets: 1236 1237 TypeDecorator.load_dialect_impl() returns "self.impl" by 1238 default, i.e. not the dialect implementation type of 1239 "self.impl". This to support compilation correctly. 1240 Behavior can be user-overridden in exactly the same way 1241 as before to the same effect. 1242 1243 .. change:: 1244 :tags: sql 1245 :tickets: 1246 1247 Added type_coerce(expr, type\_) expression element. 1248 Treats the given expression as the given type when evaluating 1249 expressions and processing result rows, but does not 1250 affect the generation of SQL, other than an anonymous 1251 label. 1252 1253 .. change:: 1254 :tags: sql 1255 :tickets: 1256 1257 Table.tometadata() now copies Index objects associated 1258 with the Table as well. 1259 1260 .. change:: 1261 :tags: sql 1262 :tickets: 1263 1264 Table.tometadata() issues a warning if the given Table 1265 is already present in the target MetaData - the existing 1266 Table object is returned. 1267 1268 .. change:: 1269 :tags: sql 1270 :tickets: 1271 1272 An informative error message is raised if a Column 1273 which has not yet been assigned a name, i.e. as in 1274 declarative, is used in a context where it is 1275 exported to the columns collection of an enclosing 1276 select() construct, or if any construct involving 1277 that column is compiled before its name is 1278 assigned. 1279 1280 .. change:: 1281 :tags: sql 1282 :tickets: 1862 1283 1284 as_scalar(), label() can be called on a selectable 1285 which contains a Column that is not yet named. 1286 1287 .. change:: 1288 :tags: sql 1289 :tickets: 1907 1290 1291 Fixed recursion overflow which could occur when operating 1292 with two expressions both of type "NullType", but 1293 not the singleton NULLTYPE instance. 1294 1295 .. change:: 1296 :tags: declarative 1297 :tickets: 1922 1298 1299 @classproperty (soon/now @declared_attr) takes effect for 1300 __mapper_args__, __table_args__, __tablename__ on 1301 a base class that is not a mixin, as well as mixins. 1302 1303 .. change:: 1304 :tags: declarative 1305 :tickets: 1915 1306 1307 @classproperty 's official name/location for usage 1308 with declarative is sqlalchemy.ext.declarative.declared_attr. 1309 Same thing, but moving there since it is more of a 1310 "marker" that's specific to declarative, 1311 not just an attribute technique. 1312 1313 .. change:: 1314 :tags: declarative 1315 :tickets: 1931, 1930 1316 1317 Fixed bug whereby columns on a mixin wouldn't propagate 1318 correctly to a single-table, or joined-table, 1319 inheritance scheme where the attribute name is 1320 different than that of the column.,. 1321 1322 .. change:: 1323 :tags: declarative 1324 :tickets: 1325 1326 A mixin can now specify a column that overrides 1327 a column of the same name associated with a superclass. 1328 Thanks to Oystein Haaland. 1329 1330 .. change:: 1331 :tags: engine 1332 :tickets: 1333 1334 Fixed a regression in 0.6.4 whereby the change that 1335 allowed cursor errors to be raised consistently broke 1336 the result.lastrowid accessor. Test coverage has 1337 been added for result.lastrowid. Note that lastrowid 1338 is only supported by Pysqlite and some MySQL drivers, 1339 so isn't super-useful in the general case. 1340 1341 .. change:: 1342 :tags: engine 1343 :tickets: 1344 1345 the logging message emitted by the engine when 1346 a connection is first used is now "BEGIN (implicit)" 1347 to emphasize that DBAPI has no explicit begin(). 1348 1349 .. change:: 1350 :tags: engine 1351 :tickets: 1936 1352 1353 added "views=True" option to metadata.reflect(), 1354 will add the list of available views to those 1355 being reflected. 1356 1357 .. change:: 1358 :tags: engine 1359 :tickets: 1899 1360 1361 engine_from_config() now accepts 'debug' for 1362 'echo', 'echo_pool', 'force' for 'convert_unicode', 1363 boolean values for 'use_native_unicode'. 1364 1365 .. change:: 1366 :tags: postgresql 1367 :tickets: 1368 1369 Added "as_tuple" flag to ARRAY type, returns results 1370 as tuples instead of lists to allow hashing. 1371 1372 .. change:: 1373 :tags: postgresql 1374 :tickets: 1933 1375 1376 Fixed bug which prevented "domain" built from a 1377 custom type such as "enum" from being reflected. 1378 1379 .. change:: 1380 :tags: mysql 1381 :tickets: 1940 1382 1383 Fixed bug involving reflection of CURRENT_TIMESTAMP 1384 default used with ON UPDATE clause, thanks to 1385 Taavi Burns 1386 1387 .. change:: 1388 :tags: oracle 1389 :tickets: 1878 1390 1391 The implicit_returning argument to create_engine() 1392 is now honored regardless of detected version of 1393 Oracle. Previously, the flag would be forced 1394 to False if server version info was < 10. 1395 1396 .. change:: 1397 :tags: mssql 1398 :tickets: 1946 1399 1400 Fixed reflection bug which did not properly handle 1401 reflection of unknown types. 1402 1403 .. change:: 1404 :tags: mssql 1405 :tickets: 1943 1406 1407 Fixed bug where aliasing of tables with "schema" would 1408 fail to compile properly. 1409 1410 .. change:: 1411 :tags: mssql 1412 :tickets: 1770 1413 1414 Rewrote the reflection of indexes to use sys. 1415 catalogs, so that column names of any configuration 1416 (spaces, embedded commas, etc.) can be reflected. 1417 Note that reflection of indexes requires SQL 1418 Server 2005 or greater. 1419 1420 .. change:: 1421 :tags: mssql 1422 :tickets: 1952 1423 1424 mssql+pymssql dialect now honors the "port" portion 1425 of the URL instead of discarding it. 1426 1427 .. change:: 1428 :tags: informix 1429 :tickets: 1906 1430 1431 *Major* cleanup / modernization of the Informix 1432 dialect for 0.6, courtesy Florian Apolloner. 1433 1434 .. change:: 1435 :tags: tests 1436 :tickets: 1437 1438 the NoseSQLAlchemyPlugin has been moved to a 1439 new package "sqlalchemy_nose" which installs 1440 along with "sqlalchemy". This so that the "nosetests" 1441 script works as always but also allows the 1442 --with-coverage option to turn on coverage before 1443 SQLAlchemy modules are imported, allowing coverage 1444 to work correctly. 1445 1446 .. change:: 1447 :tags: misc 1448 :tickets: 1890 1449 1450 CircularDependencyError now has .cycles and .edges 1451 members, which are the set of elements involved in 1452 one or more cycles, and the set of edges as 2-tuples. 1453 1454.. changelog:: 1455 :version: 0.6.4 1456 :released: Tue Sep 07 2010 1457 1458 .. change:: 1459 :tags: orm 1460 :tickets: 1461 1462 The name ConcurrentModificationError has been 1463 changed to StaleDataError, and descriptive 1464 error messages have been revised to reflect 1465 exactly what the issue is. Both names will 1466 remain available for the foreseeable future 1467 for schemes that may be specifying 1468 ConcurrentModificationError in an "except:" 1469 clause. 1470 1471 .. change:: 1472 :tags: orm 1473 :tickets: 1891 1474 1475 Added a mutex to the identity map which mutexes 1476 remove operations against iteration methods, 1477 which now pre-buffer before returning an 1478 iterable. This because asynchronous gc 1479 can remove items via the gc thread at any time. 1480 1481 .. change:: 1482 :tags: orm 1483 :tickets: 1484 1485 The Session class is now present in sqlalchemy.orm.*. 1486 We're moving away from the usage of create_session(), 1487 which has non-standard defaults, for those situations 1488 where a one-step Session constructor is desired. Most 1489 users should stick with sessionmaker() for general use, 1490 however. 1491 1492 .. change:: 1493 :tags: orm 1494 :tickets: 1495 1496 query.with_parent() now accepts transient objects 1497 and will use the non-persistent values of their pk/fk 1498 attributes in order to formulate the criterion. 1499 Docs are also clarified as to the purpose of with_parent(). 1500 1501 .. change:: 1502 :tags: orm 1503 :tickets: 1504 1505 The include_properties and exclude_properties arguments 1506 to mapper() now accept Column objects as members in 1507 addition to strings. This so that same-named Column 1508 objects, such as those within a join(), can be 1509 disambiguated. 1510 1511 .. change:: 1512 :tags: orm 1513 :tickets: 1896 1514 1515 A warning is now emitted if a mapper is created against a 1516 join or other single selectable that includes multiple 1517 columns with the same name in its .c. collection, 1518 and those columns aren't explicitly named as part of 1519 the same or separate attributes (or excluded). 1520 In 0.7 this warning will be an exception. Note that 1521 this warning is not emitted when the combination occurs 1522 as a result of inheritance, so that attributes 1523 still allow being overridden naturally.. In 0.7 this will be improved further. 1524 1525 .. change:: 1526 :tags: orm 1527 :tickets: 1896 1528 1529 The primary_key argument to mapper() can now specify 1530 a series of columns that are only a subset of 1531 the calculated "primary key" columns of the mapped 1532 selectable, without an error being raised. This 1533 helps for situations where a selectable's effective 1534 primary key is simpler than the number of columns 1535 in the selectable that are actually marked as 1536 "primary_key", such as a join against two 1537 tables on their primary key columns. 1538 1539 .. change:: 1540 :tags: orm 1541 :tickets: 1542 1543 An object that's been deleted now gets a flag 1544 'deleted', which prohibits the object from 1545 being re-add()ed to the session, as previously 1546 the object would live in the identity map 1547 silently until its attributes were accessed. 1548 The make_transient() function now resets this 1549 flag along with the "key" flag. 1550 1551 .. change:: 1552 :tags: orm 1553 :tickets: 1554 1555 make_transient() can be safely called on an 1556 already transient instance. 1557 1558 .. change:: 1559 :tags: orm 1560 :tickets: 1561 1562 a warning is emitted in mapper() if the polymorphic_on 1563 column is not present either in direct or derived 1564 form in the mapped selectable or in the 1565 with_polymorphic selectable, instead of silently 1566 ignoring it. Look for this to become an 1567 exception in 0.7. 1568 1569 .. change:: 1570 :tags: orm 1571 :tickets: 1572 1573 Another pass through the series of error messages 1574 emitted when relationship() is configured with 1575 ambiguous arguments. The "foreign_keys" 1576 setting is no longer mentioned, as it is almost 1577 never needed and it is preferable users set up 1578 correct ForeignKey metadata, which is now the 1579 recommendation. If 'foreign_keys' 1580 is used and is incorrect, the message suggests 1581 the attribute is probably unnecessary. Docs 1582 for the attribute are beefed up. This 1583 because all confused relationship() users on the 1584 ML appear to be attempting to use foreign_keys 1585 due to the message, which only confuses them 1586 further since Table metadata is much clearer. 1587 1588 .. change:: 1589 :tags: orm 1590 :tickets: 1877 1591 1592 If the "secondary" table has no ForeignKey metadata 1593 and no foreign_keys is set, even though the 1594 user is passing screwed up information, it is assumed 1595 that primary/secondaryjoin expressions should 1596 consider only and all cols in "secondary" to be 1597 foreign. It's not possible with "secondary" for 1598 the foreign keys to be elsewhere in any case. 1599 A warning is now emitted instead of an error, 1600 and the mapping succeeds. 1601 1602 .. change:: 1603 :tags: orm 1604 :tickets: 1856 1605 1606 Moving an o2m object from one collection to 1607 another, or vice versa changing the referenced 1608 object by an m2o, where the foreign key is also a 1609 member of the primary key, will now be more 1610 carefully checked during flush if the change in 1611 value of the foreign key on the "many" side is the 1612 result of a change in the primary key of the "one" 1613 side, or if the "one" is just a different object. 1614 In one case, a cascade-capable DB would have 1615 cascaded the value already and we need to look at 1616 the "new" PK value to do an UPDATE, in the other we 1617 need to continue looking at the "old". We now look 1618 at the "old", assuming passive_updates=True, 1619 unless we know it was a PK switch that 1620 triggered the change. 1621 1622 .. change:: 1623 :tags: orm 1624 :tickets: 1857 1625 1626 The value of version_id_col can be changed 1627 manually, and this will result in an UPDATE 1628 of the row. Versioned UPDATEs and DELETEs 1629 now use the "committed" value of the 1630 version_id_col in the WHERE clause and 1631 not the pending changed value. The 1632 version generator is also bypassed if 1633 manual changes are present on the attribute. 1634 1635 .. change:: 1636 :tags: orm 1637 :tickets: 1638 1639 Repaired the usage of merge() when used with 1640 concrete inheriting mappers. Such mappers frequently 1641 have so-called "concrete" attributes, which are 1642 subclass attributes that "disable" propagation from 1643 the parent - these needed to allow a merge() 1644 operation to pass through without effect. 1645 1646 .. change:: 1647 :tags: orm 1648 :tickets: 1863 1649 1650 Specifying a non-column based argument 1651 for column_mapped_collection, including string, 1652 text() etc., will raise an error message that 1653 specifically asks for a column element, no longer 1654 misleads with incorrect information about 1655 text() or literal(). 1656 1657 .. change:: 1658 :tags: orm 1659 :tickets: 1660 1661 Similarly, for relationship(), foreign_keys, 1662 remote_side, order_by - all column-based 1663 expressions are enforced - lists of strings 1664 are explicitly disallowed since this is a 1665 very common error 1666 1667 .. change:: 1668 :tags: orm 1669 :tickets: 1864 1670 1671 Dynamic attributes don't support collection 1672 population - added an assertion for when 1673 set_committed_value() is called, as well as 1674 when joinedload() or subqueryload() options 1675 are applied to a dynamic attribute, instead 1676 of failure / silent failure. 1677 1678 .. change:: 1679 :tags: orm 1680 :tickets: 1852 1681 1682 Fixed bug whereby generating a Query derived 1683 from one which had the same column repeated 1684 with different label names, typically 1685 in some UNION situations, would fail to 1686 propagate the inner columns completely to 1687 the outer query. 1688 1689 .. change:: 1690 :tags: orm 1691 :tickets: 1881 1692 1693 object_session() raises the proper 1694 UnmappedInstanceError when presented with an 1695 unmapped instance. 1696 1697 .. change:: 1698 :tags: orm 1699 :tickets: 1700 1701 Applied further memoizations to calculated Mapper 1702 properties, with significant (~90%) runtime mapper.py 1703 call count reduction in heavily polymorphic mapping 1704 configurations. 1705 1706 .. change:: 1707 :tags: orm 1708 :tickets: 1709 1710 mapper _get_col_to_prop private method used 1711 by the versioning example is deprecated; 1712 now use mapper.get_property_by_column() which 1713 will remain the public method for this. 1714 1715 .. change:: 1716 :tags: orm 1717 :tickets: 1718 1719 the versioning example works correctly now 1720 if versioning on a col that was formerly 1721 NULL. 1722 1723 .. change:: 1724 :tags: sql 1725 :tickets: 1726 1727 Calling execute() on an alias() construct is pending 1728 deprecation for 0.7, as it is not itself an 1729 "executable" construct. It currently "proxies" its 1730 inner element and is conditionally "executable" but 1731 this is not the kind of ambiguity we like these days. 1732 1733 .. change:: 1734 :tags: sql 1735 :tickets: 1736 1737 The execute() and scalar() methods of ClauseElement 1738 are now moved appropriately to the Executable 1739 subclass. ClauseElement.execute()/ scalar() are still 1740 present and are pending deprecation in 0.7, but note 1741 these would always raise an error anyway if you were 1742 not an Executable (unless you were an alias(), see 1743 previous note). 1744 1745 .. change:: 1746 :tags: sql 1747 :tickets: 1748 1749 Added basic math expression coercion for 1750 Numeric->Integer, 1751 so that resulting type is Numeric regardless 1752 of the direction of the expression. 1753 1754 .. change:: 1755 :tags: sql 1756 :tickets: 1855 1757 1758 Changed the scheme used to generate truncated 1759 "auto" index names when using the "index=True" 1760 flag on Column. The truncation only takes 1761 place with the auto-generated name, not one 1762 that is user-defined (an error would be 1763 raised instead), and the truncation scheme 1764 itself is now based on a fragment of an md5 1765 hash of the identifier name, so that multiple 1766 indexes on columns with similar names still 1767 have unique names. 1768 1769 .. change:: 1770 :tags: sql 1771 :tickets: 1412 1772 1773 The generated index name also is based on 1774 a "max index name length" attribute which is 1775 separate from the "max identifier length" - 1776 this to appease MySQL who has a max length 1777 of 64 for index names, separate from their 1778 overall max length of 255. 1779 1780 .. change:: 1781 :tags: sql 1782 :tickets: 1783 1784 the text() construct, if placed in a column 1785 oriented situation, will at least return NULLTYPE 1786 for its type instead of None, allowing it to 1787 be used a little more freely for ad-hoc column 1788 expressions than before. literal_column() 1789 is still the better choice, however. 1790 1791 .. change:: 1792 :tags: sql 1793 :tickets: 1794 1795 Added full description of parent table/column, 1796 target table/column in error message raised when 1797 ForeignKey can't resolve target. 1798 1799 .. change:: 1800 :tags: sql 1801 :tickets: 1865 1802 1803 Fixed bug whereby replacing composite foreign key 1804 columns in a reflected table would cause an attempt 1805 to remove the reflected constraint from the table 1806 a second time, raising a KeyError. 1807 1808 .. change:: 1809 :tags: sql 1810 :tickets: 1811 1812 the _Label construct, i.e. the one that is produced 1813 whenever you say somecol.label(), now counts itself 1814 in its "proxy_set" unioned with that of its 1815 contained column's proxy set, instead of 1816 directly returning that of the contained column. 1817 This allows column correspondence 1818 operations which depend on the identity of the 1819 _Labels themselves to return the correct result 1820 1821 .. change:: 1822 :tags: sql 1823 :tickets: 1852 1824 1825 fixes ORM bug. 1826 1827 .. change:: 1828 :tags: engine 1829 :tickets: 1830 1831 Calling fetchone() or similar on a result that 1832 has already been exhausted, has been closed, 1833 or is not a result-returning result now 1834 raises ResourceClosedError, a subclass of 1835 InvalidRequestError, in all cases, regardless 1836 of backend. Previously, some DBAPIs would 1837 raise ProgrammingError (i.e. pysqlite), others 1838 would return None leading to downstream breakages 1839 (i.e. MySQL-python). 1840 1841 .. change:: 1842 :tags: engine 1843 :tickets: 1894 1844 1845 Fixed bug in Connection whereby if a "disconnect" 1846 event occurred in the "initialize" phase of the 1847 first connection pool connect, an AttributeError 1848 would be raised when the Connection would attempt 1849 to invalidate the DBAPI connection. 1850 1851 .. change:: 1852 :tags: engine 1853 :tickets: 1854 1855 Connection, ResultProxy, as well as Session use 1856 ResourceClosedError for all "this 1857 connection/transaction/result is closed" types of 1858 errors. 1859 1860 .. change:: 1861 :tags: engine 1862 :tickets: 1863 1864 Connection.invalidate() can be called more than 1865 once and subsequent calls do nothing. 1866 1867 .. change:: 1868 :tags: declarative 1869 :tickets: 1870 1871 if @classproperty is used with a regular class-bound 1872 mapper property attribute, it will be called to get the 1873 actual attribute value during initialization. Currently, 1874 there's no advantage to using @classproperty on a column 1875 or relationship attribute of a declarative class that 1876 isn't a mixin - evaluation is at the same time as if 1877 @classproperty weren't used. But here we at least allow 1878 it to function as expected. 1879 1880 .. change:: 1881 :tags: declarative 1882 :tickets: 1883 1884 Fixed bug where "Can't add additional column" message 1885 would display the wrong name. 1886 1887 .. change:: 1888 :tags: postgresql 1889 :tickets: 1890 1891 Fixed the psycopg2 dialect to use its 1892 set_isolation_level() method instead of relying 1893 upon the base "SET SESSION ISOLATION" command, 1894 as psycopg2 resets the isolation level on each new 1895 transaction otherwise. 1896 1897 .. change:: 1898 :tags: mssql 1899 :tickets: 1900 1901 Fixed "default schema" query to work with 1902 pymssql backend. 1903 1904 .. change:: 1905 :tags: firebird 1906 :tickets: 1907 1908 Fixed bug whereby a column default would fail to 1909 reflect if the "default" keyword were lower case. 1910 1911 .. change:: 1912 :tags: oracle 1913 :tickets: 1879 1914 1915 Added ROWID type to the Oracle dialect, for those 1916 cases where an explicit CAST might be needed. 1917 1918 .. change:: 1919 :tags: oracle 1920 :tickets: 1867 1921 1922 Oracle reflection of indexes has been tuned so 1923 that indexes which include some or all primary 1924 key columns, but not the same set of columns 1925 as that of the primary key, are reflected. 1926 Indexes which contain the identical columns 1927 as that of the primary key are skipped within 1928 reflection, as the index in that case is assumed 1929 to be the auto-generated primary key index. 1930 Previously, any index with PK columns present 1931 would be skipped. Thanks to Kent Bower 1932 for the patch. 1933 1934 .. change:: 1935 :tags: oracle 1936 :tickets: 1868 1937 1938 Oracle now reflects the names of primary key 1939 constraints - also thanks to Kent Bower. 1940 1941 .. change:: 1942 :tags: informix 1943 :tickets: 1904 1944 1945 Applied patches from to get 1946 basic Informix functionality up again. We 1947 rely upon end-user testing to ensure that 1948 Informix is working to some degree. 1949 1950 .. change:: 1951 :tags: documentation 1952 :tickets: 1953 1954 The docs have been reorganized such that the "API 1955 Reference" section is gone - all the docstrings from 1956 there which were public API are moved into the 1957 context of the main doc section that talks about it. 1958 Main docs divided into "SQLAlchemy Core" and 1959 "SQLAlchemy ORM" sections, mapper/relationship docs 1960 have been broken out. Lots of sections rewritten 1961 and/or reorganized. 1962 1963 .. change:: 1964 :tags: examples 1965 :tickets: 1966 1967 The beaker_caching example has been reorganized 1968 such that the Session, cache manager, 1969 declarative_base are part of environment, and 1970 custom cache code is portable and now within 1971 "caching_query.py". This allows the example to 1972 be easier to "drop in" to existing projects. 1973 1974 .. change:: 1975 :tags: examples 1976 :tickets: 1887 1977 1978 the history_meta versioning recipe sets "unique=False" 1979 when copying columns, so that the versioning 1980 table handles multiple rows with repeating values. 1981 1982.. changelog:: 1983 :version: 0.6.3 1984 :released: Thu Jul 15 2010 1985 1986 .. change:: 1987 :tags: orm 1988 :tickets: 1845 1989 1990 Removed errant many-to-many load in unitofwork 1991 which triggered unnecessarily on expired/unloaded 1992 collections. This load now takes place only if 1993 passive_updates is False and the parent primary 1994 key has changed, or if passive_deletes is False 1995 and a delete of the parent has occurred. 1996 1997 .. change:: 1998 :tags: orm 1999 :tickets: 1853 2000 2001 Column-entities (i.e. query(Foo.id)) copy their 2002 state more fully when queries are derived from 2003 themselves + a selectable (i.e. from_self(), 2004 union(), etc.), so that join() and such have the 2005 correct state to work from. 2006 2007 .. change:: 2008 :tags: orm 2009 :tickets: 1853 2010 2011 Fixed bug where Query.join() would fail if 2012 querying a non-ORM column then joining without 2013 an on clause when a FROM clause is already 2014 present, now raises a checked exception the 2015 same way it does when the clause is not 2016 present. 2017 2018 .. change:: 2019 :tags: orm 2020 :tickets: 1142 2021 2022 Improved the check for an "unmapped class", 2023 including the case where the superclass is mapped 2024 but the subclass is not. Any attempts to access 2025 cls._sa_class_manager.mapper now raise 2026 UnmappedClassError(). 2027 2028 .. change:: 2029 :tags: orm 2030 :tickets: 2031 2032 Added "column_descriptions" accessor to Query, 2033 returns a list of dictionaries containing 2034 naming/typing information about the entities 2035 the Query will return. Can be helpful for 2036 building GUIs on top of ORM queries. 2037 2038 .. change:: 2039 :tags: mysql 2040 :tickets: 1848 2041 2042 The _extract_error_code() method now works 2043 correctly with each MySQL dialect ( 2044 MySQL-python, OurSQL, MySQL-Connector-Python, 2045 PyODBC). Previously, 2046 the reconnect logic would fail for OperationalError 2047 conditions, however since MySQLdb and OurSQL 2048 have their own reconnect feature, there was no 2049 symptom for these drivers here unless one 2050 watched the logs. 2051 2052 .. change:: 2053 :tags: oracle 2054 :tickets: 1840 2055 2056 More tweaks to cx_oracle Decimal handling. 2057 "Ambiguous" numerics with no decimal place 2058 are coerced to int at the connection handler 2059 level. The advantage here is that ints 2060 come back as ints without SQLA type 2061 objects being involved and without needless 2062 conversion to Decimal first. 2063 2064 Unfortunately, some exotic subquery cases 2065 can even see different types between 2066 individual result rows, so the Numeric 2067 handler, when instructed to return Decimal, 2068 can't take full advantage of "native decimal" 2069 mode and must run isinstance() on every value 2070 to check if its Decimal already. Reopen of 2071 2072.. changelog:: 2073 :version: 0.6.2 2074 :released: Tue Jul 06 2010 2075 2076 .. change:: 2077 :tags: orm 2078 :tickets: 2079 2080 Query.join() will check for a call of the 2081 form query.join(target, clause_expression), 2082 i.e. missing the tuple, and raise an informative 2083 error message that this is the wrong calling form. 2084 2085 .. change:: 2086 :tags: orm 2087 :tickets: 1824 2088 2089 Fixed bug regarding flushes on self-referential 2090 bi-directional many-to-many relationships, where 2091 two objects made to mutually reference each other 2092 in one flush would fail to insert a row for both 2093 sides. Regression from 0.5. 2094 2095 .. change:: 2096 :tags: orm 2097 :tickets: 2098 2099 the post_update feature of relationship() has been 2100 reworked architecturally to integrate more closely 2101 with the new 0.6 unit of work. The motivation 2102 for the change is so that multiple "post update" 2103 calls, each affecting different foreign key 2104 columns of the same row, are executed in a single 2105 UPDATE statement, rather than one UPDATE 2106 statement per column per row. Multiple row 2107 updates are also batched into executemany()s as 2108 possible, while maintaining consistent row ordering. 2109 2110 .. change:: 2111 :tags: orm 2112 :tickets: 2113 2114 Query.statement, Query.subquery(), etc. now transfer 2115 the values of bind parameters, i.e. those specified 2116 by query.params(), into the resulting SQL expression. 2117 Previously the values would not be transferred 2118 and bind parameters would come out as None. 2119 2120 .. change:: 2121 :tags: orm 2122 :tickets: 2123 2124 Subquery-eager-loading now works with Query objects 2125 which include params(), as well as get() Queries. 2126 2127 .. change:: 2128 :tags: orm 2129 :tickets: 2130 2131 Can now call make_transient() on an instance that 2132 is referenced by parent objects via many-to-one, 2133 without the parent's foreign key value getting 2134 temporarily set to None - this was a function 2135 of the "detect primary key switch" flush handler. 2136 It now ignores objects that are no longer 2137 in the "persistent" state, and the parent's 2138 foreign key identifier is left unaffected. 2139 2140 .. change:: 2141 :tags: orm 2142 :tickets: 2143 2144 query.order_by() now accepts False, which cancels 2145 any existing order_by() state on the Query, allowing 2146 subsequent generative methods to be called which do 2147 not support ORDER BY. This is not the same as the 2148 already existing feature of passing None, which 2149 suppresses any existing order_by() settings, including 2150 those configured on the mapper. False will make it 2151 as though order_by() was never called, while 2152 None is an active setting. 2153 2154 .. change:: 2155 :tags: orm 2156 :tickets: 2157 2158 An instance which is moved to "transient", has 2159 an incomplete or missing set of primary key 2160 attributes, and contains expired attributes, will 2161 raise an InvalidRequestError if an expired attribute 2162 is accessed, instead of getting a recursion overflow. 2163 2164 .. change:: 2165 :tags: orm 2166 :tickets: 2167 2168 The make_transient() function is now in the generated 2169 documentation. 2170 2171 .. change:: 2172 :tags: orm 2173 :tickets: 2174 2175 make_transient() removes all "loader" callables from 2176 the state being made transient, removing any 2177 "expired" state - all unloaded attributes reset back 2178 to undefined, None/empty on access. 2179 2180 .. change:: 2181 :tags: sql 2182 :tickets: 1822 2183 2184 The warning emitted by the Unicode and String types 2185 with convert_unicode=True no longer embeds the actual 2186 value passed. This so that the Python warning 2187 registry does not continue to grow in size, the warning 2188 is emitted once as per the warning filter settings, 2189 and large string values don't pollute the output. 2190 2191 .. change:: 2192 :tags: sql 2193 :tickets: 2194 2195 Fixed bug that would prevent overridden clause 2196 compilation from working for "annotated" expression 2197 elements, which are often generated by the ORM. 2198 2199 .. change:: 2200 :tags: sql 2201 :tickets: 1400 2202 2203 The argument to "ESCAPE" of a LIKE operator or similar 2204 is passed through render_literal_value(), which may 2205 implement escaping of backslashes. 2206 2207 .. change:: 2208 :tags: sql 2209 :tickets: 2210 2211 Fixed bug in Enum type which blew away native_enum 2212 flag when used with TypeDecorators or other adaption 2213 scenarios. 2214 2215 .. change:: 2216 :tags: sql 2217 :tickets: 2218 2219 Inspector hits bind.connect() when invoked to ensure 2220 initialize has been called. the internal name ".conn" 2221 is changed to ".bind", since that's what it is. 2222 2223 .. change:: 2224 :tags: sql 2225 :tickets: 2226 2227 Modified the internals of "column annotation" such that 2228 a custom Column subclass can safely override 2229 _constructor to return Column, for the purposes of 2230 making "configurational" column classes that aren't 2231 involved in proxying, etc. 2232 2233 .. change:: 2234 :tags: sql 2235 :tickets: 1829 2236 2237 Column.copy() takes along the "unique" attribute 2238 among others, fixes regarding declarative 2239 mixins 2240 2241 .. change:: 2242 :tags: postgresql 2243 :tickets: 1400 2244 2245 render_literal_value() is overridden which escapes 2246 backslashes, currently applies to the ESCAPE clause 2247 of LIKE and similar expressions. 2248 Ultimately this will have to detect the value of 2249 "standard_conforming_strings" for full behavior. 2250 2251 .. change:: 2252 :tags: postgresql 2253 :tickets: 1836 2254 2255 Won't generate "CREATE TYPE" / "DROP TYPE" if 2256 using types.Enum on a PG version prior to 8.3 - 2257 the supports_native_enum flag is fully 2258 honored. 2259 2260 .. change:: 2261 :tags: mysql 2262 :tickets: 1826 2263 2264 MySQL dialect doesn't emit CAST() for MySQL version 2265 detected < 4.0.2. This allows the unicode 2266 check on connect to proceed. 2267 2268 .. change:: 2269 :tags: mysql 2270 :tickets: 2271 2272 MySQL dialect now detects NO_BACKSLASH_ESCAPES sql 2273 mode, in addition to ANSI_QUOTES. 2274 2275 .. change:: 2276 :tags: mysql 2277 :tickets: 1400 2278 2279 render_literal_value() is overridden which escapes 2280 backslashes, currently applies to the ESCAPE clause 2281 of LIKE and similar expressions. This behavior 2282 is derived from detecting the value of 2283 NO_BACKSLASH_ESCAPES. 2284 2285 .. change:: 2286 :tags: oracle 2287 :tickets: 1819 2288 2289 Fixed ora-8 compatibility flags such that they 2290 don't cache a stale value from before the first 2291 database connection actually occurs. 2292 2293 .. change:: 2294 :tags: oracle 2295 :tickets: 1840 2296 2297 Oracle's "native decimal" metadata begins to return 2298 ambiguous typing information about numerics 2299 when columns are embedded in subqueries as well 2300 as when ROWNUM is consulted with subqueries, as we 2301 do for limit/offset. We've added these ambiguous 2302 conditions to the cx_oracle "convert to Decimal()" 2303 handler, so that we receive numerics as Decimal 2304 in more cases instead of as floats. These are 2305 then converted, if requested, into Integer 2306 or Float, or otherwise kept as the lossless 2307 Decimal. 2308 2309 .. change:: 2310 :tags: mssql 2311 :tickets: 1825 2312 2313 If server_version_info is outside the usual 2314 range of (8, ), (9, ), (10, ), a warning is emitted 2315 which suggests checking that the FreeTDS version 2316 configuration is using 7.0 or 8.0, not 4.2. 2317 2318 .. change:: 2319 :tags: firebird 2320 :tickets: 1823 2321 2322 Fixed incorrect signature in do_execute(), error 2323 introduced in 0.6.1. 2324 2325 .. change:: 2326 :tags: firebird 2327 :tickets: 1813 2328 2329 Firebird dialect adds CHAR, VARCHAR types which 2330 accept a "charset" flag, to support Firebird 2331 "CHARACTER SET" clause. 2332 2333 .. change:: 2334 :tags: declarative 2335 :tickets: 1805, 1796, 1751 2336 2337 Added support for @classproperty to provide 2338 any kind of schema/mapping construct from a 2339 declarative mixin, including columns with foreign 2340 keys, relationships, column_property, deferred. 2341 This solves all such issues on declarative mixins. 2342 An error is raised if any MapperProperty subclass 2343 is specified on a mixin without using @classproperty. 2344 2345 .. change:: 2346 :tags: declarative 2347 :tickets: 1821 2348 2349 a mixin class can now define a column that matches 2350 one which is present on a __table__ defined on a 2351 subclass. It cannot, however, define one that is 2352 not present in the __table__, and the error message 2353 here now works. 2354 2355 .. change:: 2356 :tags: extension, compiler 2357 :tickets: 1838 2358 2359 The 'default' compiler is automatically copied over 2360 when overriding the compilation of a built in 2361 clause construct, so no KeyError is raised if the 2362 user-defined compiler is specific to certain 2363 backends and compilation for a different backend 2364 is invoked. 2365 2366 .. change:: 2367 :tags: documentation 2368 :tickets: 1820 2369 2370 Added documentation for the Inspector. 2371 2372 .. change:: 2373 :tags: documentation 2374 :tickets: 1830 2375 2376 Fixed @memoized_property and @memoized_instancemethod 2377 decorators so that Sphinx documentation picks up 2378 these attributes and methods, such as 2379 ResultProxy.inserted_primary_key. 2380 2381.. changelog:: 2382 :version: 0.6.1 2383 :released: Mon May 31 2010 2384 2385 .. change:: 2386 :tags: orm 2387 :tickets: 1782 2388 2389 Fixed regression introduced in 0.6.0 involving improper 2390 history accounting on mutable attributes. 2391 2392 .. change:: 2393 :tags: orm 2394 :tickets: 1807 2395 2396 Fixed regression introduced in 0.6.0 unit of work refactor 2397 that broke updates for bi-directional relationship() 2398 with post_update=True. 2399 2400 .. change:: 2401 :tags: orm 2402 :tickets: 1789 2403 2404 session.merge() will not expire attributes on the returned 2405 instance if that instance is "pending". 2406 2407 .. change:: 2408 :tags: orm 2409 :tickets: 1802 2410 2411 fixed __setstate__ method of CollectionAdapter to not 2412 fail during deserialize where parent InstanceState not 2413 yet unserialized. 2414 2415 .. change:: 2416 :tags: orm 2417 :tickets: 1797 2418 2419 Added internal warning in case an instance without a 2420 full PK happened to be expired and then was asked 2421 to refresh. 2422 2423 .. change:: 2424 :tags: orm 2425 :tickets: 2426 2427 Added more aggressive caching to the mapper's usage of 2428 UPDATE, INSERT, and DELETE expressions. Assuming the 2429 statement has no per-object SQL expressions attached, 2430 the expression objects are cached by the mapper after 2431 the first create, and their compiled form is stored 2432 persistently in a cache dictionary for the duration of 2433 the related Engine. The cache is an LRUCache for the 2434 rare case that a mapper receives an extremely 2435 high number of different column patterns as UPDATEs. 2436 2437 .. change:: 2438 :tags: sql 2439 :tickets: 1793 2440 2441 expr.in_() now accepts a text() construct as the argument. 2442 Grouping parenthesis are added automatically, i.e. usage 2443 is like `col.in_(text("select id from table"))`. 2444 2445 .. change:: 2446 :tags: sql 2447 :tickets: 2448 2449 Columns of _Binary type (i.e. LargeBinary, BLOB, etc.) 2450 will coerce a "basestring" on the right side into a 2451 _Binary as well so that required DBAPI processing 2452 takes place. 2453 2454 .. change:: 2455 :tags: sql 2456 :tickets: 1801 2457 2458 Added table.add_is_dependent_on(othertable), allows manual 2459 placement of dependency rules between two Table objects 2460 for use within create_all(), drop_all(), sorted_tables. 2461 2462 .. change:: 2463 :tags: sql 2464 :tickets: 1778 2465 2466 Fixed bug that prevented implicit RETURNING from functioning 2467 properly with composite primary key that contained zeroes. 2468 2469 .. change:: 2470 :tags: sql 2471 :tickets: 2472 2473 Fixed errant space character when generating ADD CONSTRAINT 2474 for a named UNIQUE constraint. 2475 2476 .. change:: 2477 :tags: sql 2478 :tickets: 1571 2479 2480 Fixed "table" argument on constructor of ForeignKeyConstraint 2481 2482 .. change:: 2483 :tags: sql 2484 :tickets: 1786 2485 2486 Fixed bug in connection pool cursor wrapper whereby if a 2487 cursor threw an exception on close(), the logging of the 2488 message would fail. 2489 2490 .. change:: 2491 :tags: sql 2492 :tickets: 2493 2494 the _make_proxy() method of ColumnClause and Column now use 2495 self.__class__ to determine the class of object to be returned 2496 instead of hardcoding to ColumnClause/Column, making it slightly 2497 easier to produce specific subclasses of these which work in 2498 alias/subquery situations. 2499 2500 .. change:: 2501 :tags: sql 2502 :tickets: 1798 2503 2504 func.XXX() doesn't inadvertently resolve to non-Function 2505 classes (e.g. fixes func.text()). 2506 2507 .. change:: 2508 :tags: engines 2509 :tickets: 1781 2510 2511 Fixed building the C extensions on Python 2.4. 2512 2513 .. change:: 2514 :tags: engines 2515 :tickets: 2516 2517 Pool classes will reuse the same "pool_logging_name" setting 2518 after a dispose() occurs. 2519 2520 .. change:: 2521 :tags: engines 2522 :tickets: 2523 2524 Engine gains an "execution_options" argument and 2525 update_execution_options() method, which will apply to 2526 all connections generated by this engine. 2527 2528 .. change:: 2529 :tags: mysql 2530 :tickets: 1794 2531 2532 func.sysdate() emits "SYSDATE()", i.e. with the ending 2533 parenthesis, on MySQL. 2534 2535 .. change:: 2536 :tags: sqlite 2537 :tickets: 1812 2538 2539 Fixed concatenation of constraints when "PRIMARY KEY" 2540 constraint gets moved to column level due to SQLite 2541 AUTOINCREMENT keyword being rendered. 2542 2543 .. change:: 2544 :tags: oracle 2545 :tickets: 1775 2546 2547 Added a check for cx_oracle versions lower than version 5, 2548 in which case the incompatible "output type handler" won't 2549 be used. This will impact decimal accuracy and some 2550 unicode handling issues. 2551 2552 .. change:: 2553 :tags: oracle 2554 :tickets: 1790 2555 2556 Fixed use_ansi=False mode, which was producing broken 2557 WHERE clauses in pretty much all cases. 2558 2559 .. change:: 2560 :tags: oracle 2561 :tickets: 1808 2562 2563 Re-established support for Oracle 8 with cx_oracle, 2564 including that use_ansi is set to False automatically, 2565 NVARCHAR2 and NCLOB are not rendered for Unicode, 2566 "native unicode" check doesn't fail, cx_oracle 2567 "native unicode" mode is disabled, VARCHAR() is emitted 2568 with bytes count instead of char count. 2569 2570 .. change:: 2571 :tags: oracle 2572 :tickets: 1670 2573 2574 oracle_xe 5 doesn't accept a Python unicode object in 2575 its connect string in normal Python 2.x mode - so we coerce 2576 to str() directly. non-ascii characters aren't supported 2577 in connect strings here since we don't know what encoding 2578 we could use. 2579 2580 .. change:: 2581 :tags: oracle 2582 :tickets: 1815 2583 2584 FOR UPDATE is emitted in the syntactically correct position 2585 when limit/offset is used, i.e. the ROWNUM subquery. 2586 However, Oracle can't really handle FOR UPDATE with ORDER BY 2587 or with subqueries, so its still not very usable, but at 2588 least SQLA gets the SQL past the Oracle parser. 2589 2590 .. change:: 2591 :tags: firebird 2592 :tickets: 1521 2593 2594 Added a label to the query used within has_table() and 2595 has_sequence() to work with older versions of Firebird 2596 that don't provide labels for result columns. 2597 2598 .. change:: 2599 :tags: firebird 2600 :tickets: 1779 2601 2602 Added integer coercion to the "type_conv" attribute when 2603 passed via query string, so that it is properly interpreted 2604 by Kinterbasdb. 2605 2606 .. change:: 2607 :tags: firebird 2608 :tickets: 1646 2609 2610 Added 'connection shutdown' to the list of exception strings 2611 which indicate a dropped connection. 2612 2613 .. change:: 2614 :tags: sqlsoup 2615 :tickets: 1783 2616 2617 the SqlSoup constructor accepts a `base` argument which specifies 2618 the base class to use for mapped classes, the default being 2619 `object`. 2620 2621.. changelog:: 2622 :version: 0.6.0 2623 :released: Sun Apr 18 2010 2624 2625 .. change:: 2626 :tags: orm 2627 :tickets: 1742, 1081 2628 2629 Unit of work internals have been rewritten. Units of work 2630 with large numbers of objects interdependent objects 2631 can now be flushed without recursion overflows 2632 as there is no longer reliance upon recursive calls. The number of internal structures now stays 2633 constant for a particular session state, regardless of 2634 how many relationships are present on mappings. The flow 2635 of events now corresponds to a linear list of steps, 2636 generated by the mappers and relationships based on actual 2637 work to be done, filtered through a single topological sort 2638 for correct ordering. Flush actions are assembled using 2639 far fewer steps and less memory. 2640 2641 .. change:: 2642 :tags: orm 2643 :tickets: 2644 2645 Along with the UOW rewrite, this also removes an issue 2646 introduced in 0.6beta3 regarding topological cycle detection 2647 for units of work with long dependency cycles. We now use 2648 an algorithm written by Guido (thanks Guido!). 2649 2650 .. change:: 2651 :tags: orm 2652 :tickets: 1764 2653 2654 one-to-many relationships now maintain a list of positive 2655 parent-child associations within the flush, preventing 2656 previous parents marked as deleted from cascading a 2657 delete or NULL foreign key set on those child objects, 2658 despite the end-user not removing the child from the old 2659 association. 2660 2661 .. change:: 2662 :tags: orm 2663 :tickets: 1495 2664 2665 A collection lazy load will switch off default 2666 eagerloading on the reverse many-to-one side, since 2667 that loading is by definition unnecessary. 2668 2669 .. change:: 2670 :tags: orm 2671 :tickets: 2672 2673 Session.refresh() now does an equivalent expire() 2674 on the given instance first, so that the "refresh-expire" 2675 cascade is propagated. Previously, refresh() was 2676 not affected in any way by the presence of "refresh-expire" 2677 cascade. This is a change in behavior versus that 2678 of 0.6beta2, where the "lockmode" flag passed to refresh() 2679 would cause a version check to occur. Since the instance 2680 is first expired, refresh() always upgrades the object 2681 to the most recent version. 2682 2683 .. change:: 2684 :tags: orm 2685 :tickets: 1754 2686 2687 The 'refresh-expire' cascade, when reaching a pending object, 2688 will expunge the object if the cascade also includes 2689 "delete-orphan", or will simply detach it otherwise. 2690 2691 .. change:: 2692 :tags: orm 2693 :tickets: 1756 2694 2695 id(obj) is no longer used internally within topological.py, 2696 as the sorting functions now require hashable objects 2697 only. 2698 2699 .. change:: 2700 :tags: orm 2701 :tickets: 2702 2703 The ORM will set the docstring of all generated descriptors 2704 to None by default. This can be overridden using 'doc' 2705 (or if using Sphinx, attribute docstrings work too). 2706 2707 .. change:: 2708 :tags: orm 2709 :tickets: 2710 2711 Added kw argument 'doc' to all mapper property callables 2712 as well as Column(). Will assemble the string 'doc' as 2713 the '__doc__' attribute on the descriptor. 2714 2715 .. change:: 2716 :tags: orm 2717 :tickets: 1761 2718 2719 Usage of version_id_col on a backend that supports 2720 cursor.rowcount for execute() but not executemany() now works 2721 when a delete is issued (already worked for saves, since those 2722 don't use executemany()). For a backend that doesn't support 2723 cursor.rowcount at all, a warning is emitted the same 2724 as with saves. 2725 2726 .. change:: 2727 :tags: orm 2728 :tickets: 2729 2730 The ORM now short-term caches the "compiled" form of 2731 insert() and update() constructs when flushing lists of 2732 objects of all the same class, thereby avoiding redundant 2733 compilation per individual INSERT/UPDATE within an 2734 individual flush() call. 2735 2736 .. change:: 2737 :tags: orm 2738 :tickets: 2739 2740 internal getattr(), setattr(), getcommitted() methods 2741 on ColumnProperty, CompositeProperty, RelationshipProperty 2742 have been underscored (i.e. are private), signature has 2743 changed. 2744 2745 .. change:: 2746 :tags: engines 2747 :tickets: 1757 2748 2749 The C extension now also works with DBAPIs which use custom 2750 sequences as row (and not only tuples). 2751 2752 .. change:: 2753 :tags: sql 2754 :tickets: 1755 2755 2756 Restored some bind-labeling logic from 0.5 which ensures 2757 that tables with column names that overlap another column 2758 of the form "<tablename>_<columnname>" won't produce 2759 errors if column._label is used as a bind name during 2760 an UPDATE. Test coverage which wasn't present in 0.5 2761 has been added. 2762 2763 .. change:: 2764 :tags: sql 2765 :tickets: 1729 2766 2767 somejoin.select(fold_equivalents=True) is no longer 2768 deprecated, and will eventually be rolled into a more 2769 comprehensive version of the feature for. 2770 2771 .. change:: 2772 :tags: sql 2773 :tickets: 1759 2774 2775 the Numeric type raises an *enormous* warning when expected 2776 to convert floats to Decimal from a DBAPI that returns floats. 2777 This includes SQLite, Sybase, MS-SQL. 2778 2779 .. change:: 2780 :tags: sql 2781 :tickets: 2782 2783 Fixed an error in expression typing which caused an endless 2784 loop for expressions with two NULL types. 2785 2786 .. change:: 2787 :tags: sql 2788 :tickets: 2789 2790 Fixed bug in execution_options() feature whereby the existing 2791 Transaction and other state information from the parent 2792 connection would not be propagated to the sub-connection. 2793 2794 .. change:: 2795 :tags: sql 2796 :tickets: 2797 2798 Added new 'compiled_cache' execution option. A dictionary 2799 where Compiled objects will be cached when the Connection 2800 compiles a clause expression into a dialect- and parameter- 2801 specific Compiled object. It is the user's responsibility to 2802 manage the size of this dictionary, which will have keys 2803 corresponding to the dialect, clause element, the column 2804 names within the VALUES or SET clause of an INSERT or UPDATE, 2805 as well as the "batch" mode for an INSERT or UPDATE statement. 2806 2807 .. change:: 2808 :tags: sql 2809 :tickets: 1769 2810 2811 Added get_pk_constraint() to reflection.Inspector, similar 2812 to get_primary_keys() except returns a dict that includes the 2813 name of the constraint, for supported backends (PG so far). 2814 2815 .. change:: 2816 :tags: sql 2817 :tickets: 1771 2818 2819 Table.create() and Table.drop() no longer apply metadata- 2820 level create/drop events. 2821 2822 .. change:: 2823 :tags: ext 2824 :tickets: 2825 2826 the compiler extension now allows @compiles decorators 2827 on base classes that extend to child classes, @compiles 2828 decorators on child classes that aren't broken by a 2829 @compiles decorator on the base class. 2830 2831 .. change:: 2832 :tags: ext 2833 :tickets: 2834 2835 Declarative will raise an informative error message 2836 if a non-mapped class attribute is referenced in the 2837 string-based relationship() arguments. 2838 2839 .. change:: 2840 :tags: ext 2841 :tickets: 2842 2843 Further reworked the "mixin" logic in declarative to 2844 additionally allow __mapper_args__ as a @classproperty 2845 on a mixin, such as to dynamically assign polymorphic_identity. 2846 2847 .. change:: 2848 :tags: postgresql 2849 :tickets: 1071 2850 2851 PostgreSQL now reflects sequence names associated with 2852 SERIAL columns correctly, after the name of the sequence 2853 has been changed. Thanks to Kumar McMillan for the patch. 2854 2855 .. change:: 2856 :tags: postgresql 2857 :tickets: 2858 2859 Repaired missing import in psycopg2._PGNumeric type when 2860 unknown numeric is received. 2861 2862 .. change:: 2863 :tags: postgresql 2864 :tickets: 2865 2866 psycopg2/pg8000 dialects now aware of REAL[], FLOAT[], 2867 DOUBLE_PRECISION[], NUMERIC[] return types without 2868 raising an exception. 2869 2870 .. change:: 2871 :tags: postgresql 2872 :tickets: 1769 2873 2874 PostgreSQL reflects the name of primary key constraints, 2875 if one exists. 2876 2877 .. change:: 2878 :tags: oracle 2879 :tickets: 2880 2881 Now using cx_oracle output converters so that the 2882 DBAPI returns natively the kinds of values we prefer: 2883 2884 .. change:: 2885 :tags: oracle 2886 :tickets: 1759 2887 2888 NUMBER values with positive precision + scale convert 2889 to cx_oracle.STRING and then to Decimal. This 2890 allows perfect precision for the Numeric type when 2891 using cx_oracle. 2892 2893 .. change:: 2894 :tags: oracle 2895 :tickets: 2896 2897 STRING/FIXED_CHAR now convert to unicode natively. 2898 SQLAlchemy's String types then don't need to 2899 apply any kind of conversions. 2900 2901 .. change:: 2902 :tags: firebird 2903 :tickets: 2904 2905 The functionality of result.rowcount can be disabled on a 2906 per-engine basis by setting 'enable_rowcount=False' 2907 on create_engine(). Normally, cursor.rowcount is called 2908 after any UPDATE or DELETE statement unconditionally, 2909 because the cursor is then closed and Firebird requires 2910 an open cursor in order to get a rowcount. This 2911 call is slightly expensive however so it can be disabled. 2912 To re-enable on a per-execution basis, the 2913 'enable_rowcount=True' execution option may be used. 2914 2915 .. change:: 2916 :tags: examples 2917 :tickets: 2918 2919 Updated attribute_shard.py example to use a more robust 2920 method of searching a Query for binary expressions which 2921 compare columns against literal values. 2922 2923.. changelog:: 2924 :version: 0.6beta3 2925 :released: Sun Mar 28 2010 2926 2927 .. change:: 2928 :tags: orm 2929 :tickets: 1675 2930 2931 Major feature: Added new "subquery" loading capability to 2932 relationship(). This is an eager loading option which 2933 generates a second SELECT for each collection represented 2934 in a query, across all parents at once. The query 2935 re-issues the original end-user query wrapped in a subquery, 2936 applies joins out to the target collection, and loads 2937 all those collections fully in one result, similar to 2938 "joined" eager loading but using all inner joins and not 2939 re-fetching full parent rows repeatedly (as most DBAPIs seem 2940 to do, even if columns are skipped). Subquery loading is 2941 available at mapper config level using "lazy='subquery'" and 2942 at the query options level using "subqueryload(props..)", 2943 "subqueryload_all(props...)". 2944 2945 .. change:: 2946 :tags: orm 2947 :tickets: 2948 2949 To accommodate the fact that there are now two kinds of eager 2950 loading available, the new names for eagerload() and 2951 eagerload_all() are joinedload() and joinedload_all(). The 2952 old names will remain as synonyms for the foreseeable future. 2953 2954 .. change:: 2955 :tags: orm 2956 :tickets: 2957 2958 The "lazy" flag on the relationship() function now accepts 2959 a string argument for all kinds of loading: "select", "joined", 2960 "subquery", "noload" and "dynamic", where the default is now 2961 "select". The old values of True/ 2962 False/None still retain their usual meanings and will remain 2963 as synonyms for the foreseeable future. 2964 2965 .. change:: 2966 :tags: orm 2967 :tickets: 921 2968 2969 Added with_hint() method to Query() construct. This calls 2970 directly down to select().with_hint() and also accepts 2971 entities as well as tables and aliases. See with_hint() in the 2972 SQL section below. 2973 2974 .. change:: 2975 :tags: orm 2976 :tickets: 2977 2978 Fixed bug in Query whereby calling q.join(prop).from_self(...). 2979 join(prop) would fail to render the second join outside the 2980 subquery, when joining on the same criterion as was on the 2981 inside. 2982 2983 .. change:: 2984 :tags: orm 2985 :tickets: 2986 2987 Fixed bug in Query whereby the usage of aliased() constructs 2988 would fail if the underlying table (but not the actual alias) 2989 were referenced inside the subquery generated by 2990 q.from_self() or q.select_from(). 2991 2992 .. change:: 2993 :tags: orm 2994 :tickets: 2995 2996 Fixed bug which affected all eagerload() and similar options 2997 such that "remote" eager loads, i.e. eagerloads off of a lazy 2998 load such as query(A).options(eagerload(A.b, B.c)) 2999 wouldn't eagerload anything, but using eagerload("b.c") would 3000 work fine. 3001 3002 .. change:: 3003 :tags: orm 3004 :tickets: 3005 3006 Query gains an add_columns(\*columns) method which is a multi- 3007 version of add_column(col). add_column(col) is future 3008 deprecated. 3009 3010 .. change:: 3011 :tags: orm 3012 :tickets: 3013 3014 Query.join() will detect if the end result will be 3015 "FROM A JOIN A", and will raise an error if so. 3016 3017 .. change:: 3018 :tags: orm 3019 :tickets: 3020 3021 Query.join(Cls.propname, from_joinpoint=True) will check more 3022 carefully that "Cls" is compatible with the current joinpoint, 3023 and act the same way as Query.join("propname", from_joinpoint=True) 3024 in that regard. 3025 3026 .. change:: 3027 :tags: sql 3028 :tickets: 921 3029 3030 Added with_hint() method to select() construct. Specify 3031 a table/alias, hint text, and optional dialect name, and 3032 "hints" will be rendered in the appropriate place in the 3033 statement. Works for Oracle, Sybase, MySQL. 3034 3035 .. change:: 3036 :tags: sql 3037 :tickets: 1747 3038 3039 Fixed bug introduced in 0.6beta2 where column labels would 3040 render inside of column expressions already assigned a label. 3041 3042 .. change:: 3043 :tags: postgresql 3044 :tickets: 877 3045 3046 The psycopg2 dialect will log NOTICE messages via the 3047 "sqlalchemy.dialects.postgresql" logger name. 3048 3049 .. change:: 3050 :tags: postgresql 3051 :tickets: 997 3052 3053 the TIME and TIMESTAMP types are now available from the 3054 postgresql dialect directly, which add the PG-specific 3055 argument 'precision' to both. 'precision' and 3056 'timezone' are correctly reflected for both TIME and 3057 TIMEZONE types. 3058 3059 .. change:: 3060 :tags: mysql 3061 :tickets: 1752 3062 3063 No longer guessing that TINYINT(1) should be BOOLEAN 3064 when reflecting - TINYINT(1) is returned. Use Boolean/ 3065 BOOLEAN in table definition to get boolean conversion 3066 behavior. 3067 3068 .. change:: 3069 :tags: oracle 3070 :tickets: 1744 3071 3072 The Oracle dialect will issue VARCHAR type definitions 3073 using character counts, i.e. VARCHAR2(50 CHAR), so that 3074 the column is sized in terms of characters and not bytes. 3075 Column reflection of character types will also use 3076 ALL_TAB_COLUMNS.CHAR_LENGTH instead of 3077 ALL_TAB_COLUMNS.DATA_LENGTH. Both of these behaviors take 3078 effect when the server version is 9 or higher - for 3079 version 8, the old behaviors are used. 3080 3081 .. change:: 3082 :tags: declarative 3083 :tickets: 1746 3084 3085 Using a mixin won't break if the mixin implements an 3086 unpredictable __getattribute__(), i.e. Zope interfaces. 3087 3088 .. change:: 3089 :tags: declarative 3090 :tickets: 1749 3091 3092 Using @classdecorator and similar on mixins to define 3093 __tablename__, __table_args__, etc. now works if 3094 the method references attributes on the ultimate 3095 subclass. 3096 3097 .. change:: 3098 :tags: declarative 3099 :tickets: 1751 3100 3101 relationships and columns with foreign keys aren't 3102 allowed on declarative mixins, sorry. 3103 3104 .. change:: 3105 :tags: ext 3106 :tickets: 3107 3108 The sqlalchemy.orm.shard module now becomes an extension, 3109 sqlalchemy.ext.horizontal_shard. The old import 3110 works with a deprecation warning. 3111 3112.. changelog:: 3113 :version: 0.6beta2 3114 :released: Sat Mar 20 2010 3115 3116 .. change:: 3117 :tags: py3k 3118 :tickets: 3119 3120 Improved the installation/test setup regarding Python 3, 3121 now that Distribute runs on Py3k. distribute_setup.py 3122 is now included. See README.py3k for Python 3 installation/ 3123 testing instructions. 3124 3125 .. change:: 3126 :tags: orm 3127 :tickets: 1740 3128 3129 The official name for the relation() function is now 3130 relationship(), to eliminate confusion over the relational 3131 algebra term. relation() however will remain available 3132 in equal capacity for the foreseeable future. 3133 3134 .. change:: 3135 :tags: orm 3136 :tickets: 1692 3137 3138 Added "version_id_generator" argument to Mapper, this is a 3139 callable that, given the current value of the "version_id_col", 3140 returns the next version number. Can be used for alternate 3141 versioning schemes such as uuid, timestamps. 3142 3143 .. change:: 3144 :tags: orm 3145 :tickets: 3146 3147 added "lockmode" kw argument to Session.refresh(), will 3148 pass through the string value to Query the same as 3149 in with_lockmode(), will also do version check for a 3150 version_id_col-enabled mapping. 3151 3152 .. change:: 3153 :tags: orm 3154 :tickets: 1188 3155 3156 Fixed bug whereby calling query(A).join(A.bs).add_entity(B) 3157 in a joined inheritance scenario would double-add B as a 3158 target and produce an invalid query. 3159 3160 .. change:: 3161 :tags: orm 3162 :tickets: 1674 3163 3164 Fixed bug in session.rollback() which involved not removing 3165 formerly "pending" objects from the session before 3166 re-integrating "deleted" objects, typically occurred with 3167 natural primary keys. If there was a primary key conflict 3168 between them, the attach of the deleted would fail 3169 internally. The formerly "pending" objects are now expunged 3170 first. 3171 3172 .. change:: 3173 :tags: orm 3174 :tickets: 1719 3175 3176 Removed a lot of logging that nobody really cares about, 3177 logging that remains will respond to live changes in the 3178 log level. No significant overhead is added. 3179 3180 .. change:: 3181 :tags: orm 3182 :tickets: 3183 3184 Fixed bug in session.merge() which prevented dict-like 3185 collections from merging. 3186 3187 .. change:: 3188 :tags: orm 3189 :tickets: 3190 3191 session.merge() works with relations that specifically 3192 don't include "merge" in their cascade options - the target 3193 is ignored completely. 3194 3195 .. change:: 3196 :tags: orm 3197 :tickets: 1681 3198 3199 session.merge() will not expire existing scalar attributes 3200 on an existing target if the target has a value for that 3201 attribute, even if the incoming merged doesn't have 3202 a value for the attribute. This prevents unnecessary loads 3203 on existing items. Will still mark the attr as expired 3204 if the destination doesn't have the attr, though, which 3205 fulfills some contracts of deferred cols. 3206 3207 .. change:: 3208 :tags: orm 3209 :tickets: 1680 3210 3211 The "allow_null_pks" flag is now called "allow_partial_pks", 3212 defaults to True, acts like it did in 0.5 again. Except, 3213 it also is implemented within merge() such that a SELECT 3214 won't be issued for an incoming instance with partially 3215 NULL primary key if the flag is False. 3216 3217 .. change:: 3218 :tags: orm 3219 :tickets: 1737 3220 3221 Fixed bug in 0.6-reworked "many-to-one" optimizations 3222 such that a many-to-one that is against a non-primary key 3223 column on the remote table (i.e. foreign key against a 3224 UNIQUE column) will pull the "old" value in from the 3225 database during a change, since if it's in the session 3226 we will need it for proper history/backref accounting, 3227 and we can't pull from the local identity map on a 3228 non-primary key column. 3229 3230 .. change:: 3231 :tags: orm 3232 :tickets: 1731 3233 3234 fixed internal error which would occur if calling has() 3235 or similar complex expression on a single-table inheritance 3236 relation(). 3237 3238 .. change:: 3239 :tags: orm 3240 :tickets: 1688 3241 3242 query.one() no longer applies LIMIT to the query, this to 3243 ensure that it fully counts all object identities present 3244 in the result, even in the case where joins may conceal 3245 multiple identities for two or more rows. As a bonus, 3246 one() can now also be called with a query that issued 3247 from_statement() to start with since it no longer modifies 3248 the query. 3249 3250 .. change:: 3251 :tags: orm 3252 :tickets: 1727 3253 3254 query.get() now returns None if queried for an identifier 3255 that is present in the identity map with a different class 3256 than the one requested, i.e. when using polymorphic loading. 3257 3258 .. change:: 3259 :tags: orm 3260 :tickets: 1706 3261 3262 A major fix in query.join(), when the "on" clause is an 3263 attribute of an aliased() construct, but there is already 3264 an existing join made out to a compatible target, query properly 3265 joins to the right aliased() construct instead of sticking 3266 onto the right side of the existing join. 3267 3268 .. change:: 3269 :tags: orm 3270 :tickets: 1362 3271 3272 Slight improvement to the fix for to not issue 3273 needless updates of the primary key column during a so-called 3274 "row switch" operation, i.e. add + delete of two objects 3275 with the same PK. 3276 3277 .. change:: 3278 :tags: orm 3279 :tickets: 3280 3281 Now uses sqlalchemy.orm.exc.DetachedInstanceError when an 3282 attribute load or refresh action fails due to object 3283 being detached from any Session. UnboundExecutionError 3284 is specific to engines bound to sessions and statements. 3285 3286 .. change:: 3287 :tags: orm 3288 :tickets: 3289 3290 Query called in the context of an expression will render 3291 disambiguating labels in all cases. Note that this does 3292 not apply to the existing .statement and .subquery() 3293 accessor/method, which still honors the .with_labels() 3294 setting that defaults to False. 3295 3296 .. change:: 3297 :tags: orm 3298 :tickets: 1676 3299 3300 Query.union() retains disambiguating labels within the 3301 returned statement, thus avoiding various SQL composition 3302 errors which can result from column name conflicts. 3303 3304 .. change:: 3305 :tags: orm 3306 :tickets: 3307 3308 Fixed bug in attribute history that inadvertently invoked 3309 __eq__ on mapped instances. 3310 3311 .. change:: 3312 :tags: orm 3313 :tickets: 3314 3315 Some internal streamlining of object loading grants a 3316 small speedup for large results, estimates are around 3317 10-15%. Gave the "state" internals a good solid 3318 cleanup with less complexity, datamembers, 3319 method calls, blank dictionary creates. 3320 3321 .. change:: 3322 :tags: orm 3323 :tickets: 1689 3324 3325 Documentation clarification for query.delete() 3326 3327 .. change:: 3328 :tags: orm 3329 :tickets: 3330 3331 Fixed cascade bug in many-to-one relation() when attribute 3332 was set to None, introduced in r6711 (cascade deleted 3333 items into session during add()). 3334 3335 .. change:: 3336 :tags: orm 3337 :tickets: 1736 3338 3339 Calling query.order_by() or query.distinct() before calling 3340 query.select_from(), query.with_polymorphic(), or 3341 query.from_statement() raises an exception now instead of 3342 silently dropping those criterion. 3343 3344 .. change:: 3345 :tags: orm 3346 :tickets: 1735 3347 3348 query.scalar() now raises an exception if more than one 3349 row is returned. All other behavior remains the same. 3350 3351 .. change:: 3352 :tags: orm 3353 :tickets: 1692 3354 3355 Fixed bug which caused "row switch" logic, that is an 3356 INSERT and DELETE replaced by an UPDATE, to fail when 3357 version_id_col was in use. 3358 3359 .. change:: 3360 :tags: sql 3361 :tickets: 1714 3362 3363 join() will now simulate a NATURAL JOIN by default. Meaning, 3364 if the left side is a join, it will attempt to join the right 3365 side to the rightmost side of the left first, and not raise 3366 any exceptions about ambiguous join conditions if successful 3367 even if there are further join targets across the rest of 3368 the left. 3369 3370 .. change:: 3371 :tags: sql 3372 :tickets: 3373 3374 The most common result processors conversion function were 3375 moved to the new "processors" module. Dialect authors are 3376 encouraged to use those functions whenever they correspond 3377 to their needs instead of implementing custom ones. 3378 3379 .. change:: 3380 :tags: sql 3381 :tickets: 1694, 1698 3382 3383 SchemaType and subclasses Boolean, Enum are now serializable, 3384 including their ddl listener and other event callables. 3385 3386 .. change:: 3387 :tags: sql 3388 :tickets: 3389 3390 Some platforms will now interpret certain literal values 3391 as non-bind parameters, rendered literally into the SQL 3392 statement. This to support strict SQL-92 rules that are 3393 enforced by some platforms including MS-SQL and Sybase. 3394 In this model, bind parameters aren't allowed in the 3395 columns clause of a SELECT, nor are certain ambiguous 3396 expressions like "?=?". When this mode is enabled, the base 3397 compiler will render the binds as inline literals, but only across 3398 strings and numeric values. Other types such as dates 3399 will raise an error, unless the dialect subclass defines 3400 a literal rendering function for those. The bind parameter 3401 must have an embedded literal value already or an error 3402 is raised (i.e. won't work with straight bindparam('x')). 3403 Dialects can also expand upon the areas where binds are not 3404 accepted, such as within argument lists of functions 3405 (which don't work on MS-SQL when native SQL binding is used). 3406 3407 .. change:: 3408 :tags: sql 3409 :tickets: 3410 3411 Added "unicode_errors" parameter to String, Unicode, etc. 3412 Behaves like the 'errors' keyword argument to 3413 the standard library's string.decode() functions. This flag 3414 requires that `convert_unicode` is set to `"force"` - otherwise, 3415 SQLAlchemy is not guaranteed to handle the task of unicode 3416 conversion. Note that this flag adds significant performance 3417 overhead to row-fetching operations for backends that already 3418 return unicode objects natively (which most DBAPIs do). This 3419 flag should only be used as an absolute last resort for reading 3420 strings from a column with varied or corrupted encodings, 3421 which only applies to databases that accept invalid encodings 3422 in the first place (i.e. MySQL. *not* PG, Sqlite, etc.) 3423 3424 .. change:: 3425 :tags: sql 3426 :tickets: 3427 3428 Added math negation operator support, -x. 3429 3430 .. change:: 3431 :tags: sql 3432 :tickets: 3433 3434 FunctionElement subclasses are now directly executable the 3435 same way any func.foo() construct is, with automatic 3436 SELECT being applied when passed to execute(). 3437 3438 .. change:: 3439 :tags: sql 3440 :tickets: 3441 3442 The "type" and "bind" keyword arguments of a func.foo() 3443 construct are now local to "func." constructs and are 3444 not part of the FunctionElement base class, allowing 3445 a "type" to be handled in a custom constructor or 3446 class-level variable. 3447 3448 .. change:: 3449 :tags: sql 3450 :tickets: 3451 3452 Restored the keys() method to ResultProxy. 3453 3454 .. change:: 3455 :tags: sql 3456 :tickets: 1647, 1683 3457 3458 The type/expression system now does a more complete job 3459 of determining the return type from an expression 3460 as well as the adaptation of the Python operator into 3461 a SQL operator, based on the full left/right/operator 3462 of the given expression. In particular 3463 the date/time/interval system created for PostgreSQL 3464 EXTRACT in has now been generalized into 3465 the type system. The previous behavior which often 3466 occurred of an expression "column + literal" forcing 3467 the type of "literal" to be the same as that of "column" 3468 will now usually not occur - the type of 3469 "literal" is first derived from the Python type of the 3470 literal, assuming standard native Python types + date 3471 types, before falling back to that of the known type 3472 on the other side of the expression. If the 3473 "fallback" type is compatible (i.e. CHAR from String), 3474 the literal side will use that. TypeDecorator 3475 types override this by default to coerce the "literal" 3476 side unconditionally, which can be changed by implementing 3477 the coerce_compared_value() method. Also part of. 3478 3479 .. change:: 3480 :tags: sql 3481 :tickets: 3482 3483 Made sqlalchemy.sql.expressions.Executable part of public 3484 API, used for any expression construct that can be sent to 3485 execute(). FunctionElement now inherits Executable so that 3486 it gains execution_options(), which are also propagated 3487 to the select() that's generated within execute(). 3488 Executable in turn subclasses _Generative which marks 3489 any ClauseElement that supports the @_generative 3490 decorator - these may also become "public" for the benefit 3491 of the compiler extension at some point. 3492 3493 .. change:: 3494 :tags: sql 3495 :tickets: 1579 3496 3497 A change to the solution for - an end-user 3498 defined bind parameter name that directly conflicts with 3499 a column-named bind generated directly from the SET or 3500 VALUES clause of an update/insert generates a compile error. 3501 This reduces call counts and eliminates some cases where 3502 undesirable name conflicts could still occur. 3503 3504 .. change:: 3505 :tags: sql 3506 :tickets: 1705 3507 3508 Column() requires a type if it has no foreign keys (this is 3509 not new). An error is now raised if a Column() has no type 3510 and no foreign keys. 3511 3512 .. change:: 3513 :tags: sql 3514 :tickets: 1717 3515 3516 the "scale" argument of the Numeric() type is honored when 3517 coercing a returned floating point value into a string 3518 on its way to Decimal - this allows accuracy to function 3519 on SQLite, MySQL. 3520 3521 .. change:: 3522 :tags: sql 3523 :tickets: 3524 3525 the copy() method of Column now copies over uninitialized 3526 "on table attach" events. Helps with the new declarative 3527 "mixin" capability. 3528 3529 .. change:: 3530 :tags: engines 3531 :tickets: 3532 3533 Added an optional C extension to speed up the sql layer by 3534 reimplementing RowProxy and the most common result processors. 3535 The actual speedups will depend heavily on your DBAPI and 3536 the mix of datatypes used in your tables, and can vary from 3537 a 30% improvement to more than 200%. It also provides a modest 3538 (~15-20%) indirect improvement to ORM speed for large queries. 3539 Note that it is *not* built/installed by default. 3540 See README for installation instructions. 3541 3542 .. change:: 3543 :tags: engines 3544 :tickets: 3545 3546 the execution sequence pulls all rowcount/last inserted ID 3547 info from the cursor before commit() is called on the 3548 DBAPI connection in an "autocommit" scenario. This helps 3549 mxodbc with rowcount and is probably a good idea overall. 3550 3551 .. change:: 3552 :tags: engines 3553 :tickets: 1719 3554 3555 Opened up logging a bit such that isEnabledFor() is called 3556 more often, so that changes to the log level for engine/pool 3557 will be reflected on next connect. This adds a small 3558 amount of method call overhead. It's negligible and will make 3559 life a lot easier for all those situations when logging 3560 just happens to be configured after create_engine() is called. 3561 3562 .. change:: 3563 :tags: engines 3564 :tickets: 3565 3566 The assert_unicode flag is deprecated. SQLAlchemy will raise 3567 a warning in all cases where it is asked to encode a non-unicode 3568 Python string, as well as when a Unicode or UnicodeType type 3569 is explicitly passed a bytestring. The String type will do nothing 3570 for DBAPIs that already accept Python unicode objects. 3571 3572 .. change:: 3573 :tags: engines 3574 :tickets: 3575 3576 Bind parameters are sent as a tuple instead of a list. Some 3577 backend drivers will not accept bind parameters as a list. 3578 3579 .. change:: 3580 :tags: engines 3581 :tickets: 3582 3583 threadlocal engine wasn't properly closing the connection 3584 upon close() - fixed that. 3585 3586 .. change:: 3587 :tags: engines 3588 :tickets: 3589 3590 Transaction object doesn't rollback or commit if it isn't 3591 "active", allows more accurate nesting of begin/rollback/commit. 3592 3593 .. change:: 3594 :tags: engines 3595 :tickets: 3596 3597 Python unicode objects as binds result in the Unicode type, 3598 not string, thus eliminating a certain class of unicode errors 3599 on drivers that don't support unicode binds. 3600 3601 .. change:: 3602 :tags: engines 3603 :tickets: 1555 3604 3605 Added "logging_name" argument to create_engine(), Pool() constructor 3606 as well as "pool_logging_name" argument to create_engine() which 3607 filters down to that of Pool. Issues the given string name 3608 within the "name" field of logging messages instead of the default 3609 hex identifier string. 3610 3611 .. change:: 3612 :tags: engines 3613 :tickets: 3614 3615 The visit_pool() method of Dialect is removed, and replaced with 3616 on_connect(). This method returns a callable which receives 3617 the raw DBAPI connection after each one is created. The callable 3618 is assembled into a first_connect/connect pool listener by the 3619 connection strategy if non-None. Provides a simpler interface 3620 for dialects. 3621 3622 .. change:: 3623 :tags: engines 3624 :tickets: 1728 3625 3626 StaticPool now initializes, disposes and recreates without 3627 opening a new connection - the connection is only opened when 3628 first requested. dispose() also works on AssertionPool now. 3629 3630 .. change:: 3631 :tags: ticket: 1673, metadata 3632 :tickets: 3633 3634 Added the ability to strip schema information when using 3635 "tometadata" by passing "schema=None" as an argument. If schema 3636 is not specified then the table's schema is retained. 3637 3638 .. change:: 3639 :tags: declarative 3640 :tickets: 3641 3642 DeclarativeMeta exclusively uses cls.__dict__ (not dict\_) 3643 as the source of class information; _as_declarative exclusively 3644 uses the dict\_ passed to it as the source of class information 3645 (which when using DeclarativeMeta is cls.__dict__). This should 3646 in theory make it easier for custom metaclasses to modify 3647 the state passed into _as_declarative. 3648 3649 .. change:: 3650 :tags: declarative 3651 :tickets: 1707 3652 3653 declarative now accepts mixin classes directly, as a means 3654 to provide common functional and column-based elements on 3655 all subclasses, as well as a means to propagate a fixed 3656 set of __table_args__ or __mapper_args__ to subclasses. 3657 For custom combinations of __table_args__/__mapper_args__ from 3658 an inherited mixin to local, descriptors can now be used. 3659 New details are all up in the Declarative documentation. 3660 Thanks to Chris Withers for putting up with my strife 3661 on this. 3662 3663 .. change:: 3664 :tags: declarative 3665 :tickets: 1393 3666 3667 the __mapper_args__ dict is copied when propagating to a subclass, 3668 and is taken straight off the class __dict__ to avoid any 3669 propagation from the parent. mapper inheritance already 3670 propagates the things you want from the parent mapper. 3671 3672 .. change:: 3673 :tags: declarative 3674 :tickets: 1732 3675 3676 An exception is raised when a single-table subclass specifies 3677 a column that is already present on the base class. 3678 3679 .. change:: 3680 :tags: mysql 3681 :tickets: 1655 3682 3683 Fixed reflection bug whereby when COLLATE was present, 3684 nullable flag and server defaults would not be reflected. 3685 3686 .. change:: 3687 :tags: mysql 3688 :tickets: 3689 3690 Fixed reflection of TINYINT(1) "boolean" columns defined with 3691 integer flags like UNSIGNED. 3692 3693 .. change:: 3694 :tags: mysql 3695 :tickets: 1668 3696 3697 Further fixes for the mysql-connector dialect. 3698 3699 .. change:: 3700 :tags: mysql 3701 :tickets: 1496 3702 3703 Composite PK table on InnoDB where the "autoincrement" column 3704 isn't first will emit an explicit "KEY" phrase within 3705 CREATE TABLE thereby avoiding errors. 3706 3707 .. change:: 3708 :tags: mysql 3709 :tickets: 1634 3710 3711 Added reflection/create table support for a wide range 3712 of MySQL keywords. 3713 3714 .. change:: 3715 :tags: mysql 3716 :tickets: 1580 3717 3718 Fixed import error which could occur reflecting tables on 3719 a Windows host 3720 3721 .. change:: 3722 :tags: mssql 3723 :tickets: 3724 3725 Re-established support for the pymssql dialect. 3726 3727 .. change:: 3728 :tags: mssql 3729 :tickets: 3730 3731 Various fixes for implicit returning, reflection, 3732 etc. - the MS-SQL dialects aren't quite complete 3733 in 0.6 yet (but are close) 3734 3735 .. change:: 3736 :tags: mssql 3737 :tickets: 1710 3738 3739 Added basic support for mxODBC. 3740 3741 .. change:: 3742 :tags: mssql 3743 :tickets: 3744 3745 Removed the text_as_varchar option. 3746 3747 .. change:: 3748 :tags: oracle 3749 :tickets: 3750 3751 "out" parameters require a type that is supported by 3752 cx_oracle. An error will be raised if no cx_oracle 3753 type can be found. 3754 3755 .. change:: 3756 :tags: oracle 3757 :tickets: 3758 3759 Oracle 'DATE' now does not perform any result processing, 3760 as the DATE type in Oracle stores full date+time objects, 3761 that's what you'll get. Note that the generic types.Date 3762 type *will* still call value.date() on incoming values, 3763 however. When reflecting a table, the reflected type 3764 will be 'DATE'. 3765 3766 .. change:: 3767 :tags: oracle 3768 :tickets: 1670 3769 3770 Added preliminary support for Oracle's WITH_UNICODE 3771 mode. At the very least this establishes initial 3772 support for cx_Oracle with Python 3. When WITH_UNICODE 3773 mode is used in Python 2.xx, a large and scary warning 3774 is emitted asking that the user seriously consider 3775 the usage of this difficult mode of operation. 3776 3777 .. change:: 3778 :tags: oracle 3779 :tickets: 1712 3780 3781 The except_() method now renders as MINUS on Oracle, 3782 which is more or less equivalent on that platform. 3783 3784 .. change:: 3785 :tags: oracle 3786 :tickets: 651 3787 3788 Added support for rendering and reflecting 3789 TIMESTAMP WITH TIME ZONE, i.e. TIMESTAMP(timezone=True). 3790 3791 .. change:: 3792 :tags: oracle 3793 :tickets: 3794 3795 Oracle INTERVAL type can now be reflected. 3796 3797 .. change:: 3798 :tags: sqlite 3799 :tickets: 1685 3800 3801 Added "native_datetime=True" flag to create_engine(). 3802 This will cause the DATE and TIMESTAMP types to skip 3803 all bind parameter and result row processing, under 3804 the assumption that PARSE_DECLTYPES has been enabled 3805 on the connection. Note that this is not entirely 3806 compatible with the "func.current_date()", which 3807 will be returned as a string. 3808 3809 .. change:: 3810 :tags: sybase 3811 :tickets: 3812 3813 Implemented a preliminary working dialect for Sybase, 3814 with sub-implementations for Python-Sybase as well 3815 as Pyodbc. Handles table 3816 creates/drops and basic round trip functionality. 3817 Does not yet include reflection or comprehensive 3818 support of unicode/special expressions/etc. 3819 3820 .. change:: 3821 :tags: examples 3822 :tickets: 3823 3824 Changed the beaker cache example a bit to have a separate 3825 RelationCache option for lazyload caching. This object 3826 does a lookup among any number of potential attributes 3827 more efficiently by grouping several into a common structure. 3828 Both FromCache and RelationCache are simpler individually. 3829 3830 .. change:: 3831 :tags: documentation 3832 :tickets: 1700 3833 3834 Major cleanup work in the docs to link class, function, and 3835 method names into the API docs. 3836 3837.. changelog:: 3838 :version: 0.6beta1 3839 :released: Wed Feb 03 2010 3840 3841 .. change:: 3842 :tags: release, major 3843 :tickets: 3844 3845 For the full set of feature descriptions, see 3846 https://docs.sqlalchemy.org/en/latest/changelog/migration_06.html . 3847 This document is a work in progress. 3848 3849 .. change:: 3850 :tags: release, major 3851 :tickets: 3852 3853 All bug fixes and feature enhancements from the most 3854 recent 0.5 version and below are also included within 0.6. 3855 3856 .. change:: 3857 :tags: release, major 3858 :tickets: 3859 3860 Platforms targeted now include Python 2.4/2.5/2.6, Python 3861 3.1, Jython2.5. 3862 3863 .. change:: 3864 :tags: orm 3865 :tickets: 3866 3867 Changes to query.update() and query.delete(): 3868 - the 'expire' option on query.update() has been renamed to 3869 'fetch', thus matching that of query.delete(). 3870 'expire' is deprecated and issues a warning. 3871 3872 - query.update() and query.delete() both default to 3873 'evaluate' for the synchronize strategy. 3874 3875 - the 'synchronize' strategy for update() and delete() 3876 raises an error on failure. There is no implicit fallback 3877 onto "fetch". Failure of evaluation is based on the 3878 structure of criteria, so success/failure is deterministic 3879 based on code structure. 3880 3881 .. change:: 3882 :tags: orm 3883 :tickets: 1186, 1492, 1544 3884 3885 Enhancements on many-to-one relations: 3886 - many-to-one relations now fire off a lazyload in fewer 3887 cases, including in most cases will not fetch the "old" 3888 value when a new one is replaced. 3889 3890 - many-to-one relation to a joined-table subclass now uses 3891 get() for a simple load (known as the "use_get" 3892 condition), i.e. Related->Sub(Base), without the need to 3893 redefine the primaryjoin condition in terms of the base 3894 table. 3895 3896 - specifying a foreign key with a declarative column, i.e. 3897 ForeignKey(MyRelatedClass.id) doesn't break the "use_get" 3898 condition from taking place 3899 3900 - relation(), eagerload(), and eagerload_all() now feature 3901 an option called "innerjoin". Specify `True` or `False` to 3902 control whether an eager join is constructed as an INNER 3903 or OUTER join. Default is `False` as always. The mapper 3904 options will override whichever setting is specified on 3905 relation(). Should generally be set for many-to-one, not 3906 nullable foreign key relations to allow improved join 3907 performance. 3908 3909 - the behavior of eagerloading such that the main query is 3910 wrapped in a subquery when LIMIT/OFFSET are present now 3911 makes an exception for the case when all eager loads are 3912 many-to-one joins. In those cases, the eager joins are 3913 against the parent table directly along with the 3914 limit/offset without the extra overhead of a subquery, 3915 since a many-to-one join does not add rows to the result. 3916 3917 .. change:: 3918 :tags: orm 3919 :tickets: 3920 3921 Enhancements / Changes on Session.merge(): 3922 3923 .. change:: 3924 :tags: orm 3925 :tickets: 3926 3927 the "dont_load=True" flag on Session.merge() is deprecated 3928 and is now "load=False". 3929 3930 .. change:: 3931 :tags: orm 3932 :tickets: 3933 3934 Session.merge() is performance optimized, using half the 3935 call counts for "load=False" mode compared to 0.5 and 3936 significantly fewer SQL queries in the case of collections 3937 for "load=True" mode. 3938 3939 .. change:: 3940 :tags: orm 3941 :tickets: 3942 3943 merge() will not issue a needless merge of attributes if the 3944 given instance is the same instance which is already present. 3945 3946 .. change:: 3947 :tags: orm 3948 :tickets: 3949 3950 merge() now also merges the "options" associated with a given 3951 state, i.e. those passed through query.options() which follow 3952 along with an instance, such as options to eagerly- or 3953 lazyily- load various attributes. This is essential for 3954 the construction of highly integrated caching schemes. This 3955 is a subtle behavioral change vs. 0.5. 3956 3957 .. change:: 3958 :tags: orm 3959 :tickets: 3960 3961 A bug was fixed regarding the serialization of the "loader 3962 path" present on an instance's state, which is also necessary 3963 when combining the usage of merge() with serialized state 3964 and associated options that should be preserved. 3965 3966 .. change:: 3967 :tags: orm 3968 :tickets: 3969 3970 The all new merge() is showcased in a new comprehensive 3971 example of how to integrate Beaker with SQLAlchemy. See 3972 the notes in the "examples" note below. 3973 3974 .. change:: 3975 :tags: orm 3976 :tickets: 1362 3977 3978 Primary key values can now be changed on a joined-table inheritance 3979 object, and ON UPDATE CASCADE will be taken into account when 3980 the flush happens. Set the new "passive_updates" flag to False 3981 on mapper() when using SQLite or MySQL/MyISAM. 3982 3983 .. change:: 3984 :tags: orm 3985 :tickets: 1671 3986 3987 flush() now detects when a primary key column was updated by 3988 an ON UPDATE CASCADE operation from another primary key, and 3989 can then locate the row for a subsequent UPDATE on the new PK 3990 value. This occurs when a relation() is there to establish 3991 the relationship as well as passive_updates=True. 3992 3993 .. change:: 3994 :tags: orm 3995 :tickets: 3996 3997 the "save-update" cascade will now cascade the pending *removed* 3998 values from a scalar or collection attribute into the new session 3999 during an add() operation. This so that the flush() operation 4000 will also delete or modify rows of those disconnected items. 4001 4002 .. change:: 4003 :tags: orm 4004 :tickets: 1531 4005 4006 Using a "dynamic" loader with a "secondary" table now produces 4007 a query where the "secondary" table is *not* aliased. This 4008 allows the secondary Table object to be used in the "order_by" 4009 attribute of the relation(), and also allows it to be used 4010 in filter criterion against the dynamic relation. 4011 4012 .. change:: 4013 :tags: orm 4014 :tickets: 1643 4015 4016 relation() with uselist=False will emit a warning when 4017 an eager or lazy load locates more than one valid value for 4018 the row. This may be due to primaryjoin/secondaryjoin 4019 conditions which aren't appropriate for an eager LEFT OUTER 4020 JOIN or for other conditions. 4021 4022 .. change:: 4023 :tags: orm 4024 :tickets: 1633 4025 4026 an explicit check occurs when a synonym() is used with 4027 map_column=True, when a ColumnProperty (deferred or otherwise) 4028 exists separately in the properties dictionary sent to mapper 4029 with the same keyname. Instead of silently replacing 4030 the existing property (and possible options on that property), 4031 an error is raised. 4032 4033 .. change:: 4034 :tags: orm 4035 :tickets: 4036 4037 a "dynamic" loader sets up its query criterion at construction 4038 time so that the actual query is returned from non-cloning 4039 accessors like "statement". 4040 4041 .. change:: 4042 :tags: orm 4043 :tickets: 4044 4045 the "named tuple" objects returned when iterating a 4046 Query() are now pickleable. 4047 4048 .. change:: 4049 :tags: orm 4050 :tickets: 1542 4051 4052 mapping to a select() construct now requires that you 4053 make an alias() out of it distinctly. This to eliminate 4054 confusion over such issues as 4055 4056 .. change:: 4057 :tags: orm 4058 :tickets: 1537 4059 4060 query.join() has been reworked to provide more consistent 4061 behavior and more flexibility (includes) 4062 4063 .. change:: 4064 :tags: orm 4065 :tickets: 4066 4067 query.select_from() accepts multiple clauses to produce 4068 multiple comma separated entries within the FROM clause. 4069 Useful when selecting from multiple-homed join() clauses. 4070 4071 .. change:: 4072 :tags: orm 4073 :tickets: 4074 4075 query.select_from() also accepts mapped classes, aliased() 4076 constructs, and mappers as arguments. In particular this 4077 helps when querying from multiple joined-table classes to ensure 4078 the full join gets rendered. 4079 4080 .. change:: 4081 :tags: orm 4082 :tickets: 1135 4083 4084 query.get() can be used with a mapping to an outer join 4085 where one or more of the primary key values are None. 4086 4087 .. change:: 4088 :tags: orm 4089 :tickets: 1568 4090 4091 query.from_self(), query.union(), others which do a 4092 "SELECT * from (SELECT...)" type of nesting will do 4093 a better job translating column expressions within the subquery 4094 to the columns clause of the outer query. This is 4095 potentially backwards incompatible with 0.5, in that this 4096 may break queries with literal expressions that do not have labels 4097 applied (i.e. literal('foo'), etc.) 4098 4099 .. change:: 4100 :tags: orm 4101 :tickets: 1622 4102 4103 relation primaryjoin and secondaryjoin now check that they 4104 are column-expressions, not just clause elements. this prohibits 4105 things like FROM expressions being placed there directly. 4106 4107 .. change:: 4108 :tags: orm 4109 :tickets: 1415 4110 4111 `expression.null()` is fully understood the same way 4112 None is when comparing an object/collection-referencing 4113 attribute within query.filter(), filter_by(), etc. 4114 4115 .. change:: 4116 :tags: orm 4117 :tickets: 1052 4118 4119 added "make_transient()" helper function which transforms a 4120 persistent/ detached instance into a transient one (i.e. 4121 deletes the instance_key and removes from any session.) 4122 4123 .. change:: 4124 :tags: orm 4125 :tickets: 1339 4126 4127 the allow_null_pks flag on mapper() is deprecated, and 4128 the feature is turned "on" by default. This means that 4129 a row which has a non-null value for any of its primary key 4130 columns will be considered an identity. The need for this 4131 scenario typically only occurs when mapping to an outer join. 4132 4133 .. change:: 4134 :tags: orm 4135 :tickets: 4136 4137 the mechanics of "backref" have been fully merged into the 4138 finer grained "back_populates" system, and take place entirely 4139 within the _generate_backref() method of RelationProperty. This 4140 makes the initialization procedure of RelationProperty 4141 simpler and allows easier propagation of settings (such as from 4142 subclasses of RelationProperty) into the reverse reference. 4143 The internal BackRef() is gone and backref() returns a plain 4144 tuple that is understood by RelationProperty. 4145 4146 .. change:: 4147 :tags: orm 4148 :tickets: 1569 4149 4150 The version_id_col feature on mapper() will raise a warning when 4151 used with dialects that don't support "rowcount" adequately. 4152 4153 .. change:: 4154 :tags: orm 4155 :tickets: 4156 4157 added "execution_options()" to Query, to so options can be 4158 passed to the resulting statement. Currently only 4159 Select-statements have these options, and the only option 4160 used is "stream_results", and the only dialect which knows 4161 "stream_results" is psycopg2. 4162 4163 .. change:: 4164 :tags: orm 4165 :tickets: 4166 4167 Query.yield_per() will set the "stream_results" statement 4168 option automatically. 4169 4170 .. change:: 4171 :tags: orm 4172 :tickets: 4173 4174 Deprecated or removed: 4175 * 'allow_null_pks' flag on mapper() is deprecated. It does 4176 nothing now and the setting is "on" in all cases. 4177 * 'transactional' flag on sessionmaker() and others is 4178 removed. Use 'autocommit=True' to indicate 'transactional=False'. 4179 * 'polymorphic_fetch' argument on mapper() is removed. 4180 Loading can be controlled using the 'with_polymorphic' 4181 option. 4182 * 'select_table' argument on mapper() is removed. Use 4183 'with_polymorphic=("*", <some selectable>)' for this 4184 functionality. 4185 * 'proxy' argument on synonym() is removed. This flag 4186 did nothing throughout 0.5, as the "proxy generation" 4187 behavior is now automatic. 4188 * Passing a single list of elements to eagerload(), 4189 eagerload_all(), contains_eager(), lazyload(), 4190 defer(), and undefer() instead of multiple positional 4191 \*args is deprecated. 4192 * Passing a single list of elements to query.order_by(), 4193 query.group_by(), query.join(), or query.outerjoin() 4194 instead of multiple positional \*args is deprecated. 4195 * query.iterate_instances() is removed. Use query.instances(). 4196 * Query.query_from_parent() is removed. Use the 4197 sqlalchemy.orm.with_parent() function to produce a 4198 "parent" clause, or alternatively query.with_parent(). 4199 * query._from_self() is removed, use query.from_self() 4200 instead. 4201 * the "comparator" argument to composite() is removed. 4202 Use "comparator_factory". 4203 * RelationProperty._get_join() is removed. 4204 * the 'echo_uow' flag on Session is removed. Use 4205 logging on the "sqlalchemy.orm.unitofwork" name. 4206 * session.clear() is removed. use session.expunge_all(). 4207 * session.save(), session.update(), session.save_or_update() 4208 are removed. Use session.add() and session.add_all(). 4209 * the "objects" flag on session.flush() remains deprecated. 4210 * the "dont_load=True" flag on session.merge() is deprecated 4211 in favor of "load=False". 4212 * ScopedSession.mapper remains deprecated. See the 4213 usage recipe at 4214 https://www.sqlalchemy.org/trac/wiki/UsageRecipes/SessionAwareMapper 4215 * passing an InstanceState (internal SQLAlchemy state object) to 4216 attributes.init_collection() or attributes.get_history() is 4217 deprecated. These functions are public API and normally 4218 expect a regular mapped object instance. 4219 * the 'engine' parameter to declarative_base() is removed. 4220 Use the 'bind' keyword argument. 4221 4222 .. change:: 4223 :tags: sql 4224 :tickets: 4225 4226 the "autocommit" flag on select() and text() as well 4227 as select().autocommit() are deprecated - now call 4228 .execution_options(autocommit=True) on either of those 4229 constructs, also available directly on Connection and orm.Query. 4230 4231 .. change:: 4232 :tags: sql 4233 :tickets: 4234 4235 the autoincrement flag on column now indicates the column 4236 which should be linked to cursor.lastrowid, if that method 4237 is used. See the API docs for details. 4238 4239 .. change:: 4240 :tags: sql 4241 :tickets: 1566 4242 4243 an executemany() now requires that all bound parameter 4244 sets require that all keys are present which are 4245 present in the first bound parameter set. The structure 4246 and behavior of an insert/update statement is very much 4247 determined by the first parameter set, including which 4248 defaults are going to fire off, and a minimum of 4249 guesswork is performed with all the rest so that performance 4250 is not impacted. For this reason defaults would otherwise 4251 silently "fail" for missing parameters, so this is now guarded 4252 against. 4253 4254 .. change:: 4255 :tags: sql 4256 :tickets: 4257 4258 returning() support is native to insert(), update(), 4259 delete(). Implementations of varying levels of 4260 functionality exist for PostgreSQL, Firebird, MSSQL and 4261 Oracle. returning() can be called explicitly with column 4262 expressions which are then returned in the resultset, 4263 usually via fetchone() or first(). 4264 4265 insert() constructs will also use RETURNING implicitly to 4266 get newly generated primary key values, if the database 4267 version in use supports it (a version number check is 4268 performed). This occurs if no end-user returning() was 4269 specified. 4270 4271 .. change:: 4272 :tags: sql 4273 :tickets: 1665 4274 4275 union(), intersect(), except() and other "compound" types 4276 of statements have more consistent behavior w.r.t. 4277 parenthesizing. Each compound element embedded within 4278 another will now be grouped with parenthesis - previously, 4279 the first compound element in the list would not be grouped, 4280 as SQLite doesn't like a statement to start with 4281 parenthesis. However, PostgreSQL in particular has 4282 precedence rules regarding INTERSECT, and it is 4283 more consistent for parenthesis to be applied equally 4284 to all sub-elements. So now, the workaround for SQLite 4285 is also what the workaround for PG was previously - 4286 when nesting compound elements, the first one usually needs 4287 ".alias().select()" called on it to wrap it inside 4288 of a subquery. 4289 4290 .. change:: 4291 :tags: sql 4292 :tickets: 1579 4293 4294 insert() and update() constructs can now embed bindparam() 4295 objects using names that match the keys of columns. These 4296 bind parameters will circumvent the usual route to those 4297 keys showing up in the VALUES or SET clause of the generated 4298 SQL. 4299 4300 .. change:: 4301 :tags: sql 4302 :tickets: 1524 4303 4304 the Binary type now returns data as a Python string 4305 (or a "bytes" type in Python 3), instead of the built- 4306 in "buffer" type. This allows symmetric round trips 4307 of binary data. 4308 4309 .. change:: 4310 :tags: sql 4311 :tickets: 4312 4313 Added a tuple_() construct, allows sets of expressions 4314 to be compared to another set, typically with IN against 4315 composite primary keys or similar. Also accepts an 4316 IN with multiple columns. The "scalar select can 4317 have only one column" error message is removed - will 4318 rely upon the database to report problems with 4319 col mismatch. 4320 4321 .. change:: 4322 :tags: sql 4323 :tickets: 4324 4325 User-defined "default" and "onupdate" callables which 4326 accept a context should now call upon 4327 "context.current_parameters" to get at the dictionary 4328 of bind parameters currently being processed. This 4329 dict is available in the same way regardless of 4330 single-execute or executemany-style statement execution. 4331 4332 .. change:: 4333 :tags: sql 4334 :tickets: 1428 4335 4336 multi-part schema names, i.e. with dots such as 4337 "dbo.master", are now rendered in select() labels 4338 with underscores for dots, i.e. "dbo_master_table_column". 4339 This is a "friendly" label that behaves better 4340 in result sets. 4341 4342 .. change:: 4343 :tags: sql 4344 :tickets: 4345 4346 removed needless "counter" behavior with select() 4347 labelnames that match a column name in the table, 4348 i.e. generates "tablename_id" for "id", instead of 4349 "tablename_id_1" in an attempt to avoid naming 4350 conflicts, when the table has a column actually 4351 named "tablename_id" - this is because 4352 the labeling logic is always applied to all columns 4353 so a naming conflict will never occur. 4354 4355 .. change:: 4356 :tags: sql 4357 :tickets: 1628 4358 4359 calling expr.in_([]), i.e. with an empty list, emits a warning 4360 before issuing the usual "expr != expr" clause. The 4361 "expr != expr" can be very expensive, and it's preferred 4362 that the user not issue in_() if the list is empty, 4363 instead simply not querying, or modifying the criterion 4364 as appropriate for more complex situations. 4365 4366 .. change:: 4367 :tags: sql 4368 :tickets: 4369 4370 Added "execution_options()" to select()/text(), which set the 4371 default options for the Connection. See the note in "engines". 4372 4373 .. change:: 4374 :tags: sql 4375 :tickets: 1131 4376 4377 Deprecated or removed: 4378 * "scalar" flag on select() is removed, use 4379 select.as_scalar(). 4380 * "shortname" attribute on bindparam() is removed. 4381 * postgres_returning, firebird_returning flags on 4382 insert(), update(), delete() are deprecated, use 4383 the new returning() method. 4384 * fold_equivalents flag on join is deprecated (will remain 4385 until is implemented) 4386 4387 .. change:: 4388 :tags: engines 4389 :tickets: 443 4390 4391 transaction isolation level may be specified with 4392 create_engine(... isolation_level="..."); available on 4393 postgresql and sqlite. 4394 4395 .. change:: 4396 :tags: engines 4397 :tickets: 4398 4399 Connection has execution_options(), generative method 4400 which accepts keywords that affect how the statement 4401 is executed w.r.t. the DBAPI. Currently supports 4402 "stream_results", causes psycopg2 to use a server 4403 side cursor for that statement, as well as 4404 "autocommit", which is the new location for the "autocommit" 4405 option from select() and text(). select() and 4406 text() also have .execution_options() as well as 4407 ORM Query(). 4408 4409 .. change:: 4410 :tags: engines 4411 :tickets: 1630 4412 4413 fixed the import for entrypoint-driven dialects to 4414 not rely upon silly tb_info trick to determine import 4415 error status. 4416 4417 .. change:: 4418 :tags: engines 4419 :tickets: 4420 4421 added first() method to ResultProxy, returns first row and 4422 closes result set immediately. 4423 4424 .. change:: 4425 :tags: engines 4426 :tickets: 4427 4428 RowProxy objects are now pickleable, i.e. the object returned 4429 by result.fetchone(), result.fetchall() etc. 4430 4431 .. change:: 4432 :tags: engines 4433 :tickets: 4434 4435 RowProxy no longer has a close() method, as the row no longer 4436 maintains a reference to the parent. Call close() on 4437 the parent ResultProxy instead, or use autoclose. 4438 4439 .. change:: 4440 :tags: engines 4441 :tickets: 1586 4442 4443 ResultProxy internals have been overhauled to greatly reduce 4444 method call counts when fetching columns. Can provide a large 4445 speed improvement (up to more than 100%) when fetching large 4446 result sets. The improvement is larger when fetching columns 4447 that have no type-level processing applied and when using 4448 results as tuples (instead of as dictionaries). Many 4449 thanks to Elixir's Gaëtan de Menten for this dramatic 4450 improvement ! 4451 4452 .. change:: 4453 :tags: engines 4454 :tickets: 4455 4456 Databases which rely upon postfetch of "last inserted id" 4457 to get at a generated sequence value (i.e. MySQL, MS-SQL) 4458 now work correctly when there is a composite primary key 4459 where the "autoincrement" column is not the first primary 4460 key column in the table. 4461 4462 .. change:: 4463 :tags: engines 4464 :tickets: 4465 4466 the last_inserted_ids() method has been renamed to the 4467 descriptor "inserted_primary_key". 4468 4469 .. change:: 4470 :tags: engines 4471 :tickets: 1554 4472 4473 setting echo=False on create_engine() now sets the loglevel 4474 to WARN instead of NOTSET. This so that logging can be 4475 disabled for a particular engine even if logging 4476 for "sqlalchemy.engine" is enabled overall. Note that the 4477 default setting of "echo" is `None`. 4478 4479 .. change:: 4480 :tags: engines 4481 :tickets: 4482 4483 ConnectionProxy now has wrapper methods for all transaction 4484 lifecycle events, including begin(), rollback(), commit() 4485 begin_nested(), begin_prepared(), prepare(), release_savepoint(), 4486 etc. 4487 4488 .. change:: 4489 :tags: engines 4490 :tickets: 4491 4492 Connection pool logging now uses both INFO and DEBUG 4493 log levels for logging. INFO is for major events such 4494 as invalidated connections, DEBUG for all the acquire/return 4495 logging. `echo_pool` can be False, None, True or "debug" 4496 the same way as `echo` works. 4497 4498 .. change:: 4499 :tags: engines 4500 :tickets: 1621 4501 4502 All pyodbc-dialects now support extra pyodbc-specific 4503 kw arguments 'ansi', 'unicode_results', 'autocommit'. 4504 4505 .. change:: 4506 :tags: engines 4507 :tickets: 4508 4509 the "threadlocal" engine has been rewritten and simplified 4510 and now supports SAVEPOINT operations. 4511 4512 .. change:: 4513 :tags: engines 4514 :tickets: 4515 4516 deprecated or removed 4517 * result.last_inserted_ids() is deprecated. Use 4518 result.inserted_primary_key 4519 * dialect.get_default_schema_name(connection) is now 4520 public via dialect.default_schema_name. 4521 * the "connection" argument from engine.transaction() and 4522 engine.run_callable() is removed - Connection itself 4523 now has those methods. All four methods accept 4524 \*args and \**kwargs which are passed to the given callable, 4525 as well as the operating connection. 4526 4527 .. change:: 4528 :tags: schema 4529 :tickets: 1541 4530 4531 the `__contains__()` method of `MetaData` now accepts 4532 strings or `Table` objects as arguments. If given 4533 a `Table`, the argument is converted to `table.key` first, 4534 i.e. "[schemaname.]<tablename>" 4535 4536 .. change:: 4537 :tags: schema 4538 :tickets: 4539 4540 deprecated MetaData.connect() and 4541 ThreadLocalMetaData.connect() have been removed - send 4542 the "bind" attribute to bind a metadata. 4543 4544 .. change:: 4545 :tags: schema 4546 :tickets: 4547 4548 deprecated metadata.table_iterator() method removed (use 4549 sorted_tables) 4550 4551 .. change:: 4552 :tags: schema 4553 :tickets: 4554 4555 deprecated PassiveDefault - use DefaultClause. 4556 4557 .. change:: 4558 :tags: schema 4559 :tickets: 4560 4561 the "metadata" argument is removed from DefaultGenerator 4562 and subclasses, but remains locally present on Sequence, 4563 which is a standalone construct in DDL. 4564 4565 .. change:: 4566 :tags: schema 4567 :tickets: 4568 4569 Removed public mutability from Index and Constraint 4570 objects: 4571 4572 * ForeignKeyConstraint.append_element() 4573 * Index.append_column() 4574 * UniqueConstraint.append_column() 4575 * PrimaryKeyConstraint.add() 4576 * PrimaryKeyConstraint.remove() 4577 4578 These should be constructed declaratively (i.e. in one 4579 construction). 4580 4581 .. change:: 4582 :tags: schema 4583 :tickets: 1545 4584 4585 The "start" and "increment" attributes on Sequence now 4586 generate "START WITH" and "INCREMENT BY" by default, 4587 on Oracle and PostgreSQL. Firebird doesn't support 4588 these keywords right now. 4589 4590 .. change:: 4591 :tags: schema 4592 :tickets: 4593 4594 UniqueConstraint, Index, PrimaryKeyConstraint all accept 4595 lists of column names or column objects as arguments. 4596 4597 .. change:: 4598 :tags: schema 4599 :tickets: 4600 4601 Other removed things: 4602 - Table.key (no idea what this was for) 4603 - Table.primary_key is not assignable - use 4604 table.append_constraint(PrimaryKeyConstraint(...)) 4605 - Column.bind (get via column.table.bind) 4606 - Column.metadata (get via column.table.metadata) 4607 - Column.sequence (use column.default) 4608 - ForeignKey(constraint=some_parent) (is now private _constraint) 4609 4610 .. change:: 4611 :tags: schema 4612 :tickets: 4613 4614 The use_alter flag on ForeignKey is now a shortcut option 4615 for operations that can be hand-constructed using the 4616 DDL() event system. A side effect of this refactor is 4617 that ForeignKeyConstraint objects with use_alter=True 4618 will *not* be emitted on SQLite, which does not support 4619 ALTER for foreign keys. 4620 4621 .. change:: 4622 :tags: schema 4623 :tickets: 1605 4624 4625 ForeignKey and ForeignKeyConstraint objects now correctly 4626 copy() all their public keyword arguments. 4627 4628 .. change:: 4629 :tags: reflection/inspection 4630 :tickets: 4631 4632 Table reflection has been expanded and generalized into 4633 a new API called "sqlalchemy.engine.reflection.Inspector". 4634 The Inspector object provides fine-grained information about 4635 a wide variety of schema information, with room for expansion, 4636 including table names, column names, view definitions, sequences, 4637 indexes, etc. 4638 4639 .. change:: 4640 :tags: reflection/inspection 4641 :tickets: 4642 4643 Views are now reflectable as ordinary Table objects. The same 4644 Table constructor is used, with the caveat that "effective" 4645 primary and foreign key constraints aren't part of the reflection 4646 results; these have to be specified explicitly if desired. 4647 4648 .. change:: 4649 :tags: reflection/inspection 4650 :tickets: 4651 4652 The existing autoload=True system now uses Inspector underneath 4653 so that each dialect need only return "raw" data about tables 4654 and other objects - Inspector is the single place that information 4655 is compiled into Table objects so that consistency is at a maximum. 4656 4657 .. change:: 4658 :tags: ddl 4659 :tickets: 4660 4661 the DDL system has been greatly expanded. the DDL() class 4662 now extends the more generic DDLElement(), which forms the basis 4663 of many new constructs: 4664 4665 - CreateTable() 4666 - DropTable() 4667 - AddConstraint() 4668 - DropConstraint() 4669 - CreateIndex() 4670 - DropIndex() 4671 - CreateSequence() 4672 - DropSequence() 4673 4674 These support "on" and "execute-at()" just like plain DDL() 4675 does. User-defined DDLElement subclasses can be created and 4676 linked to a compiler using the sqlalchemy.ext.compiler extension. 4677 4678 .. change:: 4679 :tags: ddl 4680 :tickets: 4681 4682 The signature of the "on" callable passed to DDL() and 4683 DDLElement() is revised as follows: 4684 4685 ddl 4686 the DDLElement object itself 4687 event 4688 the string event name. 4689 target 4690 previously "schema_item", the Table or MetaData object triggering the event. 4691 connection 4692 the Connection object in use for the operation. 4693 \**kw 4694 keyword arguments. In the case of MetaData before/after 4695 create/drop, the list of Table objects for which 4696 CREATE/DROP DDL is to be issued is passed as the kw 4697 argument "tables". This is necessary for metadata-level 4698 DDL that is dependent on the presence of specific tables. 4699 4700 The "schema_item" attribute of DDL has been renamed to 4701 "target". 4702 4703 .. change:: 4704 :tags: dialect, refactor 4705 :tickets: 4706 4707 Dialect modules are now broken into database dialects 4708 plus DBAPI implementations. Connect URLs are now 4709 preferred to be specified using dialect+driver://..., 4710 i.e. "mysql+mysqldb://scott:tiger@localhost/test". See 4711 the 0.6 documentation for examples. 4712 4713 .. change:: 4714 :tags: dialect, refactor 4715 :tickets: 4716 4717 the setuptools entrypoint for external dialects is now 4718 called "sqlalchemy.dialects". 4719 4720 .. change:: 4721 :tags: dialect, refactor 4722 :tickets: 4723 4724 the "owner" keyword argument is removed from Table. Use 4725 "schema" to represent any namespaces to be prepended to 4726 the table name. 4727 4728 .. change:: 4729 :tags: dialect, refactor 4730 :tickets: 4731 4732 server_version_info becomes a static attribute. 4733 4734 .. change:: 4735 :tags: dialect, refactor 4736 :tickets: 4737 4738 dialects receive an initialize() event on initial 4739 connection to determine connection properties. 4740 4741 .. change:: 4742 :tags: dialect, refactor 4743 :tickets: 4744 4745 dialects receive a visit_pool event have an opportunity 4746 to establish pool listeners. 4747 4748 .. change:: 4749 :tags: dialect, refactor 4750 :tickets: 4751 4752 cached TypeEngine classes are cached per-dialect class 4753 instead of per-dialect. 4754 4755 .. change:: 4756 :tags: dialect, refactor 4757 :tickets: 4758 4759 new UserDefinedType should be used as a base class for 4760 new types, which preserves the 0.5 behavior of 4761 get_col_spec(). 4762 4763 .. change:: 4764 :tags: dialect, refactor 4765 :tickets: 4766 4767 The result_processor() method of all type classes now 4768 accepts a second argument "coltype", which is the DBAPI 4769 type argument from cursor.description. This argument 4770 can help some types decide on the most efficient processing 4771 of result values. 4772 4773 .. change:: 4774 :tags: dialect, refactor 4775 :tickets: 4776 4777 Deprecated Dialect.get_params() removed. 4778 4779 .. change:: 4780 :tags: dialect, refactor 4781 :tickets: 4782 4783 Dialect.get_rowcount() has been renamed to a descriptor 4784 "rowcount", and calls cursor.rowcount directly. Dialects 4785 which need to hardwire a rowcount in for certain calls 4786 should override the method to provide different behavior. 4787 4788 .. change:: 4789 :tags: dialect, refactor 4790 :tickets: 1566 4791 4792 DefaultRunner and subclasses have been removed. The job 4793 of this object has been simplified and moved into 4794 ExecutionContext. Dialects which support sequences should 4795 add a `fire_sequence()` method to their execution context 4796 implementation. 4797 4798 .. change:: 4799 :tags: dialect, refactor 4800 :tickets: 4801 4802 Functions and operators generated by the compiler now use 4803 (almost) regular dispatch functions of the form 4804 "visit_<opname>" and "visit_<funcname>_fn" to provide 4805 customed processing. This replaces the need to copy the 4806 "functions" and "operators" dictionaries in compiler 4807 subclasses with straightforward visitor methods, and also 4808 allows compiler subclasses complete control over 4809 rendering, as the full _Function or _BinaryExpression 4810 object is passed in. 4811 4812 .. change:: 4813 :tags: postgresql 4814 :tickets: 4815 4816 New dialects: pg8000, zxjdbc, and pypostgresql 4817 on py3k. 4818 4819 .. change:: 4820 :tags: postgresql 4821 :tickets: 4822 4823 The "postgres" dialect is now named "postgresql" ! 4824 Connection strings look like: 4825 4826 postgresql://scott:tiger@localhost/test 4827 postgresql+pg8000://scott:tiger@localhost/test 4828 4829 The "postgres" name remains for backwards compatibility 4830 in the following ways: 4831 4832 - There is a "postgres.py" dummy dialect which 4833 allows old URLs to work, i.e. 4834 postgres://scott:tiger@localhost/test 4835 4836 - The "postgres" name can be imported from the old 4837 "databases" module, i.e. "from 4838 sqlalchemy.databases import postgres" as well as 4839 "dialects", "from sqlalchemy.dialects.postgres 4840 import base as pg", will send a deprecation 4841 warning. 4842 4843 - Special expression arguments are now named 4844 "postgresql_returning" and "postgresql_where", but 4845 the older "postgres_returning" and 4846 "postgres_where" names still work with a 4847 deprecation warning. 4848 4849 .. change:: 4850 :tags: postgresql 4851 :tickets: 4852 4853 "postgresql_where" now accepts SQL expressions which 4854 can also include literals, which will be quoted as needed. 4855 4856 .. change:: 4857 :tags: postgresql 4858 :tickets: 4859 4860 The psycopg2 dialect now uses psycopg2's "unicode extension" 4861 on all new connections, which allows all String/Text/etc. 4862 types to skip the need to post-process bytestrings into 4863 unicode (an expensive step due to its volume). Other 4864 dialects which return unicode natively (pg8000, zxjdbc) 4865 also skip unicode post-processing. 4866 4867 .. change:: 4868 :tags: postgresql 4869 :tickets: 1511 4870 4871 Added new ENUM type, which exists as a schema-level 4872 construct and extends the generic Enum type. Automatically 4873 associates itself with tables and their parent metadata 4874 to issue the appropriate CREATE TYPE/DROP TYPE 4875 commands as needed, supports unicode labels, supports 4876 reflection. 4877 4878 .. change:: 4879 :tags: postgresql 4880 :tickets: 4881 4882 INTERVAL supports an optional "precision" argument 4883 corresponding to the argument that PG accepts. 4884 4885 .. change:: 4886 :tags: postgresql 4887 :tickets: 4888 4889 using new dialect.initialize() feature to set up 4890 version-dependent behavior. 4891 4892 .. change:: 4893 :tags: postgresql 4894 :tickets: 1279 4895 4896 somewhat better support for % signs in table/column names; 4897 psycopg2 can't handle a bind parameter name of 4898 %(foobar)s however and SQLA doesn't want to add overhead 4899 just to treat that one non-existent use case. 4900 4901 .. change:: 4902 :tags: postgresql 4903 :tickets: 1516 4904 4905 Inserting NULL into a primary key + foreign key column 4906 will allow the "not null constraint" error to raise, 4907 not an attempt to execute a nonexistent "col_id_seq" 4908 sequence. 4909 4910 .. change:: 4911 :tags: postgresql 4912 :tickets: 4913 4914 autoincrement SELECT statements, i.e. those which 4915 select from a procedure that modifies rows, now work 4916 with server-side cursor mode (the named cursor isn't 4917 used for such statements.) 4918 4919 .. change:: 4920 :tags: postgresql 4921 :tickets: 1636 4922 4923 postgresql dialect can properly detect pg "devel" version 4924 strings, i.e. "8.5devel" 4925 4926 .. change:: 4927 :tags: postgresql 4928 :tickets: 1619 4929 4930 The psycopg2 now respects the statement option 4931 "stream_results". This option overrides the connection setting 4932 "server_side_cursors". If true, server side cursors will be 4933 used for the statement. If false, they will not be used, even 4934 if "server_side_cursors" is true on the 4935 connection. 4936 4937 .. change:: 4938 :tags: mysql 4939 :tickets: 4940 4941 New dialects: oursql, a new native dialect, 4942 MySQL Connector/Python, a native Python port of MySQLdb, 4943 and of course zxjdbc on Jython. 4944 4945 .. change:: 4946 :tags: mysql 4947 :tickets: 4948 4949 VARCHAR/NVARCHAR will not render without a length, raises 4950 an error before passing to MySQL. Doesn't impact 4951 CAST since VARCHAR is not allowed in MySQL CAST anyway, 4952 the dialect renders CHAR/NCHAR in those cases. 4953 4954 .. change:: 4955 :tags: mysql 4956 :tickets: 4957 4958 all the _detect_XXX() functions now run once underneath 4959 dialect.initialize() 4960 4961 .. change:: 4962 :tags: mysql 4963 :tickets: 1279 4964 4965 somewhat better support for % signs in table/column names; 4966 MySQLdb can't handle % signs in SQL when executemany() is used, 4967 and SQLA doesn't want to add overhead just to treat that one 4968 non-existent use case. 4969 4970 .. change:: 4971 :tags: mysql 4972 :tickets: 4973 4974 the BINARY and MSBinary types now generate "BINARY" in all 4975 cases. Omitting the "length" parameter will generate 4976 "BINARY" with no length. Use BLOB to generate an unlengthed 4977 binary column. 4978 4979 .. change:: 4980 :tags: mysql 4981 :tickets: 4982 4983 the "quoting='quoted'" argument to MSEnum/ENUM is deprecated. 4984 It's best to rely upon the automatic quoting. 4985 4986 .. change:: 4987 :tags: mysql 4988 :tickets: 4989 4990 ENUM now subclasses the new generic Enum type, and also handles 4991 unicode values implicitly, if the given labelnames are unicode 4992 objects. 4993 4994 .. change:: 4995 :tags: mysql 4996 :tickets: 1539 4997 4998 a column of type TIMESTAMP now defaults to NULL if 4999 "nullable=False" is not passed to Column(), and no default 5000 is present. This is now consistent with all other types, 5001 and in the case of TIMESTAMP explicitly renders "NULL" 5002 due to MySQL's "switching" of default nullability 5003 for TIMESTAMP columns. 5004 5005 .. change:: 5006 :tags: oracle 5007 :tickets: 5008 5009 unit tests pass 100% with cx_oracle ! 5010 5011 .. change:: 5012 :tags: oracle 5013 :tickets: 5014 5015 support for cx_Oracle's "native unicode" mode which does 5016 not require NLS_LANG to be set. Use the latest 5.0.2 or 5017 later of cx_oracle. 5018 5019 .. change:: 5020 :tags: oracle 5021 :tickets: 5022 5023 an NCLOB type is added to the base types. 5024 5025 .. change:: 5026 :tags: oracle 5027 :tickets: 5028 5029 use_ansi=False won't leak into the FROM/WHERE clause of 5030 a statement that's selecting from a subquery that also 5031 uses JOIN/OUTERJOIN. 5032 5033 .. change:: 5034 :tags: oracle 5035 :tickets: 1467 5036 5037 added native INTERVAL type to the dialect. This supports 5038 only the DAY TO SECOND interval type so far due to lack 5039 of support in cx_oracle for YEAR TO MONTH. 5040 5041 .. change:: 5042 :tags: oracle 5043 :tickets: 5044 5045 usage of the CHAR type results in cx_oracle's 5046 FIXED_CHAR dbapi type being bound to statements. 5047 5048 .. change:: 5049 :tags: oracle 5050 :tickets: 885 5051 5052 the Oracle dialect now features NUMBER which intends 5053 to act justlike Oracle's NUMBER type. It is the primary 5054 numeric type returned by table reflection and attempts 5055 to return Decimal()/float/int based on the precision/scale 5056 parameters. 5057 5058 .. change:: 5059 :tags: oracle 5060 :tickets: 5061 5062 func.char_length is a generic function for LENGTH 5063 5064 .. change:: 5065 :tags: oracle 5066 :tickets: 5067 5068 ForeignKey() which includes onupdate=<value> will emit a 5069 warning, not emit ON UPDATE CASCADE which is unsupported 5070 by oracle 5071 5072 .. change:: 5073 :tags: oracle 5074 :tickets: 5075 5076 the keys() method of RowProxy() now returns the result 5077 column names *normalized* to be SQLAlchemy case 5078 insensitive names. This means they will be lower case for 5079 case insensitive names, whereas the DBAPI would normally 5080 return them as UPPERCASE names. This allows row keys() to 5081 be compatible with further SQLAlchemy operations. 5082 5083 .. change:: 5084 :tags: oracle 5085 :tickets: 5086 5087 using new dialect.initialize() feature to set up 5088 version-dependent behavior. 5089 5090 .. change:: 5091 :tags: oracle 5092 :tickets: 1125 5093 5094 using types.BigInteger with Oracle will generate 5095 NUMBER(19) 5096 5097 .. change:: 5098 :tags: oracle 5099 :tickets: 5100 5101 "case sensitivity" feature will detect an all-lowercase 5102 case-sensitive column name during reflect and add 5103 "quote=True" to the generated Column, so that proper 5104 quoting is maintained. 5105 5106 .. change:: 5107 :tags: firebird 5108 :tickets: 5109 5110 the keys() method of RowProxy() now returns the result 5111 column names *normalized* to be SQLAlchemy case 5112 insensitive names. This means they will be lower case for 5113 case insensitive names, whereas the DBAPI would normally 5114 return them as UPPERCASE names. This allows row keys() to 5115 be compatible with further SQLAlchemy operations. 5116 5117 .. change:: 5118 :tags: firebird 5119 :tickets: 5120 5121 using new dialect.initialize() feature to set up 5122 version-dependent behavior. 5123 5124 .. change:: 5125 :tags: firebird 5126 :tickets: 5127 5128 "case sensitivity" feature will detect an all-lowercase 5129 case-sensitive column name during reflect and add 5130 "quote=True" to the generated Column, so that proper 5131 quoting is maintained. 5132 5133 .. change:: 5134 :tags: mssql 5135 :tickets: 5136 5137 MSSQL + Pyodbc + FreeTDS now works for the most part, 5138 with possible exceptions regarding binary data as well as 5139 unicode schema identifiers. 5140 5141 .. change:: 5142 :tags: mssql 5143 :tickets: 5144 5145 the "has_window_funcs" flag is removed. LIMIT/OFFSET 5146 usage will use ROW NUMBER as always, and if on an older 5147 version of SQL Server, the operation fails. The behavior 5148 is exactly the same except the error is raised by SQL 5149 server instead of the dialect, and no flag setting is 5150 required to enable it. 5151 5152 .. change:: 5153 :tags: mssql 5154 :tickets: 5155 5156 the "auto_identity_insert" flag is removed. This feature 5157 always takes effect when an INSERT statement overrides a 5158 column that is known to have a sequence on it. As with 5159 "has_window_funcs", if the underlying driver doesn't 5160 support this, then you can't do this operation in any 5161 case, so there's no point in having a flag. 5162 5163 .. change:: 5164 :tags: mssql 5165 :tickets: 5166 5167 using new dialect.initialize() feature to set up 5168 version-dependent behavior. 5169 5170 .. change:: 5171 :tags: mssql 5172 :tickets: 5173 5174 removed references to sequence which is no longer used. 5175 implicit identities in mssql work the same as implicit 5176 sequences on any other dialects. Explicit sequences are 5177 enabled through the use of "default=Sequence()". See 5178 the MSSQL dialect documentation for more information. 5179 5180 .. change:: 5181 :tags: sqlite 5182 :tickets: 5183 5184 DATE, TIME and DATETIME types can now take optional storage_format 5185 and regexp argument. storage_format can be used to store those types 5186 using a custom string format. regexp allows to use a custom regular 5187 expression to match string values from the database. 5188 5189 .. change:: 5190 :tags: sqlite 5191 :tickets: 5192 5193 Time and DateTime types now use by a default a stricter regular 5194 expression to match strings from the database. Use the regexp 5195 argument if you are using data stored in a legacy format. 5196 5197 .. change:: 5198 :tags: sqlite 5199 :tickets: 5200 5201 __legacy_microseconds__ on SQLite Time and DateTime types is not 5202 supported anymore. You should use the storage_format argument 5203 instead. 5204 5205 .. change:: 5206 :tags: sqlite 5207 :tickets: 5208 5209 Date, Time and DateTime types are now stricter in what they accept as 5210 bind parameters: Date type only accepts date objects (and datetime 5211 ones, because they inherit from date), Time only accepts time 5212 objects, and DateTime only accepts date and datetime objects. 5213 5214 .. change:: 5215 :tags: sqlite 5216 :tickets: 1016 5217 5218 Table() supports a keyword argument "sqlite_autoincrement", which 5219 applies the SQLite keyword "AUTOINCREMENT" to the single integer 5220 primary key column when generating DDL. Will prevent generation of 5221 a separate PRIMARY KEY constraint. 5222 5223 .. change:: 5224 :tags: types 5225 :tickets: 5226 5227 The construction of types within dialects has been totally 5228 overhauled. Dialects now define publicly available types 5229 as UPPERCASE names exclusively, and internal implementation 5230 types using underscore identifiers (i.e. are private). 5231 The system by which types are expressed in SQL and DDL 5232 has been moved to the compiler system. This has the 5233 effect that there are much fewer type objects within 5234 most dialects. A detailed document on this architecture 5235 for dialect authors is in 5236 lib/sqlalchemy/dialects/type_migration_guidelines.txt . 5237 5238 .. change:: 5239 :tags: types 5240 :tickets: 5241 5242 Types no longer make any guesses as to default 5243 parameters. In particular, Numeric, Float, NUMERIC, 5244 FLOAT, DECIMAL don't generate any length or scale unless 5245 specified. 5246 5247 .. change:: 5248 :tags: types 5249 :tickets: 1664 5250 5251 types.Binary is renamed to types.LargeBinary, it only 5252 produces BLOB, BYTEA, or a similar "long binary" type. 5253 New base BINARY and VARBINARY 5254 types have been added to access these MySQL/MS-SQL specific 5255 types in an agnostic way. 5256 5257 .. change:: 5258 :tags: types 5259 :tickets: 5260 5261 String/Text/Unicode types now skip the unicode() check 5262 on each result column value if the dialect has 5263 detected the DBAPI as returning Python unicode objects 5264 natively. This check is issued on first connect 5265 using "SELECT CAST 'some text' AS VARCHAR(10)" or 5266 equivalent, then checking if the returned object 5267 is a Python unicode. This allows vast performance 5268 increases for native-unicode DBAPIs, including 5269 pysqlite/sqlite3, psycopg2, and pg8000. 5270 5271 .. change:: 5272 :tags: types 5273 :tickets: 5274 5275 Most types result processors have been checked for possible speed 5276 improvements. Specifically, the following generic types have been 5277 optimized, resulting in varying speed improvements: 5278 Unicode, PickleType, Interval, TypeDecorator, Binary. 5279 Also the following dbapi-specific implementations have been improved: 5280 Time, Date and DateTime on Sqlite, ARRAY on PostgreSQL, 5281 Time on MySQL, Numeric(as_decimal=False) on MySQL, oursql and 5282 pypostgresql, DateTime on cx_oracle and LOB-based types on cx_oracle. 5283 5284 .. change:: 5285 :tags: types 5286 :tickets: 5287 5288 Reflection of types now returns the exact UPPERCASE 5289 type within types.py, or the UPPERCASE type within 5290 the dialect itself if the type is not a standard SQL 5291 type. This means reflection now returns more accurate 5292 information about reflected types. 5293 5294 .. change:: 5295 :tags: types 5296 :tickets: 1511, 1109 5297 5298 Added a new Enum generic type. Enum is a schema-aware object 5299 to support databases which require specific DDL in order to 5300 use enum or equivalent; in the case of PG it handles the 5301 details of `CREATE TYPE`, and on other databases without 5302 native enum support will by generate VARCHAR + an inline CHECK 5303 constraint to enforce the enum. 5304 5305 .. change:: 5306 :tags: types 5307 :tickets: 1467 5308 5309 The Interval type includes a "native" flag which controls 5310 if native INTERVAL types (postgresql + oracle) are selected 5311 if available, or not. "day_precision" and "second_precision" 5312 arguments are also added which propagate as appropriately 5313 to these native types. Related to. 5314 5315 .. change:: 5316 :tags: types 5317 :tickets: 1589 5318 5319 The Boolean type, when used on a backend that doesn't 5320 have native boolean support, will generate a CHECK 5321 constraint "col IN (0, 1)" along with the int/smallint- 5322 based column type. This can be switched off if 5323 desired with create_constraint=False. 5324 Note that MySQL has no native boolean *or* CHECK constraint 5325 support so this feature isn't available on that platform. 5326 5327 .. change:: 5328 :tags: types 5329 :tickets: 5330 5331 PickleType now uses == for comparison of values when 5332 mutable=True, unless the "comparator" argument with a 5333 comparison function is specified to the type. Objects 5334 being pickled will be compared based on identity (which 5335 defeats the purpose of mutable=True) if __eq__() is not 5336 overridden or a comparison function is not provided. 5337 5338 .. change:: 5339 :tags: types 5340 :tickets: 5341 5342 The default "precision" and "scale" arguments of Numeric 5343 and Float have been removed and now default to None. 5344 NUMERIC and FLOAT will be rendered with no numeric 5345 arguments by default unless these values are provided. 5346 5347 .. change:: 5348 :tags: types 5349 :tickets: 5350 5351 AbstractType.get_search_list() is removed - the games 5352 that was used for are no longer necessary. 5353 5354 .. change:: 5355 :tags: types 5356 :tickets: 1125 5357 5358 Added a generic BigInteger type, compiles to 5359 BIGINT or NUMBER(19). 5360 5361 .. change:: 5362 :tags: types 5363 :tickets: 5364 5365 sqlsoup has been overhauled to explicitly support an 0.5 style 5366 session, using autocommit=False, autoflush=True. Default 5367 behavior of SQLSoup now requires the usual usage of commit() 5368 and rollback(), which have been added to its interface. An 5369 explicit Session or scoped_session can be passed to the 5370 constructor, allowing these arguments to be overridden. 5371 5372 .. change:: 5373 :tags: types 5374 :tickets: 5375 5376 sqlsoup db.<sometable>.update() and delete() now call 5377 query(cls).update() and delete(), respectively. 5378 5379 .. change:: 5380 :tags: types 5381 :tickets: 5382 5383 sqlsoup now has execute() and connection(), which call upon 5384 the Session methods of those names, ensuring that the bind is 5385 in terms of the SqlSoup object's bind. 5386 5387 .. change:: 5388 :tags: types 5389 :tickets: 5390 5391 sqlsoup objects no longer have the 'query' attribute - it's 5392 not needed for sqlsoup's usage paradigm and it gets in the 5393 way of a column that is actually named 'query'. 5394 5395 .. change:: 5396 :tags: types 5397 :tickets: 1259 5398 5399 The signature of the proxy_factory callable passed to 5400 association_proxy is now (lazy_collection, creator, 5401 value_attr, association_proxy), adding a fourth argument 5402 that is the parent AssociationProxy argument. Allows 5403 serializability and subclassing of the built in collections. 5404 5405 .. change:: 5406 :tags: types 5407 :tickets: 1372 5408 5409 association_proxy now has basic comparator methods .any(), 5410 .has(), .contains(), ==, !=, thanks to Scott Torborg. 5411