forked from CNXTEoEorg/sqlalchemy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCHANGES_PRE_06
6222 lines (5133 loc) · 279 KB
/
CHANGES_PRE_06
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-*- coding: utf-8; fill-column: 68 -*-
===============
CHANGES PRE-0.6
===============
0.5.9
=====
- sql
- Fixed erroneous self_group() call in expression package.
[ticket:1661]
0.5.8
=====
- sql
- The copy() method on Column now supports uninitialized,
unnamed Column objects. This allows easy creation of
declarative helpers which place common columns on multiple
subclasses.
- Default generators like Sequence() translate correctly
across a copy() operation.
- Sequence() and other DefaultGenerator objects are accepted
as the value for the "default" and "onupdate" keyword
arguments of Column, in addition to being accepted
positionally.
- Fixed a column arithmetic bug that affected column
correspondence for cloned selectables which contain
free-standing column expressions. This bug is
generally only noticeable when exercising newer
ORM behavior only availble in 0.6 via [ticket:1568],
but is more correct at the SQL expression level
as well. [ticket:1617]
- postgresql
- The extract() function, which was slightly improved in
0.5.7, needed a lot more work to generate the correct
typecast (the typecasts appear to be necessary in PG's
EXTRACT quite a lot of the time). The typecast is
now generated using a rule dictionary based
on PG's documentation for date/time/interval arithmetic.
It also accepts text() constructs again, which was broken
in 0.5.7. [ticket:1647]
- firebird
- Recognize more errors as disconnections. [ticket:1646]
0.5.7
=====
- orm
- contains_eager() now works with the automatically
generated subquery that results when you say
"query(Parent).join(Parent.somejoinedsubclass)", i.e.
when Parent joins to a joined-table-inheritance subclass.
Previously contains_eager() would erroneously add the
subclass table to the query separately producing a
cartesian product. An example is in the ticket
description. [ticket:1543]
- query.options() now only propagate to loaded objects
for potential further sub-loads only for options where
such behavior is relevant, keeping
various unserializable options like those generated
by contains_eager() out of individual instance states.
[ticket:1553]
- Session.execute() now locates table- and
mapper-specific binds based on a passed
in expression which is an insert()/update()/delete()
construct. [ticket:1054]
- Session.merge() now properly overwrites a many-to-one or
uselist=False attribute to None if the attribute
is also None in the given object to be merged.
- Fixed a needless select which would occur when merging
transient objects that contained a null primary key
identifier. [ticket:1618]
- Mutable collection passed to the "extension" attribute
of relation(), column_property() etc. will not be mutated
or shared among multiple instrumentation calls, preventing
duplicate extensions, such as backref populators,
from being inserted into the list.
[ticket:1585]
- Fixed the call to get_committed_value() on CompositeProperty.
[ticket:1504]
- Fixed bug where Query would crash if a join() with no clear
"left" side were called when a non-mapped column entity
appeared in the columns list. [ticket:1602]
- Fixed bug whereby composite columns wouldn't load properly
when configured on a joined-table subclass, introduced in
version 0.5.6 as a result of the fix for [ticket:1480].
[ticket:1616] thx to Scott Torborg.
- The "use get" behavior of many-to-one relations, i.e. that a
lazy load will fallback to the possibly cached query.get()
value, now works across join conditions where the two compared
types are not exactly the same class, but share the same
"affinity" - i.e. Integer and SmallInteger. Also allows
combinations of reflected and non-reflected types to work
with 0.5 style type reflection, such as PGText/Text (note 0.6
reflects types as their generic versions). [ticket:1556]
- Fixed bug in query.update() when passing Cls.attribute
as keys in the value dict and using synchronize_session='expire'
('fetch' in 0.6). [ticket:1436]
- sql
- Fixed bug in two-phase transaction whereby commit() method
didn't set the full state which allows subsequent close()
call to succeed. [ticket:1603]
- Fixed the "numeric" paramstyle, which apparently is the
default paramstyle used by Informixdb.
- Repeat expressions in the columns clause of a select
are deduped based on the identity of each clause element,
not the actual string. This allows positional
elements to render correctly even if they all render
identically, such as "qmark" style bind parameters.
[ticket:1574]
- The cursor associated with connection pool connections
(i.e. _CursorFairy) now proxies `__iter__()` to the
underlying cursor correctly. [ticket:1632]
- types now support an "affinity comparison" operation, i.e.
that an Integer/SmallInteger are "compatible", or
a Text/String, PickleType/Binary, etc. Part of
[ticket:1556].
- Fixed bug preventing alias() of an alias() from being
cloned or adapted (occurs frequently in ORM operations).
[ticket:1641]
- sqlite
- sqlite dialect properly generates CREATE INDEX for a table
that is in an alternate schema. [ticket:1439]
- postgresql
- Added support for reflecting the DOUBLE PRECISION type,
via a new postgres.PGDoublePrecision object.
This is postgresql.DOUBLE_PRECISION in 0.6.
[ticket:1085]
- Added support for reflecting the INTERVAL YEAR TO MONTH
and INTERVAL DAY TO SECOND syntaxes of the INTERVAL
type. [ticket:460]
- Corrected the "has_sequence" query to take current schema,
or explicit sequence-stated schema, into account.
[ticket:1576]
- Fixed the behavior of extract() to apply operator
precedence rules to the "::" operator when applying
the "timestamp" cast - ensures proper parenthesization.
[ticket:1611]
- mssql
- Changed the name of TrustedConnection to
Trusted_Connection when constructing pyodbc connect
arguments [ticket:1561]
- oracle
- The "table_names" dialect function, used by MetaData
.reflect(), omits "index overflow tables", a system
table generated by Oracle when "index only tables"
with overflow are used. These tables aren't accessible
via SQL and can't be reflected. [ticket:1637]
- ext
- A column can be added to a joined-table declarative
superclass after the class has been constructed
(i.e. via class-level attribute assignment), and
the column will be propagated down to
subclasses. [ticket:1570] This is the reverse
situation as that of [ticket:1523], fixed in 0.5.6.
- Fixed a slight inaccuracy in the sharding example.
Comparing equivalence of columns in the ORM is best
accomplished using col1.shares_lineage(col2).
[ticket:1491]
- Removed unused `load()` method from ShardedQuery.
[ticket:1606]
0.5.6
=====
- orm
- Fixed bug whereby inheritance discriminator part of a
composite primary key would fail on updates.
Continuation of [ticket:1300].
- Fixed bug which disallowed one side of a many-to-many
bidirectional reference to declare itself as "viewonly"
[ticket:1507]
- Added an assertion that prevents a @validates function
or other AttributeExtension from loading an unloaded
collection such that internal state may be corrupted.
[ticket:1526]
- Fixed bug which prevented two entities from mutually
replacing each other's primary key values within a single
flush() for some orderings of operations. [ticket:1519]
- Fixed an obscure issue whereby a joined-table subclass
with a self-referential eager load on the base class
would populate the related object's "subclass" table with
data from the "subclass" table of the parent.
[ticket:1485]
- relations() now have greater ability to be "overridden",
meaning a subclass that explicitly specifies a relation()
overriding that of the parent class will be honored
during a flush. This is currently to support
many-to-many relations from concrete inheritance setups.
Outside of that use case, YMMV. [ticket:1477]
- Squeezed a few more unnecessary "lazy loads" out of
relation(). When a collection is mutated, many-to-one
backrefs on the other side will not fire off to load
the "old" value, unless "single_parent=True" is set.
A direct assignment of a many-to-one still loads
the "old" value in order to update backref collections
on that value, which may be present in the session
already, thus maintaining the 0.5 behavioral contract.
[ticket:1483]
- Fixed bug whereby a load/refresh of joined table
inheritance attributes which were based on
column_property() or similar would fail to evaluate.
[ticket:1480]
- Improved support for MapperProperty objects overriding
that of an inherited mapper for non-concrete
inheritance setups - attribute extensions won't randomly
collide with each other. [ticket:1488]
- UPDATE and DELETE do not support ORDER BY, LIMIT, OFFSET,
etc. in standard SQL. Query.update() and Query.delete()
now raise an exception if any of limit(), offset(),
order_by(), group_by(), or distinct() have been
called. [ticket:1487]
- Added AttributeExtension to sqlalchemy.orm.__all__
- Improved error message when query() is called with
a non-SQL /entity expression. [ticket:1476]
- Using False or 0 as a polymorphic discriminator now
works on the base class as well as a subclass.
[ticket:1440]
- Added enable_assertions(False) to Query which disables
the usual assertions for expected state - used
by Query subclasses to engineer custom state.
[ticket:1424]. See
http://www.sqlalchemy.org/trac/wiki/UsageRecipes/PreFilteredQuery
for an example.
- Fixed recursion issue which occured if a mapped object's
`__len__()` or `__nonzero__()` method resulted in state
changes. [ticket:1501]
- Fixed incorrect exception raise in
Weak/StrongIdentityMap.add()
[ticket:1506]
- Fixed the error message for "could not find a FROM clause"
in query.join() which would fail to issue correctly
if the query was against a pure SQL construct.
[ticket:1522]
- Fixed a somewhat hypothetical issue which would result
in the wrong primary key being calculated for a mapper
using the old polymorphic_union function - but this
is old stuff. [ticket:1486]
- sql
- Fixed column.copy() to copy defaults and onupdates.
[ticket:1373]
- Fixed a bug in extract() introduced in 0.5.4 whereby
the string "field" argument was getting treated as a
ClauseElement, causing various errors within more
complex SQL transformations.
- Unary expressions such as DISTINCT propagate their
type handling to result sets, allowing conversions like
unicode and such to take place. [ticket:1420]
- Fixed bug in Table and Column whereby passing empty
dict for "info" argument would raise an exception.
[ticket:1482]
- oracle
- Backported 0.6 fix for Oracle alias names not getting
truncated. [ticket:1309]
- ext
- The collection proxies produced by associationproxy are now
pickleable. A user-defined proxy_factory however
is still not pickleable unless it defines __getstate__
and __setstate__. [ticket:1446]
- Declarative will raise an informative exception if
__table_args__ is passed as a tuple with no dict argument.
Improved documentation. [ticket:1468]
- Table objects declared in the MetaData can now be used
in string expressions sent to primaryjoin/secondaryjoin/
secondary - the name is pulled from the MetaData of the
declarative base. [ticket:1527]
- A column can be added to a joined-table subclass after
the class has been constructed (i.e. via class-level
attribute assignment). The column is added to the underlying
Table as always, but now the mapper will rebuild its
"join" to include the new column, instead of raising
an error about "no such column, use column_property()
instead". [ticket:1523]
- test
- Added examples into the test suite so they get exercised
regularly and cleaned up a couple deprecation warnings.
0.5.5
=======
- general
- unit tests have been migrated from unittest to nose. See
README.unittests for information on how to run the tests.
[ticket:970]
- orm
- The "foreign_keys" argument of relation() will now propagate
automatically to the backref in the same way that primaryjoin
and secondaryjoin do. For the extremely rare use case where
the backref of a relation() has intentionally different
"foreign_keys" configured, both sides now need to be
configured explicity (if they do in fact require this setting,
see the next note...).
- ...the only known (and really, really rare) use case where a
different foreign_keys setting was used on the
forwards/backwards side, a composite foreign key that
partially points to its own columns, has been enhanced such
that the fk->itself aspect of the relation won't be used to
determine relation direction.
- Session.mapper is now *deprecated*.
Call session.add() if you'd like a free-standing object to be
part of your session. Otherwise, a DIY version of
Session.mapper is now documented at
http://www.sqlalchemy.org/trac/wiki/UsageRecipes/SessionAwareMapper
The method will remain deprecated throughout 0.6.
- Fixed Query being able to join() from individual columns of a
joined-table subclass entity, i.e. query(SubClass.foo,
SubcClass.bar).join(<anything>). In most cases, an error
"Could not find a FROM clause to join from" would be
raised. In a few others, the result would be returned in terms
of the base class rather than the subclass - so applications
which relied on this erroneous result need to be
adjusted. [ticket:1431]
- Fixed a bug involving contains_eager(), which would apply
itself to a secondary (i.e. lazy) load in a particular rare
case, producing cartesian products. improved the targeting of
query.options() on secondary loads overall [ticket:1461].
- Fixed bug introduced in 0.5.4 whereby Composite types fail
when default-holding columns are flushed.
- Fixed another 0.5.4 bug whereby mutable attributes
(i.e. PickleType) wouldn't be deserialized correctly when the
whole object was serialized. [ticket:1426]
- Fixed bug whereby session.is_modified() would raise an
exception if any synonyms were in use.
- Fixed potential memory leak whereby previously pickled objects
placed back in a session would not be fully garbage collected
unless the Session were explicitly closed out.
- Fixed bug whereby list-based attributes, like pickletype and
PGArray, failed to be merged() properly.
- Repaired non-working attributes.set_committed_value function.
- Trimmed the pickle format for InstanceState which should
further reduce the memory footprint of pickled instances. The
format should be backwards compatible with that of 0.5.4 and
previous.
- sqlalchemy.orm.join and sqlalchemy.orm.outerjoin are now
added to __all__ in sqlalchemy.orm.*. [ticket:1463]
- Fixed bug where Query exception raise would fail when
a too-short composite primary key value were passed to
get(). [ticket:1458]
- sql
- Removed an obscure feature of execute() (including connection,
engine, Session) whereby a bindparam() construct can be sent
as a key to the params dictionary. This usage is undocumented
and is at the core of an issue whereby the bindparam() object
created implicitly by a text() construct may have the same
hash value as a string placed in the params dictionary and may
result in an inappropriate match when computing the final bind
parameters. Internal checks for this condition would add
significant latency to the critical task of parameter
rendering, so the behavior is removed. This is a backwards
incompatible change for any application that may have been
using this feature, however the feature has never been
documented.
- engine/pool
- Implemented recreate() for StaticPool.
0.5.4p2
=======
- sql
- Repaired the printing of SQL exceptions which are not
based on parameters or are not executemany() style.
- postgresql
- Deprecated the hardcoded TIMESTAMP function, which when
used as func.TIMESTAMP(value) would render "TIMESTAMP value".
This breaks on some platforms as PostgreSQL doesn't allow
bind parameters to be used in this context. The hard-coded
uppercase is also inappropriate and there's lots of other
PG casts that we'd need to support. So instead, use
text constructs i.e. select(["timestamp '12/05/09'"]).
0.5.4p1
=======
- orm
- Fixed an attribute error introduced in 0.5.4 which would
occur when merge() was used with an incomplete object.
0.5.4
=====
- orm
- Significant performance enhancements regarding Sessions/flush()
in conjunction with large mapper graphs, large numbers of
objects:
- Removed all* O(N) scanning behavior from the flush() process,
i.e. operations that were scanning the full session,
including an extremely expensive one that was erroneously
assuming primary key values were changing when this
was not the case.
* one edge case remains which may invoke a full scan,
if an existing primary key attribute is modified
to a new value.
- The Session's "weak referencing" behavior is now *full* -
no strong references whatsoever are made to a mapped object
or related items/collections in its __dict__. Backrefs and
other cycles in objects no longer affect the Session's ability
to lose all references to unmodified objects. Objects with
pending changes still are maintained strongly until flush.
[ticket:1398]
The implementation also improves performance by moving
the "resurrection" process of garbage collected items
to only be relevant for mappings that map "mutable"
attributes (i.e. PickleType, composite attrs). This removes
overhead from the gc process and simplifies internal
behavior.
If a "mutable" attribute change is the sole change on an object
which is then dereferenced, the mapper will not have access to
other attribute state when the UPDATE is issued. This may present
itself differently to some MapperExtensions.
The change also affects the internal attribute API, but not
the AttributeExtension interface nor any of the publically
documented attribute functions.
- The unit of work no longer genererates a graph of "dependency"
processors for the full graph of mappers during flush(), instead
creating such processors only for those mappers which represent
objects with pending changes. This saves a tremendous number
of method calls in the context of a large interconnected
graph of mappers.
- Cached a wasteful "table sort" operation that previously
occured multiple times per flush, also removing significant
method call count from flush().
- Other redundant behaviors have been simplified in
mapper._save_obj().
- Modified query_cls on DynamicAttributeImpl to accept a full
mixin version of the AppenderQuery, which allows subclassing
the AppenderMixin.
- The "polymorphic discriminator" column may be part of a
primary key, and it will be populated with the correct
discriminator value. [ticket:1300]
- Fixed the evaluator not being able to evaluate IS NULL clauses.
- Fixed the "set collection" function on "dynamic" relations to
initiate events correctly. Previously a collection could only
be assigned to a pending parent instance, otherwise modified
events would not be fired correctly. Set collection is now
compatible with merge(), fixes [ticket:1352].
- Allowed pickling of PropertyOption objects constructed with
instrumented descriptors; previously, pickle errors would occur
when pickling an object which was loaded with a descriptor-based
option, such as query.options(eagerload(MyClass.foo)).
- Lazy loader will not use get() if the "lazy load" SQL clause
matches the clause used by get(), but contains some parameters
hardcoded. Previously the lazy strategy would fail with the
get(). Ideally get() would be used with the hardcoded
parameters but this would require further development.
[ticket:1357]
- MapperOptions and other state associated with query.options()
is no longer bundled within callables associated with each
lazy/deferred-loading attribute during a load.
The options are now associated with the instance's
state object just once when it's populated. This removes
the need in most cases for per-instance/attribute loader
objects, improving load speed and memory overhead for
individual instances. [ticket:1391]
- Fixed another location where autoflush was interfering
with session.merge(). autoflush is disabled completely
for the duration of merge() now. [ticket:1360]
- Fixed bug which prevented "mutable primary key" dependency
logic from functioning properly on a one-to-one
relation(). [ticket:1406]
- Fixed bug in relation(), introduced in 0.5.3,
whereby a self referential relation
from a base class to a joined-table subclass would
not configure correctly.
- Fixed obscure mapper compilation issue when inheriting
mappers are used which would result in un-initialized
attributes.
- Fixed documentation for session weak_identity_map -
the default value is True, indicating a weak
referencing map in use.
- Fixed a unit of work issue whereby the foreign
key attribute on an item contained within a collection
owned by an object being deleted would not be set to
None if the relation() was self-referential. [ticket:1376]
- Fixed Query.update() and Query.delete() failures with eagerloaded
relations. [ticket:1378]
- It is now an error to specify both columns of a binary primaryjoin
condition in the foreign_keys or remote_side collection. Whereas
previously it was just nonsensical, but would succeed in a
non-deterministic way.
- schema
- Added a quote_schema() method to the IdentifierPreparer class
so that dialects can override how schemas get handled. This
enables the MSSQL dialect to treat schemas as multipart
identifiers, such as 'database.owner'. [ticket: 594, 1341]
- sql
- Back-ported the "compiler" extension from SQLA 0.6. This
is a standardized interface which allows the creation of custom
ClauseElement subclasses and compilers. In particular it's
handy as an alternative to text() when you'd like to
build a construct that has database-specific compilations.
See the extension docs for details.
- Exception messages are truncated when the list of bound
parameters is larger than 10, preventing enormous
multi-page exceptions from filling up screens and logfiles
for large executemany() statements. [ticket:1413]
- ``sqlalchemy.extract()`` is now dialect sensitive and can
extract components of timestamps idiomatically across the
supported databases, including SQLite.
- Fixed __repr__() and other _get_colspec() methods on
ForeignKey constructed from __clause_element__() style
construct (i.e. declarative columns). [ticket:1353]
- mysql
- Reflecting a FOREIGN KEY construct will take into account
a dotted schema.tablename combination, if the foreign key
references a table in a remote schema. [ticket:1405]
- mssql
- Modified how savepoint logic works to prevent it from
stepping on non-savepoint oriented routines. Savepoint
support is still very experimental.
- Added in reserved words for MSSQL that covers version 2008
and all prior versions. [ticket:1310]
- Corrected problem with information schema not working with a
binary collation based database. Cleaned up information schema
since it is only used by mssql now. [ticket:1343]
- sqlite
- Corrected the SLBoolean type so that it properly treats only 1
as True. [ticket:1402]
- Corrected the float type so that it correctly maps to a
SLFloat type when being reflected. [ticket:1273]
- extensions
- Fixed adding of deferred or other column properties to a
declarative class. [ticket:1379]
0.5.3
=====
- orm
- The "objects" argument to session.flush() is deprecated.
State which represents the linkage between a parent and
child object does not support "flushed" status on
one side of the link and not the other, so supporting
this operation leads to misleading results.
[ticket:1315]
- Query now implements __clause_element__() which produces
its selectable, which means a Query instance can be accepted
in many SQL expressions, including col.in_(query),
union(query1, query2), select([foo]).select_from(query),
etc.
- Query.join() can now construct multiple FROM clauses, if
needed. Such as, query(A, B).join(A.x).join(B.y)
might say SELECT A.*, B.* FROM A JOIN X, B JOIN Y.
Eager loading can also tack its joins onto those
multiple FROM clauses. [ticket:1337]
- Fixed bug in dynamic_loader() where append/remove events
after construction time were not being propagated to the
UOW to pick up on flush(). [ticket:1347]
- Fixed bug where column_prefix wasn't being checked before
not mapping an attribute that already had class-level
name present.
- a session.expire() on a particular collection attribute
will clear any pending backref additions as well, so that
the next access correctly returns only what was present
in the database. Presents some degree of a workaround for
[ticket:1315], although we are considering removing the
flush([objects]) feature altogether.
- Session.scalar() now converts raw SQL strings to text()
the same way Session.execute() does and accepts same
alternative **kw args.
- improvements to the "determine direction" logic of
relation() such that the direction of tricky situations
like mapper(A.join(B)) -> relation-> mapper(B) can be
determined.
- When flushing partial sets of objects using session.flush([somelist]),
pending objects which remain pending after the operation won't
inadvertently be added as persistent. [ticket:1306]
- Added "post_configure_attribute" method to InstrumentationManager,
so that the "listen_for_events.py" example works again.
[ticket:1314]
- a forward and complementing backwards reference which are both
of the same direction, i.e. ONETOMANY or MANYTOONE,
is now detected, and an error message is raised.
Saves crazy CircularDependencyErrors later on.
- Fixed bugs in Query regarding simultaneous selection of
multiple joined-table inheritance entities with common base
classes:
- previously the adaption applied to "B" on
"A JOIN B" would be erroneously partially applied
to "A".
- comparisons on relations (i.e. A.related==someb)
were not getting adapted when they should.
- Other filterings, like
query(A).join(A.bs).filter(B.foo=='bar'), were erroneously
adapting "B.foo" as though it were an "A".
- Fixed adaptation of EXISTS clauses via any(), has(), etc.
in conjunction with an aliased object on the left and
of_type() on the right. [ticket:1325]
- Added an attribute helper method ``set_committed_value`` in
sqlalchemy.orm.attributes. Given an object, attribute name,
and value, will set the value on the object as part of its
"committed" state, i.e. state that is understood to have
been loaded from the database. Helps with the creation of
homegrown collection loaders and such.
- Query won't fail with weakref error when a non-mapper/class
instrumented descriptor is passed, raises
"Invalid column expession".
- Query.group_by() properly takes into account aliasing applied
to the FROM clause, such as with select_from(), using
with_polymorphic(), or using from_self().
- sql
- An alias() of a select() will convert to a "scalar subquery"
when used in an unambiguously scalar context, i.e. it's used
in a comparison operation. This applies to
the ORM when using query.subquery() as well.
- Fixed missing _label attribute on Function object, others
when used in a select() with use_labels (such as when used
in an ORM column_property()). [ticket:1302]
- anonymous alias names now truncate down to the max length
allowed by the dialect. More significant on DBs like
Oracle with very small character limits. [ticket:1309]
- the __selectable__() interface has been replaced entirely
by __clause_element__().
- The per-dialect cache used by TypeEngine to cache
dialect-specific types is now a WeakKeyDictionary.
This to prevent dialect objects from
being referenced forever for an application that
creates an arbitrarily large number of engines
or dialects. There is a small performance penalty
which will be resolved in 0.6. [ticket:1299]
- sqlite
- Fixed SQLite reflection methods so that non-present
cursor.description, which triggers an auto-cursor
close, will be detected so that no results doesn't
fail on recent versions of pysqlite which raise
an error when fetchone() called with no rows present.
- postgresql
- Index reflection won't fail when an index with
multiple expressions is encountered.
- Added PGUuid and PGBit types to
sqlalchemy.databases.postgres. [ticket:1327]
- Refection of unknown PG types won't crash when those
types are specified within a domain. [ticket:1327]
- mssql
- Preliminary support for pymssql 1.0.1
- Corrected issue on mssql where max_identifier_length was
not being respected.
- extensions
- Fixed a recursive pickling issue in serializer, triggered
by an EXISTS or other embedded FROM construct.
- Declarative locates the "inherits" class using a search
through __bases__, to skip over mixins that are local
to subclasses.
- Declarative figures out joined-table inheritance primary join
condition even if "inherits" mapper argument is given
explicitly.
- Declarative will properly interpret the "foreign_keys" argument
on a backref() if it's a string.
- Declarative will accept a table-bound column as a property
when used in conjunction with __table__, if the column is already
present in __table__. The column will be remapped to the given
key the same way as when added to the mapper() properties dict.
0.5.2
======
- orm
- Further refined 0.5.1's warning about delete-orphan cascade
placed on a many-to-many relation. First, the bad news:
the warning will apply to both many-to-many as well as
many-to-one relations. This is necessary since in both
cases, SQLA does not scan the full set of potential parents
when determining "orphan" status - for a persistent object
it only detects an in-python de-association event to establish
the object as an "orphan". Next, the good news: to support
one-to-one via a foreign key or assocation table, or to
support one-to-many via an association table, a new flag
single_parent=True may be set which indicates objects
linked to the relation are only meant to have a single parent.
The relation will raise an error if multiple parent-association
events occur within Python.
- Adjusted the attribute instrumentation change from 0.5.1 to
fully establish instrumentation for subclasses where the mapper
was created after the superclass had already been fully
instrumented. [ticket:1292]
- Fixed bug in delete-orphan cascade whereby two one-to-one
relations from two different parent classes to the same target
class would prematurely expunge the instance.
- Fixed an eager loading bug whereby self-referential eager
loading would prevent other eager loads, self referential or not,
from joining to the parent JOIN properly. Thanks to Alex K
for creating a great test case.
- session.expire() and related methods will not expire() unloaded
deferred attributes. This prevents them from being needlessly
loaded when the instance is refreshed.
- query.join()/outerjoin() will now properly join an aliased()
construct to the existing left side, even if query.from_self()
or query.select_from(someselectable) has been called.
[ticket:1293]
- sql
- Further fixes to the "percent signs and spaces in column/table
names" functionality. [ticket:1284]
- mssql
- Restored convert_unicode handling. Results were being passed
on through without conversion. [ticket:1291]
- Really fixing the decimal handling this time. [ticket:1282].
- Modified table reflection code to use only kwargs when
constructing tables. [Ticket:1289]
0.5.1
========
- orm
- Removed an internal join cache which could potentially leak
memory when issuing query.join() repeatedly to ad-hoc
selectables.
- The "clear()", "save()", "update()", "save_or_update()"
Session methods have been deprecated, replaced by
"expunge_all()" and "add()". "expunge_all()" has also
been added to ScopedSession.
- Modernized the "no mapped table" exception and added a more
explicit __table__/__tablename__ exception to declarative.
- Concrete inheriting mappers now instrument attributes which
are inherited from the superclass, but are not defined for
the concrete mapper itself, with an InstrumentedAttribute that
issues a descriptive error when accessed. [ticket:1237]
- Added a new `relation()` keyword `back_populates`. This
allows configuation of backreferences using explicit
relations. [ticket:781] This is required when creating
bidirectional relations between a hierarchy of concrete
mappers and another class. [ticket:1237]
- Test coverage added for `relation()` objects specified on
concrete mappers. [ticket:1237]
- Query.from_self() as well as query.subquery() both disable
the rendering of eager joins inside the subquery produced.
The "disable all eager joins" feature is available publically
via a new query.enable_eagerloads() generative. [ticket:1276]
- Added a rudimental series of set operations to Query that
receive Query objects as arguments, including union(),
union_all(), intersect(), except_(), insertsect_all(),
except_all(). See the API documentation for
Query.union() for examples.
- Fixed bug that prevented Query.join() and eagerloads from
attaching to a query that selected from a union or aliased union.
- A short documentation example added for bidirectional
relations specified on concrete mappers. [ticket:1237]
- Mappers now instrument class attributes upon construction
with the final InstrumentedAttribute object which remains
persistent. The `_CompileOnAttr`/`__getattribute__()`
methodology has been removed. The net effect is that
Column-based mapped class attributes can now be used fully
at the class level without invoking a mapper compilation
operation, greatly simplifying typical usage patterns
within declarative. [ticket:1269]
- ColumnProperty (and front-end helpers such as ``deferred``) no
longer ignores unknown **keyword arguments.
- Fixed a bug with the unitofwork's "row switch" mechanism,
i.e. the conversion of INSERT/DELETE into an UPDATE, when
combined with joined-table inheritance and an object
which contained no defined values for the child table where
an UPDATE with no SET clause would be rendered.
- Using delete-orphan on a many-to-many relation is deprecated.
This produces misleading or erroneous results since SQLA does
not retrieve the full list of "parents" for m2m. To get delete-orphan
behavior with an m2m table, use an explcit association class
so that the individual association row is treated as a parent.
[ticket:1281]
- delete-orphan cascade always requires delete cascade. Specifying
delete-orphan without delete now raises a deprecation warning.
[ticket:1281]
- sql
- Improved the methodology to handling percent signs in column
names from [ticket:1256]. Added more tests. MySQL and
PostgreSQL dialects still do not issue correct CREATE TABLE
statements for identifiers with percent signs in them.
- schema
- Index now accepts column-oriented InstrumentedAttributes
(i.e. column-based mapped class attributes) as column
arguments. [ticket:1214]
- Column with no name (as in declarative) won't raise a
NoneType error when it's string output is requsted
(such as in a stack trace).
- Fixed bug when overriding a Column with a ForeignKey
on a reflected table, where derived columns (i.e. the
"virtual" columns of a select, etc.) would inadvertently
call upon schema-level cleanup logic intended only
for the original column. [ticket:1278]
- declarative
- Can now specify Column objects on subclasses which have no
table of their own (i.e. use single table inheritance).
The columns will be appended to the base table, but only
mapped by the subclass.
- For both joined and single inheriting subclasses, the subclass
will only map those columns which are already mapped on the
superclass and those explicit on the subclass. Other
columns that are present on the `Table` will be excluded
from the mapping by default, which can be disabled
by passing a blank `exclude_properties` collection to the
`__mapper_args__`. This is so that single-inheriting
classes which define their own columns are the only classes
to map those columns. The effect is actually a more organized
mapping than you'd normally get with explicit `mapper()`
calls unless you set up the `exclude_properties` arguments
explicitly.
- It's an error to add new Column objects to a declarative class
that specified an existing table using __table__.
- mysql
- Added the missing keywords from MySQL 4.1 so they get escaped
properly.
- mssql
- Corrected handling of large decimal values with more robust
tests. Removed string manipulation on floats. [ticket:1280]
- Modified the do_begin handling in mssql to use the Cursor not
the Connection so it is DBAPI compatible.
- Corrected SAVEPOINT support on adodbapi by changing the
handling of savepoint_release, which is unsupported on mssql.
0.5.0
========
- new features
- general
- Documentation has been converted to Sphinx. In particular,
the generated API documentation has been constructed into a
full blown "API Reference" section which organizes editorial
documentation combined with generated docstrings. Cross
linking between sections and API docs are vastly improved, a
javascript-powered search feature is provided, and a full
index of all classes, functions and members is provided.
- setup.py now imports setuptools only optionally. If not