9
:released: Sun Oct 12 2008
15
Fixed bug regarding inherit_condition passed
16
with "A=B" versus "B=A" leading to errors
22
Changes made to new, dirty and deleted
24
SessionExtension.before_flush() will take
25
effect for that flush.
31
Added label() method to InstrumentedAttribute
32
to establish forwards compatibility with 0.5.
38
column.in_(someselect) can now be used as
39
a columns-clause expression without the subquery
40
bleeding into the FROM clause
46
Added MSMediumInteger type.
52
Supplied a custom strftime() function which
53
handles dates before 1900.
59
String's (and Unicode's, UnicodeText's, etc.)
60
convert_unicode logic disabled in the sqlite dialect,
61
to adjust for pysqlite 2.5.0's new requirement that
62
only Python unicode objects are accepted;
63
http://itsystementwicklung.de/pipermail/list-pysqlite/2008-March/000018.html
69
has_sequence() now takes schema name into account
75
added BFILE to the list of reflected types
79
:released: Thu Jul 31 2008
85
Added "add()" and "add_all()" to scoped_session
86
methods. Workaround for 0.4.7:
88
from sqlalchemy.orm.scoping import ScopedSession,\
91
ScopedSession, "add", instrument("add"))
93
ScopedSession, "add_all", instrument("add_all"))
99
Fixed non-2.3 compatible usage of set() and generator
100
expression within relation().
104
:released: Sat Jul 26 2008
110
The contains() operator when used with many-to-many
111
will alias() the secondary (association) table so
112
that multiple contains() calls will not conflict
119
fixed bug preventing merge() from functioning in
120
conjunction with a comparable_property()
126
the enable_typechecks=False setting on relation()
127
now only allows subtypes with inheriting mappers.
128
Totally unrelated types, or subtypes not set up with
129
mapper inheritance against the target mapper are
136
Added is_active flag to Sessions to detect when
137
a transaction is in progress. This
138
flag is always True with a "transactional"
139
(in 0.5 a non-"autocommit") Session.
145
Fixed bug when calling select([literal('foo')])
146
or select([bindparam('foo')]).
152
create_all(), drop_all(), create(), drop() all raise
153
an error if the table name or schema name contains
154
more characters than that dialect's configured
155
character limit. Some DB's can handle too-long
156
table names during usage, and SQLA can handle this
157
as well. But various reflection/
158
checkfirst-during-create scenarios fail since we are
159
looking for the name within the DB's catalog tables.
165
The index name generated when you say "index=True"
166
on a Column is truncated to the length appropriate
167
for the dialect. Additionally, an Index with a too-
168
long name cannot be explicitly dropped with
169
Index.drop(), similar to.
175
Repaired server_side_cursors to properly detect
188
Added 'CALL' to the list of SQL keywords which return
195
Oracle get_default_schema_name() "normalizes" the name
196
before returning, meaning it returns a lower-case name
197
when the identifier is detected as case insensitive.
203
creating/dropping tables takes schema name into account
204
when searching for the existing table, so that tables
205
in other owner namespaces with the same name do not
212
Cursors now have "arraysize" set to 50 by default on
213
them, the value of which is configurable using the
214
"arraysize" argument to create_engine() with the
215
Oracle dialect. This to account for cx_oracle's default
216
setting of "1", which has the effect of many round trips
217
being sent to Oracle. This actually works well in
218
conjunction with BLOB/CLOB-bound cursors, of which
219
there are any number available but only for the life of
220
that row request (so BufferedColumnRow is still needed,
228
- add SLFloat type, which matches the SQLite REAL
229
type affinity. Previously, only SLNumeric was provided
230
which fulfills NUMERIC affinity, but that's not the
235
:released: Sat May 10 2008
241
Fix to the recent relation() refactoring which fixes
242
exotic viewonly relations which join between local and
243
remote table multiple times, with a common column shared
250
Also re-established viewonly relation() configurations
251
that join across multiple tables.
257
Added experimental relation() flag to help with
258
primaryjoins across functions, etc.,
259
_local_remote_pairs=[tuples]. This complements a complex
260
primaryjoin condition allowing you to provide the
261
individual column pairs which comprise the relation's
262
local and remote sides. Also improved lazy load SQL
263
generation to handle placing bind params inside of
264
functions and other expressions. (partial progress
271
repaired single table inheritance such that you
272
can single-table inherit from a joined-table inherting
273
mapper without issue.
279
Fixed "concatenate tuple" bug which could occur with
280
Query.order_by() if clause adaption had taken place.
286
Removed ancient assertion that mapped selectables require
287
"alias names" - the mapper creates its own alias now if
288
none is present. Though in this case you need to use the
289
class, not the mapped selectable, as the source of column
290
attributes - so a warning is still issued.
296
fixes to the "exists" function involving inheritance (any(),
297
has(), ~contains()); the full target join will be rendered
298
into the EXISTS clause for relations that link to subclasses.
304
restored usage of append_result() extension method for primary
305
query rows, when the extension is present and only a single-
306
entity result is being returned.
312
Also re-established viewonly relation() configurations that
313
join across multiple tables.
319
removed ancient assertion that mapped selectables require
320
"alias names" - the mapper creates its own alias now if
321
none is present. Though in this case you need to use
322
the class, not the mapped selectable, as the source of
323
column attributes - so a warning is still issued.
329
refined mapper._save_obj() which was unnecessarily calling
330
__ne__() on scalar values during flush
336
added a feature to eager loading whereby subqueries set
337
as column_property() with explicit label names (which is not
338
necessary, btw) will have the label anonymized when
339
the instance is part of the eager join, to prevent
340
conflicts with a subquery or column of the same name
341
on the parent object.
347
set-based collections |=, -=, ^= and &= are stricter about
348
their operands and only operate on sets, frozensets or
349
subclasses of the collection type. Previously, they would
350
accept any duck-typed set.
356
added an example dynamic_dict/dynamic_dict.py, illustrating
357
a simple way to place dictionary behavior on top of
361
:tags: declarative, extension
364
Joined table inheritance mappers use a slightly relaxed
365
function to create the "inherit condition" to the parent
366
table, so that other foreign keys to not-yet-declared
367
Table objects don't trigger an error.
370
:tags: declarative, extension
373
fixed reentrant mapper compile hang when
374
a declared attribute is used within ForeignKey,
375
ie. ForeignKey(MyOtherClass.someattribute)
381
Added COLLATE support via the .collate(<collation>)
382
expression operator and collate(<expr>, <collation>) sql
389
Fixed bug with union() when applied to non-Table connected
396
improved behavior of text() expressions when used as
397
FROM clauses, such as select().select_from(text("sometext"))
403
Column.copy() respects the value of "autoincrement",
404
fixes usage with Migrate
410
Pool listeners can now be provided as a dictionary of
411
callables or a (possibly partial) duck-type of
412
PoolListener, your choice.
418
added "rollback_returned" option to Pool which will
419
disable the rollback() issued when connections are
420
returned. This flag is only safe to use with a database
421
which does not support transactions (i.e. MySQL/MyISAM).
427
set-based association proxies |=, -=, ^= and &= are
428
stricter about their operands and only operate on sets,
429
frozensets or other association proxies. Previously, they
430
would accept any duck-typed set.
436
Added "odbc_autotranslate" parameter to engine / dburi
437
parameters. Any given string will be passed through to the
438
ODBC connection string as:
440
"AutoTranslate=%s" % odbc_autotranslate
446
Added "odbc_options" parameter to engine / dburi
447
parameters. The given string is simply appended to the
448
SQLAlchemy-generated odbc connection string.
450
This should obviate the need of adding a myriad of ODBC
451
options in the future.
457
Handle the "SUBSTRING(:string FROM :start FOR :length)"
462
:released: Fri Apr 04 2008
468
A small change in behavior to session.merge() - existing
469
objects are checked for based on primary key attributes, not
470
necessarily _instance_key. So the widely requested
476
will in fact load MyObject with id #1 from the database if
477
present, is now available. merge() still copies the state
478
of the given object to the persistent one, so an example
479
like the above would typically have copied "None" from all
480
attributes of "x" onto the persistent copy. These can be
481
reverted using session.expire(x).
487
Also fixed behavior in merge() whereby collection elements
488
present on the destination but not the merged collection
489
were not being removed from the destination.
495
Added a more aggressive check for "uncompiled mappers",
496
helps particularly with declarative layer
502
The methodology behind "primaryjoin"/"secondaryjoin" has
503
been refactored. Behavior should be slightly more
504
intelligent, primarily in terms of error messages which
505
have been pared down to be more readable. In a slight
506
number of scenarios it can better resolve the correct
507
foreign key than before.
513
Added comparable_property(), adds query Comparator
514
behavior to regular, unmanaged Python properties
517
:tags: orm, Company.employees.of_type(Engineer), 'machines'
520
the functionality of query.with_polymorphic() has
521
been added to mapper() as a configuration option.
523
It's set via several forms:
525
with_polymorphic=[mappers]
526
with_polymorphic=('*', selectable)
527
with_polymorphic=([mappers], selectable)
529
This controls the default polymorphic loading strategy
530
for inherited mappers. When a selectable is not given,
531
outer joins are created for all joined-table inheriting
532
mappers requested. Note that the auto-create of joins
533
is not compatible with concrete table inheritance.
535
The existing select_table flag on mapper() is now
536
deprecated and is synonymous with
537
with_polymorphic('*', select_table). Note that the
538
underlying "guts" of select_table have been
539
completely removed and replaced with the newer,
540
more flexible approach.
542
The new approach also automatically allows eager loads
543
to work for subclasses, if they are present, for
545
sess.query(Company).options(
549
to load Company objects, their employees, and the
550
'machines' collection of employees who happen to be
551
Engineers. A "with_polymorphic" Query option should be
552
introduced soon as well which would allow per-Query
553
control of with_polymorphic() on relations.
559
added two "experimental" features to Query,
560
"experimental" in that their specific name/behavior
561
is not carved in stone just yet: _values() and
562
_from_self(). We'd like feedback on these.
564
- _values(*columns) is given a list of column
565
expressions, and returns a new Query that only
566
returns those columns. When evaluated, the return
567
value is a list of tuples just like when using
568
add_column() or add_entity(), the only difference is
569
that "entity zero", i.e. the mapped class, is not
570
included in the results. This means it finally makes
571
sense to use group_by() and having() on Query, which
572
have been sitting around uselessly until now.
574
A future change to this method may include that its
575
ability to join, filter and allow other options not
576
related to a "resultset" are removed, so the feedback
577
we're looking for is how people want to use
578
_values()...i.e. at the very end, or do people prefer
579
to continue generating after it's called.
581
- _from_self() compiles the SELECT statement for the
582
Query (minus any eager loaders), and returns a new
583
Query that selects from that SELECT. So basically you
584
can query from a Query without needing to extract the
585
SELECT statement manually. This gives meaning to
586
operations like query[3:5]._from_self().filter(some
587
criterion). There's not much controversial here
588
except that you can quickly create highly nested
589
queries that are less efficient, and we want feedback
590
on the naming choice.
596
query.order_by() and query.group_by() will accept
597
multiple arguments using *args (like select()
604
Added some convenience descriptors to Query:
605
query.statement returns the full SELECT construct,
606
query.whereclause returns just the WHERE part of the
613
Fixed/covered case when using a False/0 value as a
614
polymorphic discriminator.
620
Fixed bug which was preventing synonym() attributes from
621
being used with inheritance
627
Fixed SQL function truncation of trailing underscores
633
When attributes are expired on a pending instance, an
634
error will not be raised when the "refresh" action is
635
triggered and no result is found.
641
Session.execute can now find binds from metadata
647
Adjusted the definition of "self-referential" to be any
648
two mappers with a common parent (this affects whether or
649
not aliased=True is required when joining with Query).
655
Made some fixes to the "from_joinpoint" argument to
656
query.join() so that if the previous join was aliased and
657
this one isn't, the join still happens successfully.
663
Assorted "cascade deletes" fixes:
664
- Fixed "cascade delete" operation of dynamic relations,
665
which had only been implemented for foreign-key
666
nulling behavior in 0.4.2 and not actual cascading
669
- Delete cascade without delete-orphan cascade on a
670
many-to-one will not delete orphans which were
671
disconnected from the parent before session.delete()
672
is called on the parent (one-to-many already had
675
- Delete cascade with delete-orphan will delete orphans
676
whether or not it remains attached to its also-deleted
679
- delete-orphan casacde is properly detected on relations
680
that are present on superclasses when using inheritance.
686
Fixed order_by calculation in Query to properly alias
687
mapper-config'ed order_by when using select_from()
693
Refactored the diffing logic that kicks in when replacing
694
one collection with another into collections.bulk_replace,
695
useful to anyone building multi-level collections.
701
Cascade traversal algorithm converted from recursive to
702
iterative to support deep object graphs.
708
schema-qualified tables now will place the schemaname
709
ahead of the tablename in all column expressions as well
710
as when generating column labels. This prevents cross-
711
schema name collisions in all cases
717
can now allow selects which correlate all FROM clauses
718
and have no FROM themselves. These are typically
719
used in a scalar context, i.e. SELECT x, (SELECT x WHERE y)
720
FROM table. Requires explicit correlate() call.
726
'name' is no longer a required constructor argument for
727
Column(). It (and .key) may now be deferred until the
728
column is added to a Table.
734
like(), ilike(), contains(), startswith(), endswith() take
735
an optional keyword argument "escape=<somestring>", which
736
is set as the escape character using the syntax "x LIKE y
737
ESCAPE '<somestring>'".
743
random() is now a generic sql function and will compile to
744
the database's random implementation, if any.
750
update().values() and insert().values() take keyword
757
Fixed an issue in select() regarding its generation of
758
FROM clauses, in rare circumstances two clauses could be
759
produced when one was intended to cancel out the other.
760
Some ORM queries with lots of eager loads might have seen
767
The case() function now also takes a dictionary as its
768
whens parameter. It also interprets the "THEN"
769
expressions as values by default, meaning case([(x==y,
770
"foo")]) will interpret "foo" as a bound value, not a SQL
771
expression. use text(expr) for literal SQL expressions in
772
this case. For the criterion itself, these may be literal
773
strings only if the "value" keyword is present, otherwise
774
SA will force explicit usage of either text() or
781
The "owner" keyword on Table is now deprecated, and is
782
exactly synonymous with the "schema" keyword. Tables can
783
now be reflected with alternate "owner" attributes,
784
explicitly stated on the Table object or not using
791
All of the "magic" searching for synonyms, DBLINKs etc.
792
during table reflection are disabled by default unless you
793
specify "oracle_resolve_synonyms=True" on the Table
794
object. Resolving synonyms necessarily leads to some
795
messy guessing which we'd rather leave off by default.
796
When the flag is set, tables and related tables will be
797
resolved against synonyms in all cases, meaning if a
798
synonym exists for a particular table, reflection will use
799
it when reflecting related tables. This is stickier
800
behavior than before which is why it's off by default.
803
:tags: declarative, extension
806
The "synonym" function is now directly usable with
807
"declarative". Pass in the decorated property using the
808
"descriptor" keyword argument, e.g.: somekey =
809
synonym('_somekey', descriptor=property(g, s))
812
:tags: declarative, extension
815
The "deferred" function is usable with "declarative".
816
Simplest usage is to declare deferred and Column together,
817
e.g.: data = deferred(Column(Text))
820
:tags: declarative, extension
823
Declarative also gained @synonym_for(...) and
824
@comparable_using(...), front-ends for synonym and
828
:tags: declarative, extension
831
Improvements to mapper compilation when using declarative;
832
already-compiled mappers will still trigger compiles of
833
other uncompiled mappers when used
836
:tags: declarative, extension
839
Declarative will complete setup for Columns lacking names,
840
allows a more DRY syntax.
843
__tablename__ = 'foos'
844
id = Column(Integer, primary_key=True)
847
:tags: declarative, extension
850
inheritance in declarative can be disabled when sending
851
"inherits=None" to __mapper_args__.
854
:tags: declarative, extension
857
declarative_base() takes optional kwarg "mapper", which
858
is any callable/class/method that produces a mapper,
859
such as declarative_base(mapper=scopedsession.mapper).
860
This property can also be set on individual declarative
861
classes using the "__mapper_cls__" property.
867
Got PG server side cursors back into shape, added fixed
868
unit tests as part of the default test suite. Added
869
better uniqueness to the cursor ID
875
The "owner" keyword on Table is now deprecated, and is
876
exactly synonymous with the "schema" keyword. Tables can
877
now be reflected with alternate "owner" attributes,
878
explicitly stated on the Table object or not using
885
All of the "magic" searching for synonyms, DBLINKs etc.
886
during table reflection are disabled by default unless you
887
specify "oracle_resolve_synonyms=True" on the Table
888
object. Resolving synonyms necessarily leads to some
889
messy guessing which we'd rather leave off by default.
890
When the flag is set, tables and related tables will be
891
resolved against synonyms in all cases, meaning if a
892
synonym exists for a particular table, reflection will use
893
it when reflecting related tables. This is stickier
894
behavior than before which is why it's off by default.
900
Reflected tables will now automatically load other tables
901
which are referenced by Foreign keys in the auto-loaded
908
Added executemany check to skip identity fetch,.
914
Added stubs for small date type.
920
Added a new 'driver' keyword parameter for the pyodbc dialect.
921
Will substitute into the ODBC connection string if given,
922
defaults to 'SQL Server'.
928
Added a new 'max_identifier_length' keyword parameter for
935
Improvements to pyodbc + Unix. If you couldn't get that
936
combination to work before, please try again.
942
The connection.info keys the dialect uses to cache server
943
settings have changed and are now namespaced.
947
:released: Wed Mar 12 2008
953
Can again create aliases of selects against textual FROM
960
The value of a bindparam() can be a callable, in which
961
case it's evaluated at statement execution time to get the
968
Added exception wrapping/reconnect support to result set
969
fetching. Reconnect works for those databases that raise
970
a catchable data error during results (i.e. doesn't work
977
Implemented two-phase API for "threadlocal" engine, via
978
engine.begin_twophase(), engine.prepare()
984
Fixed bug which was preventing UNIONS from being
991
Added "bind" keyword argument to insert(), update(),
992
delete() and DDL(). The .bind property is now assignable
993
on those statements as well as on select().
999
Insert statements can now be compiled with extra "prefix"
1000
words between INSERT and INTO, for vendor extensions like
1001
MySQL's INSERT IGNORE INTO table.
1007
any(), has(), contains(), ~contains(), attribute level ==
1008
and != now work properly with self-referential relations -
1009
the clause inside the EXISTS is aliased on the "remote"
1010
side to distinguish it from the parent table. This
1011
applies to single table self-referential as well as
1012
inheritance-based self-referential.
1018
Repaired behavior of == and != operators at the relation()
1019
level when compared against NULL for one-to-one relations
1025
Fixed bug whereby session.expire() attributes were not
1026
loading on an polymorphically-mapped instance mapped by a
1027
select_table mapper.
1033
Added query.with_polymorphic() - specifies a list of
1034
classes which descend from the base class, which will be
1035
added to the FROM clause of the query. Allows subclasses
1036
to be used within filter() criterion as well as eagerly
1037
loads the attributes of those subclasses.
1043
Your cries have been heard: removing a pending item from
1044
an attribute or collection with delete-orphan expunges the
1045
item from the session; no FlushError is raised. Note that
1046
if you session.save()'ed the pending item explicitly, the
1047
attribute/collection removal still knocks it out.
1053
session.refresh() and session.expire() raise an error when
1054
called on instances which are not persistent within the
1061
Fixed potential generative bug when the same Query was
1062
used to generate multiple Query objects using join().
1068
Fixed bug which was introduced in 0.4.3, whereby loading
1069
an already-persistent instance mapped with joined table
1070
inheritance would trigger a useless "secondary" load from
1071
its joined table, when using the default "select"
1072
polymorphic_fetch. This was due to attributes being
1073
marked as expired during its first load and not getting
1074
unmarked from the previous "secondary" load. Attributes
1075
are now unexpired based on presence in __dict__ after any
1076
load or commit operation succeeds.
1082
Deprecated Query methods apply_sum(), apply_max(),
1083
apply_min(), apply_avg(). Better methodologies are
1090
relation() can accept a callable for its first argument,
1091
which returns the class to be related. This is in place
1092
to assist declarative packages to define relations without
1093
classes yet being in place.
1099
Added a new "higher level" operator called "of_type()":
1100
used in join() as well as with any() and has(), qualifies
1101
the subclass which will be used in filter criterion, e.g.:
1103
query.filter(Company.employees.of_type(Engineer).
1104
any(Engineer.name=='foo'))
1108
query.join(Company.employees.of_type(Engineer)).
1109
filter(Engineer.name=='foo')
1115
Preventive code against a potential lost-reference bug in
1122
Expressions used in filter(), filter_by() and others, when
1123
they make usage of a clause generated from a relation
1124
using the identity of a child object (e.g.,
1125
filter(Parent.child==<somechild>)), evaluate the actual
1126
primary key value of <somechild> at execution time so that
1127
the autoflush step of the Query can complete, thereby
1128
populating the PK value of <somechild> in the case that
1129
<somechild> was pending.
1135
setting the relation()-level order by to a column in the
1136
many-to-many "secondary" table will now work with eager
1137
loading, previously the "order by" wasn't aliased against
1138
the secondary table's alias.
1144
Synonyms riding on top of existing descriptors are now
1145
full proxies to those descriptors.
1151
Invalid SQLite connection URLs now raise an error.
1157
postgres TIMESTAMP renders correctly
1163
postgres PGArray is a "mutable" type by default; when used
1164
with the ORM, mutable-style equality/ copy-on-write
1165
techniques are used to test for changes.
1171
a new super-small "declarative" extension has been added,
1172
which allows Table and mapper() configuration to take
1173
place inline underneath a class declaration. This
1174
extension differs from ActiveMapper and Elixir in that it
1175
does not redefine any SQLAlchemy semantics at all; literal
1176
Column, Table and relation() constructs are used to define
1177
the class behavior and table definition.
1181
:released: Thu Feb 14 2008
1187
Added "schema.DDL", an executable free-form DDL statement.
1188
DDLs can be executed in isolation or attached to Table or
1189
MetaData instances and executed automatically when those
1190
objects are created and/or dropped.
1196
Table columns and constraints can be overridden on a an
1197
existing table (such as a table that was already reflected)
1198
using the 'useexisting=True' flag, which now takes into
1199
account the arguments passed along with it.
1205
Added a callable-based DDL events interface, adds hooks
1206
before and after Tables and MetaData create and drop.
1212
Added generative where(<criterion>) method to delete() and
1213
update() constructs which return a new object with criterion
1214
joined to existing criterion via AND, just like
1221
Added "ilike()" operator to column operations. Compiles to
1222
ILIKE on postgres, lower(x) LIKE lower(y) on all
1229
Added "now()" as a generic function; on SQLite, Oracle
1230
and MSSQL compiles as "CURRENT_TIMESTAMP"; "now()" on
1237
The startswith(), endswith(), and contains() operators now
1238
concatenate the wildcard operator with the given operand in
1239
SQL, i.e. "'%' || <bindparam>" in all cases, accept
1240
text('something') operands properly
1246
cast() accepts text('something') and other non-literal
1253
fixed bug in result proxy where anonymously generated
1254
column labels would not be accessible using their straight
1261
Deferrable constraints can now be defined.
1267
Added "autocommit=True" keyword argument to select() and
1268
text(), as well as generative autocommit() method on
1269
select(); for statements which modify the database through
1270
some user-defined means other than the usual INSERT/UPDATE/
1271
DELETE etc. This flag will enable "autocommit" behavior
1272
during execution if no transaction is in progress.
1278
The '.c.' attribute on a selectable now gets an entry for
1279
every column expression in its columns clause. Previously,
1280
"unnamed" columns like functions and CASE statements weren't
1281
getting put there. Now they will, using their full string
1282
representation if no 'name' is available.
1288
a CompositeSelect, i.e. any union(), union_all(),
1289
intersect(), etc. now asserts that each selectable contains
1290
the same number of columns. This conforms to the
1291
corresponding SQL requirement.
1297
The anonymous 'label' generated for otherwise unlabeled
1298
functions and expressions now propagates outwards at compile
1299
time for expressions like select([select([func.foo()])]).
1305
Building on the above ideas, CompositeSelects now build up
1306
their ".c." collection based on the names present in the
1307
first selectable only; corresponding_column() now works
1308
fully for all embedded selectables.
1314
Oracle and others properly encode SQL used for defaults like
1315
sequences, etc., even if no unicode idents are used since
1316
identifier preparer may return a cached unicode identifier.
1322
Column and clause comparisons to datetime objects on the
1323
left hand side of the expression now work (d < table.c.col).
1324
(datetimes on the RHS have always worked, the LHS exception
1325
is a quirk of the datetime implementation.)
1331
Every Session.begin() must now be accompanied by a
1332
corresponding commit() or rollback() unless the session is
1333
closed with Session.close(). This also includes the begin()
1334
which is implicit to a session created with
1335
transactional=True. The biggest change introduced here is
1336
that when a Session created with transactional=True raises
1337
an exception during flush(), you must call
1338
Session.rollback() or Session.close() in order for that
1339
Session to continue after an exception.
1345
Fixed merge() collection-doubling bug when merging transient
1346
entities with backref'ed collections.
1352
merge(dont_load=True) does not accept transient entities,
1353
this is in continuation with the fact that
1354
merge(dont_load=True) does not accept any "dirty" objects
1361
Added standalone "query" class attribute generated by a
1362
scoped_session. This provides MyClass.query without using
1363
Session.mapper. Use via:
1365
MyClass.query = Session.query_property()
1371
The proper error message is raised when trying to access
1372
expired instance attributes with no session present
1378
dynamic_loader() / lazy="dynamic" now accepts and uses
1379
the order_by parameter in the same way in which it works
1386
Added expire_all() method to Session. Calls expire() for
1387
all persistent instances. This is handy in conjunction
1394
Instances which have been partially or fully expired will
1395
have their expired attributes populated during a regular
1396
Query operation which affects those objects, preventing a
1397
needless second SQL statement for each instance.
1403
Dynamic relations, when referenced, create a strong
1404
reference to the parent object so that the query still has a
1405
parent to call against even if the parent is only created
1406
(and otherwise dereferenced) within the scope of a single
1413
Added a mapper() flag "eager_defaults". When set to True,
1414
defaults that are generated during an INSERT or UPDATE
1415
operation are post-fetched immediately, instead of being
1416
deferred until later. This mimics the old 0.3 behavior.
1422
query.join() can now accept class-mapped attributes as
1423
arguments. These can be used in place or in any combination
1424
with strings. In particular this allows construction of
1425
joins to subclasses on a polymorphic relation, i.e.:
1427
query(Company).join(['employees', Engineer.name])
1430
:tags: orm, ('employees', people.join(engineer)), Engineer.name
1433
query.join() can also accept tuples of attribute name/some
1434
selectable as arguments. This allows construction of joins
1435
*from* subclasses of a polymorphic relation, i.e.:
1446
General improvements to the behavior of join() in
1447
conjunction with polymorphic mappers, i.e. joining from/to
1448
polymorphic mappers and properly applying aliases.
1454
Fixed/improved behavior when a mapper determines the natural
1455
"primary key" of a mapped join, it will more effectively
1456
reduce columns which are equivalent via foreign key
1457
relation. This affects how many arguments need to be sent
1458
to query.get(), among other things.
1464
The lazy loader can now handle a join condition where the
1465
"bound" column (i.e. the one that gets the parent id sent as
1466
a bind parameter) appears more than once in the join
1467
condition. Specifically this allows the common task of a
1468
relation() which contains a parent-correlated subquery, such
1469
as "select only the most recent child item".
1475
Fixed bug in polymorphic inheritance where an incorrect
1476
exception is raised when base polymorphic_on column does not
1477
correspond to any columns within the local selectable of an
1478
inheriting mapper more than one level deep
1484
Fixed bug in polymorphic inheritance which made it difficult
1485
to set a working "order_by" on a polymorphic mapper.
1491
Fixed a rather expensive call in Query that was slowing down
1492
polymorphic queries.
1498
"Passive defaults" and other "inline" defaults can now be
1499
loaded during a flush() call if needed; in particular, this
1500
allows constructing relations() where a foreign key column
1501
references a server-side-generated, non-primary-key
1508
Additional Session transaction fixes/changes:
1509
- Fixed bug with session transaction management: parent
1510
transactions weren't started on the connection when
1511
adding a connection to a nested transaction.
1513
- session.transaction now always refers to the innermost
1514
active transaction, even when commit/rollback are called
1515
directly on the session transaction object.
1517
- Two-phase transactions can now be prepared.
1519
- When preparing a two-phase transaction fails on one
1520
connection, all the connections are rolled back.
1522
- session.close() didn't close all transactions when
1523
nested transactions were used.
1525
- rollback() previously erroneously set the current
1526
transaction directly to the parent of the transaction
1527
that could be rolled back to. Now it rolls back the next
1528
transaction up that can handle it, but sets the current
1529
transaction to it's parent and inactivates the
1530
transactions in between. Inactive transactions can only
1531
be rolled back or closed, any other call results in an
1534
- autoflush for commit() wasn't flushing for simple
1537
- unitofwork flush didn't close the failed transaction
1538
when the session was not in a transaction and commiting
1539
the transaction failed.
1545
Miscellaneous tickets:
1551
Fixed a variety of hidden and some not-so-hidden
1552
compatibility issues for Python 2.3, thanks to new support
1553
for running the full test suite on 2.3.
1559
Warnings are now issued as type exceptions.SAWarning.
1565
Better support for schemas in SQLite (linked in by ATTACH
1566
DATABASE ... AS name). In some cases in the past, schema
1567
names were ommitted from generated SQL for SQLite. This is
1574
table_names on SQLite now picks up temporary tables as well.
1580
Auto-detect an unspecified MySQL ANSI_QUOTES mode during
1581
reflection operations, support for changing the mode
1582
midstream. Manual mode setting is still required if no
1589
Fixed reflection of TIME columns on SQLite.
1595
Finally added PGMacAddr type to postgres
1601
Reflect the sequence associated to a PK field (typically
1602
with a BEFORE INSERT trigger) under Firebird
1608
Oracle assembles the correct columns in the result set
1609
column mapping when generating a LIMIT/OFFSET subquery,
1610
allows columns to map properly to result sets even if
1611
long-name truncation kicks in
1617
MSSQL now includes EXEC in the _is_select regexp, which
1618
should allow row-returning stored procedures to be used.
1624
MSSQL now includes an experimental implementation of
1625
LIMIT/OFFSET using the ANSI SQL row_number() function, so it
1626
requires MSSQL-2005 or higher. To enable the feature, add
1627
"has_window_funcs" to the keyword arguments for connect, or
1628
add "?has_window_funcs=1" to your dburi query arguments.
1634
Changed ext.activemapper to use a non-transactional session
1635
for the objectstore.
1641
Fixed output order of "['a'] + obj.proxied" binary operation
1642
on association-proxied lists.
1646
:released: Wed Jan 09 2008
1652
sub version numbering scheme changed to suite
1653
setuptools version number rules; easy_install -u
1654
should now get this version over 0.4.2.
1660
Text type is properly exported now and does not
1661
raise a warning on DDL create; String types with no
1662
length only raise warnings during CREATE TABLE
1668
new UnicodeText type is added, to specify an
1669
encoded, unlengthed Text type
1675
fixed bug in union() so that select() statements
1676
which don't derive from FromClause objects can be
1683
fixed bug with session.dirty when using "mutable
1684
scalars" (such as PickleTypes)
1690
added a more descriptive error message when flushing
1691
on a relation() that has non-locally-mapped columns
1692
in its primary or secondary join condition
1698
Fixed reflection of mysql empty string column
1705
changed name of TEXT to Text since its a "generic"
1706
type; TEXT name is deprecated until 0.5. The
1707
"upgrading" behavior of String to Text when no
1708
length is present is also deprecated until 0.5; will
1709
issue a warning when used for CREATE TABLE
1710
statements (String with no length for SQL expression
1711
purposes is still fine)
1717
generative select.order_by(None) / group_by(None)
1718
was not managing to reset order by/group by
1725
suppressing *all* errors in
1726
InstanceState.__cleanup() now.
1732
fixed an attribute history bug whereby assigning a
1733
new collection to a collection-based attribute which
1734
already had pending changes would generate incorrect
1741
fixed delete-orphan cascade bug whereby setting the
1742
same object twice to a scalar attribute could log it
1749
Fixed cascades on a += assignment to a list-based
1756
synonyms can now be created against props that don't
1757
exist yet, which are later added via add_property().
1758
This commonly includes backrefs. (i.e. you can make
1759
synonyms for backrefs without worrying about the
1760
order of operations)
1766
fixed bug which could occur with polymorphic "union"
1767
mapper which falls back to "deferred" loading of
1774
the "columns" collection on a mapper/mapped class
1775
(i.e. 'c') is against the mapped table, not the
1776
select_table in the case of polymorphic "union"
1777
loading (this shouldn't be noticeable).
1783
'+', '*', '+=' and '*=' support for association
1790
mssql - narrowed down the test for "date"/"datetime"
1791
in MSDate/ MSDateTime subclasses so that incoming
1792
"datetime" objects don't get mis-interpreted as
1793
"date" objects and vice versa.
1799
fixed fairly critical bug whereby the same instance could be listed
1800
more than once in the unitofwork.new collection; most typically
1801
reproduced when using a combination of inheriting mappers and
1802
ScopedSession.mapper, as the multiple __init__ calls per instance
1803
could save() the object with distinct _state objects
1809
added very rudimentary yielding iterator behavior to Query. Call
1810
query.yield_per(<number of rows>) and evaluate the Query in an
1811
iterative context; every collection of N rows will be packaged up
1812
and yielded. Use this method with extreme caution since it does
1813
not attempt to reconcile eagerly loaded collections across
1814
result batch boundaries, nor will it behave nicely if the same
1815
instance occurs in more than one batch. This means that an eagerly
1816
loaded collection will get cleared out if it's referenced in more than
1817
one batch, and in all cases attributes will be overwritten on instances
1818
that occur in more than one batch.
1824
Fixed in-place set mutation operators for set collections and association
1831
Fixed the missing call to subtype result processor for the PGArray
1836
:released: Wed Jan 02 2008
1842
generic functions ! we introduce a database of known SQL functions, such
1843
as current_timestamp, coalesce, and create explicit function objects
1844
representing them. These objects have constrained argument lists, are
1845
type aware, and can compile in a dialect-specific fashion. So saying
1846
func.char_length("foo", "bar") raises an error (too many args),
1847
func.coalesce(datetime.date(2007, 10, 5), datetime.date(2005, 10, 15))
1848
knows that its return type is a Date. We only have a few functions
1849
represented so far but will continue to add to the system
1855
auto-reconnect support improved; a Connection can now automatically
1856
reconnect after its underlying connection is invalidated, without
1857
needing to connect() again from the engine. This allows an ORM session
1858
bound to a single Connection to not need a reconnect.
1859
Open transactions on the Connection must be rolled back after an invalidation
1860
of the underlying connection else an error is raised. Also fixed
1861
bug where disconnect detect was not being called for cursor(), rollback(),
1868
added new flag to String and create_engine(),
1869
assert_unicode=(True|False|'warn'|None). Defaults to `False` or `None` on
1870
create_engine() and String, `'warn'` on the Unicode type. When `True`,
1871
results in all unicode conversion operations raising an exception when a
1872
non-unicode bytestring is passed as a bind parameter. 'warn' results
1873
in a warning. It is strongly advised that all unicode-aware applications
1874
make proper use of Python unicode objects (i.e. u'hello' and not 'hello')
1875
so that data round trips accurately.
1881
generation of "unique" bind parameters has been simplified to use the same
1882
"unique identifier" mechanisms as everything else. This doesn't affect
1883
user code, except any code that might have been hardcoded against the generated
1884
names. Generated bind params now have the form "<paramname>_<num>",
1885
whereas before only the second bind of the same name would have this form.
1891
select().as_scalar() will raise an exception if the select does not have
1892
exactly one expression in its columns clause.
1898
bindparam() objects themselves can be used as keys for execute(), i.e.
1899
statement.execute({bind1:'foo', bind2:'bar'})
1905
added new methods to TypeDecorator, process_bind_param() and
1906
process_result_value(), which automatically take advantage of the processing
1907
of the underlying type. Ideal for using with Unicode or Pickletype.
1908
TypeDecorator should now be the primary way to augment the behavior of any
1909
existing type including other TypeDecorator subclasses such as PickleType.
1915
selectables (and others) will issue a warning when two columns in
1916
their exported columns collection conflict based on name.
1922
tables with schemas can still be used in sqlite, firebird,
1923
schema name just gets dropped
1929
changed the various "literal" generation functions to use an anonymous
1930
bind parameter. not much changes here except their labels now look
1931
like ":param_1", ":param_2" instead of ":literal"
1937
column labels in the form "tablename.columname", i.e. with a dot, are now
1944
from_obj keyword argument to select() can be a scalar or a list.
1950
a major behavioral change to collection-based backrefs: they no
1951
longer trigger lazy loads ! "reverse" adds and removes
1952
are queued up and are merged with the collection when it is
1953
actually read from and loaded; but do not trigger a load beforehand.
1954
For users who have noticed this behavior, this should be much more
1955
convenient than using dynamic relations in some cases; for those who
1956
have not, you might notice your apps using a lot fewer queries than
1957
before in some situations.
1963
mutable primary key support is added. primary key columns can be
1964
changed freely, and the identity of the instance will change upon
1965
flush. In addition, update cascades of foreign key referents (primary
1966
key or not) along relations are supported, either in tandem with the
1967
database's ON UPDATE CASCADE (required for DB's like Postgres) or
1968
issued directly by the ORM in the form of UPDATE statements, by setting
1969
the flag "passive_cascades=False".
1975
inheriting mappers now inherit the MapperExtensions of their parent
1976
mapper directly, so that all methods for a particular MapperExtension
1977
are called for subclasses as well. As always, any MapperExtension
1978
can return either EXT_CONTINUE to continue extension processing
1979
or EXT_STOP to stop processing. The order of mapper resolution is:
1980
<extensions declared on the classes mapper> <extensions declared on the
1981
classes' parent mapper> <globally declared extensions>.
1983
Note that if you instantiate the same extension class separately
1984
and then apply it individually for two mappers in the same inheritance
1985
chain, the extension will be applied twice to the inheriting class,
1986
and each method will be called twice.
1988
To apply a mapper extension explicitly to each inheriting class but
1989
have each method called only once per operation, use the same
1990
instance of the extension for both mappers.
1996
MapperExtension.before_update() and after_update() are now called
1997
symmetrically; previously, an instance that had no modified column
1998
attributes (but had a relation() modification) could be called with
1999
before_update() but not after_update()
2005
columns which are missing from a Query's select statement
2006
now get automatically deferred during load.
2012
mapped classes which extend "object" and do not provide an
2013
__init__() method will now raise TypeError if non-empty *args
2014
or **kwargs are present at instance construction time (and are
2015
not consumed by any extensions such as the scoped_session mapper),
2016
consistent with the behavior of normal Python classes
2022
fixed Query bug when filter_by() compares a relation against None
2028
improved support for pickling of mapped entities. Per-instance
2029
lazy/deferred/expired callables are now serializable so that
2030
they serialize and deserialize with _state.
2036
new synonym() behavior: an attribute will be placed on the mapped
2037
class, if one does not exist already, in all cases. if a property
2038
already exists on the class, the synonym will decorate the property
2039
with the appropriate comparison operators so that it can be used in
2040
column expressions just like any other mapped attribute (i.e. usable in
2041
filter(), etc.) the "proxy=True" flag is deprecated and no longer means
2042
anything. Additionally, the flag "map_column=True" will automatically
2043
generate a ColumnProperty corresponding to the name of the synonym,
2044
i.e.: 'somename':synonym('_somename', map_column=True) will map the
2045
column named 'somename' to the attribute '_somename'. See the example
2052
Query.select_from() now replaces all existing FROM criterion with
2053
the given argument; the previous behavior of constructing a list
2054
of FROM clauses was generally not useful as is required
2055
filter() calls to create join criterion, and new tables introduced
2056
within filter() already add themselves to the FROM clause. The
2057
new behavior allows not just joins from the main table, but select
2058
statements as well. Filter criterion, order bys, eager load
2059
clauses will be "aliased" against the given statement.
2065
this month's refactoring of attribute instrumentation changes
2066
the "copy-on-load" behavior we've had since midway through 0.3
2067
with "copy-on-modify" in most cases. This takes a sizable chunk
2068
of latency out of load operations and overall does less work
2069
as only attributes which are actually modified get their
2070
"committed state" copied. Only "mutable scalar" attributes
2071
(i.e. a pickled object or other mutable item), the reason for
2072
the copy-on-load change in the first place, retain the old
2076
:tags: attrname, orm
2079
a slight behavioral change to attributes is, del'ing an attribute
2080
does *not* cause the lazyloader of that attribute to fire off again;
2081
the "del" makes the effective value of the attribute "None". To
2082
re-trigger the "loader" for an attribute, use
2083
session.expire(instance,).
2089
query.filter(SomeClass.somechild == None), when comparing
2090
a many-to-one property to None, properly generates "id IS NULL"
2091
including that the NULL is on the right side.
2097
query.order_by() takes into account aliased joins, i.e.
2098
query.join('orders', aliased=True).order_by(Order.id)
2104
eagerload(), lazyload(), eagerload_all() take an optional
2105
second class-or-mapper argument, which will select the mapper
2106
to apply the option towards. This can select among other
2107
mappers which were added using add_entity().
2113
eagerloading will work with mappers added via add_entity().
2119
added "cascade delete" behavior to "dynamic" relations just like
2120
that of regular relations. if passive_deletes flag (also just added)
2121
is not set, a delete of the parent item will trigger a full load of
2122
the child items so that they can be deleted or updated accordingly.
2128
also with dynamic, implemented correct count() behavior as well
2129
as other helper methods.
2135
fix to cascades on polymorphic relations, such that cascades
2136
from an object to a polymorphic collection continue cascading
2137
along the set of attributes specific to each element in the collection.
2143
query.get() and query.load() do not take existing filter or other
2144
criterion into account; these methods *always* look up the given id
2145
in the database or return the current instance from the identity map,
2146
disregarding any existing filter, join, group_by or other criterion
2147
which has been configured.
2153
added support for version_id_col in conjunction with inheriting mappers.
2154
version_id_col is typically set on the base mapper in an inheritance
2155
relationship where it takes effect for all inheriting mappers.
2161
relaxed rules on column_property() expressions having labels; any
2162
ColumnElement is accepted now, as the compiler auto-labels non-labeled
2163
ColumnElements now. a selectable, like a select() statement, still
2164
requires conversion to ColumnElement via as_scalar() or label().
2170
fixed backref bug where you could not del instance.attr if attr
2177
several ORM attributes have been removed or made private:
2178
mapper.get_attr_by_column(), mapper.set_attr_by_column(),
2179
mapper.pks_by_table, mapper.cascade_callable(),
2180
MapperProperty.cascade_callable(), mapper.canload(),
2181
mapper.save_obj(), mapper.delete_obj(), mapper._mapper_registry,
2182
attributes.AttributeManager
2188
Assigning an incompatible collection type to a relation attribute now
2189
raises TypeError instead of sqlalchemy's ArgumentError.
2195
Bulk assignment of a MappedCollection now raises an error if a key in the
2196
incoming dictionary does not match the key that the collection's keyfunc
2197
would use for that value.
2200
:tags: orm, newval1, newval2
2203
Custom collections can now specify a @converter method to translate
2204
objects used in "bulk" assignment into a stream of values, as in::
2208
obj.dictcol = {'foo': newval1, 'bar': newval2}
2210
The MappedCollection uses this hook to ensure that incoming key/value
2211
pairs are sane from the collection's perspective.
2217
fixed endless loop issue when using lazy="dynamic" on both
2218
sides of a bi-directional relationship
2224
more fixes to the LIMIT/OFFSET aliasing applied with Query + eagerloads,
2225
in this case when mapped against a select statement
2231
fix to self-referential eager loading such that if the same mapped
2232
instance appears in two or more distinct sets of columns in the same
2233
result set, its eagerly loaded collection will be populated regardless
2234
of whether or not all of the rows contain a set of "eager" columns for
2235
that collection. this would also show up as a KeyError when fetching
2236
results with join_depth turned on.
2242
fixed bug where Query would not apply a subquery to the SQL when LIMIT
2243
was used in conjunction with an inheriting mapper where the eager
2244
loader was only in the parent mapper.
2250
clarified the error message which occurs when you try to update()
2251
an instance with the same identity key as an instance already present
2258
some clarifications and fixes to merge(instance, dont_load=True).
2259
fixed bug where lazy loaders were getting disabled on returned instances.
2260
Also, we currently do not support merging an instance which has uncommitted
2261
changes on it, in the case that dont_load=True is used....this will
2262
now raise an error. This is due to complexities in merging the
2263
"committed state" of the given instance to correctly correspond to the
2264
newly copied instance, as well as other modified state.
2265
Since the use case for dont_load=True is caching, the given instances
2266
shouldn't have any uncommitted changes on them anyway.
2267
We also copy the instances over without using any events now, so that
2268
the 'dirty' list on the new session remains unaffected.
2274
fixed bug which could arise when using session.begin_nested() in conjunction
2275
with more than one level deep of enclosing session.begin() statements
2281
fixed session.refresh() with instance that has custom entity_name
2287
sqlite SLDate type will not erroneously render "microseconds" portion
2288
of a datetime or time object.
2295
- added disconnect detection support for Oracle
2296
- some cleanup to binary/raw types so that cx_oracle.LOB is detected
2301
:tickets: 824, 839, 842, 901
2304
- PyODBC no longer has a global "set nocount on".
2305
- Fix non-identity integer PKs on autload
2306
- Better support for convert_unicode
2307
- Less strict date conversion for pyodbc/adodbapi
2308
- Schema-qualified tables / autoload
2311
:tags: firebird, backend
2314
does properly reflect domains (partially fixing) and
2318
:tags: 3562, firebird, backend
2321
reverted to use default poolclass (was set to SingletonThreadPool in
2322
0.4.0 for test purposes)
2325
:tags: firebird, backend
2328
map func.length() to 'char_length' (easily overridable with the UDF
2329
'strlen' on old versions of Firebird)
2333
:released: Sun Nov 18 2007
2339
the "shortname" keyword parameter on bindparam() has been
2346
Added contains operator (generates a "LIKE %<other>%" clause).
2352
anonymous column expressions are automatically labeled.
2353
e.g. select([x* 5]) produces "SELECT x * 5 AS anon_1".
2354
This allows the labelname to be present in the cursor.description
2355
which can then be appropriately matched to result-column processing
2356
rules. (we can't reliably use positional tracking for result-column
2357
matches since text() expressions may represent multiple columns).
2363
operator overloading is now controlled by TypeEngine objects - the
2364
one built-in operator overload so far is String types overloading
2365
'+' to be the string concatenation operator.
2366
User-defined types can also define their own operator overloading
2367
by overriding the adapt_operator(self, op) method.
2373
untyped bind parameters on the right side of a binary expression
2374
will be assigned the type of the left side of the operation, to better
2375
enable the appropriate bind parameter processing to take effect
2381
Removed regular expression step from most statement compilations.
2388
Fixed empty (zero column) sqlite inserts, allowing inserts on
2389
autoincrementing single column tables.
2395
Fixed expression translation of text() clauses; this repairs various
2396
ORM scenarios where literal text is used for SQL expressions
2402
Removed ClauseParameters object; compiled.params returns a regular
2403
dictionary now, as well as result.last_inserted_params() /
2404
last_updated_params().
2410
Fixed INSERT statements w.r.t. primary key columns that have
2411
SQL-expression based default generators on them; SQL expression
2412
executes inline as normal but will not trigger a "postfetch" condition
2413
for the column, for those DB's who provide it via cursor.lastrowid
2419
func. objects can be pickled/unpickled
2425
rewrote and simplified the system used to "target" columns across
2426
selectable expressions. On the SQL side this is represented by the
2427
"corresponding_column()" method. This method is used heavily by the ORM
2428
to "adapt" elements of an expression to similar, aliased expressions,
2429
as well as to target result set columns originally bound to a
2430
table or selectable to an aliased, "corresponding" expression. The new
2431
rewrite features completely consistent and accurate behavior.
2437
Added a field ("info") for storing arbitrary data on schema items
2443
The "properties" collection on Connections has been renamed "info" to
2444
match schema's writable collections. Access is still available via
2445
the "properties" name until 0.5.
2451
fixed the close() method on Transaction when using strategy='threadlocal'
2457
fix to compiled bind parameters to not mistakenly populate None
2463
<Engine|Connection>._execute_clauseelement becomes a public method
2464
Connectable.execute_clauseelement
2470
eager loading with LIMIT/OFFSET applied no longer adds the primary
2471
table joined to a limited subquery of itself; the eager loads now
2472
join directly to the subquery which also provides the primary table's
2473
columns to the result set. This eliminates a JOIN from all eager loads
2480
session.refresh() and session.expire() now support an additional argument
2481
"attribute_names", a list of individual attribute keynames to be refreshed
2482
or expired, allowing partial reloads of attributes on an already-loaded
2489
added op() operator to instrumented attributes; i.e.
2490
User.name.op('ilike')('%somename%')
2496
Mapped classes may now define __eq__, __hash__, and __nonzero__ methods
2497
with arbitrary semantics. The orm now handles all mapped instances on
2498
an identity-only basis. (e.g. 'is' vs '==')
2504
the "properties" accessor on Mapper is removed; it now throws an informative
2505
exception explaining the usage of mapper.get_property() and
2506
mapper.iterate_properties
2512
added having() method to Query, applies HAVING to the generated statement
2513
in the same way as filter() appends to the WHERE clause.
2519
The behavior of query.options() is now fully based on paths, i.e. an
2520
option such as eagerload_all('x.y.z.y.x') will apply eagerloading to
2521
only those paths, i.e. and not 'x.y.x'; eagerload('children.children')
2522
applies only to exactly two-levels deep, etc.
2528
PickleType will compare using `==` when set up with mutable=False,
2529
and not the `is` operator. To use `is` or any other comparator, send
2530
in a custom comparison function using PickleType(comparator=my_custom_comparator).
2536
query doesn't throw an error if you use distinct() and an order_by()
2537
containing UnaryExpressions (or other) together
2543
order_by() expressions from joined tables are properly added to columns
2544
clause when using distinct()
2550
fixed error where Query.add_column() would not accept a class-bound
2551
attribute as an argument; Query also raises an error if an invalid
2552
argument was sent to add_column() (at instances() time)
2558
added a little more checking for garbage-collection dereferences in
2559
InstanceState.__cleanup() to reduce "gc ignored" errors on app
2566
The session API has been solidified:
2572
It's an error to session.save() an object which is already
2579
It's an error to session.delete() an object which is *not*
2586
session.update() and session.delete() raise an error when updating
2587
or deleting an instance that is already in the session with a
2594
The session checks more carefully when determining "object X already
2595
in another session"; e.g. if you pickle a series of objects and
2596
unpickle (i.e. as in a Pylons HTTP session or similar), they can go
2597
into a new session without any conflict
2603
merge() includes a keyword argument "dont_load=True". setting this
2604
flag will cause the merge operation to not load any data from the
2605
database in response to incoming detached objects, and will accept
2606
the incoming detached object as though it were already present in
2607
that session. Use this to merge detached objects from external
2608
caching systems into the session.
2614
Deferred column attributes no longer trigger a load operation when the
2615
attribute is assigned to. In those cases, the newly assigned value
2616
will be present in the flushes' UPDATE statement unconditionally.
2622
Fixed a truncation error when re-assigning a subset of a collection
2623
(obj.relation = obj.relation[1:])
2629
De-cruftified backref configuration code, backrefs which step on
2630
existing properties now raise an error
2636
Improved behavior of add_property() etc., fixed involving
2643
Fixed clear_mappers() behavior to better clean up after itself.
2649
Fix to "row switch" behavior, i.e. when an INSERT/DELETE is combined
2650
into a single UPDATE; many-to-many relations on the parent object
2657
Fixed __hash__ for association proxy- these collections are unhashable,
2658
just like their mutable Python counterparts.
2664
Added proxying of save_or_update, __contains__ and __iter__ methods for
2671
fixed very hard-to-reproduce issue where by the FROM clause of Query
2672
could get polluted by certain generative calls
2678
Added experimental support for MaxDB (versions >= 7.6.03.007 only).
2684
oracle will now reflect "DATE" as an OracleDateTime column, not
2691
added awareness of schema name in oracle table_names() function,
2692
fixes metadata.reflect(schema='someschema')
2698
MSSQL anonymous labels for selection of functions made deterministic
2704
sqlite will reflect "DECIMAL" as a numeric column.
2710
Made access dao detection more reliable
2716
Renamed the Dialect attribute 'preexecute_sequences' to
2717
'preexecute_pk_sequences'. An attribute porxy is in place for
2718
out-of-tree dialects using the old name.
2724
Added test coverage for unknown type reflection. Fixed sqlite/mysql
2725
handling of type reflection for unknown types.
2731
Added REAL for mysql dialect (for folks exploiting the
2732
REAL_AS_FLOAT sql mode).
2738
mysql Float, MSFloat and MSDouble constructed without arguments
2739
now produce no-argument DDL, e.g.'FLOAT'.
2745
Removed unused util.hash().
2749
:released: Wed Oct 17 2007
2755
(see 0.4.0beta1 for the start of major changes against 0.3,
2756
as well as http://www.sqlalchemy.org/trac/wiki/WhatsNewIn04 )
2762
Added initial Sybase support (mxODBC so far)
2768
Added partial index support for PostgreSQL. Use the postgres_where keyword
2775
string-based query param parsing/config file parser understands
2776
wider range of string values for booleans
2782
backref remove object operation doesn't fail if the other-side
2783
collection doesn't contain the item, supports noload collections
2789
removed __len__ from "dynamic" collection as it would require issuing
2790
a SQL "count()" operation, thus forcing all list evaluations to issue
2797
inline optimizations added to locate_dirty() which can greatly speed up
2798
repeated calls to flush(), as occurs with autoflush=True
2804
The IdentifierPreprarer's _requires_quotes test is now regex based. Any
2805
out-of-tree dialects that provide custom sets of legal_characters or
2806
illegal_initial_characters will need to move to regexes or override
2813
Firebird has supports_sane_rowcount and supports_sane_multi_rowcount set
2814
to False due to ticket #370 (right way).
2820
Improvements and fixes on Firebird reflection:
2821
. FBDialect now mimics OracleDialect, regarding case-sensitivity of TABLE and
2822
COLUMN names (see 'case_sensitive remotion' topic on this current file).
2823
. FBDialect.table_names() doesn't bring system tables (ticket:796).
2824
. FB now reflects Column's nullable property correctly.
2830
Fixed SQL compiler's awareness of top-level column labels as used
2831
in result-set processing; nested selects which contain the same column
2832
names don't affect the result or conflict with result-column metadata.
2838
query.get() and related functions (like many-to-one lazyloading)
2839
use compile-time-aliased bind parameter names, to prevent
2840
name conflicts with bind parameters that already exist in the
2847
Fixed three- and multi-level select and deferred inheritance loading
2848
(i.e. abc inheritance with no select_table).
2854
Ident passed to id_chooser in shard.py always a list.
2860
The no-arg ResultProxy._row_processor() is now the class attribute
2867
Added support for returning values from inserts and updates for
2874
PG reflection, upon seeing the default schema name being used explicitly
2875
as the "schema" argument in a Table, will assume that this is the
2876
user's desired convention, and will explicitly set the "schema" argument
2877
in foreign-key-related reflected tables, thus making them match only
2878
with Table constructors that also use the explicit "schema" argument
2879
(even though its the default schema).
2880
In other words, SA assumes the user is being consistent in this usage.
2886
fixed sqlite reflection of BOOL/BOOLEAN
2892
Added support for UPDATE with LIMIT on mysql.
2898
null foreign key on a m2o doesn't trigger a lazyload
2904
oracle does not implicitly convert to unicode for non-typed result
2905
sets (i.e. when no TypeEngine/String/Unicode type is even being used;
2906
previously it was detecting DBAPI types and converting regardless).
2913
fix to anonymous label generation of long table/column names
2919
Firebird dialect now uses SingletonThreadPool as poolclass.
2925
Firebird now uses dialect.preparer to format sequences names
2931
Fixed breakage with postgres and multiple two-phase transactions. Two-phase
2932
commits and rollbacks didn't automatically end up with a new transaction
2933
as the usual dbapi commits/rollbacks do.
2939
Added an option to the _ScopedExt mapper extension to not automatically
2940
save new objects to session on object initialization.
2946
fixed Oracle non-ansi join syntax
2952
PickleType and Interval types (on db not supporting it natively) are now
2959
Added Float and Time types to Firebird (FBFloat and FBTime). Fixed
2960
BLOB SUB_TYPE for TEXT and Binary types.
2966
Changed the API for the in_ operator. in_() now accepts a single argument
2967
that is a sequence of values or a selectable. The old API of passing in
2968
values as varargs still works but is deprecated.
2971
:version: 0.4.0beta6
2972
:released: Thu Sep 27 2007
2978
The Session identity map is now *weak referencing* by default, use
2979
weak_identity_map=False to use a regular dict. The weak dict we are using
2980
is customized to detect instances which are "dirty" and maintain a
2981
temporary strong reference to those instances until changes are flushed.
2987
Mapper compilation has been reorganized such that most compilation occurs
2988
upon mapper construction. This allows us to have fewer calls to
2989
mapper.compile() and also to allow class-based properties to force a
2990
compilation (i.e. User.addresses == 7 will compile all mappers; this is). The only caveat here is that an inheriting mapper now
2991
looks for its inherited mapper upon construction; so mappers within
2992
inheritance relationships need to be constructed in inheritance order
2993
(which should be the normal case anyway).
2999
added "FETCH" to the keywords detected by Postgres to indicate a
3000
result-row holding statement (i.e. in addition to "SELECT").
3006
Added full list of SQLite reserved keywords so that they get escaped
3013
Tightened up the relationship between the Query's generation of "eager
3014
load" aliases, and Query.instances() which actually grabs the eagerly
3015
loaded rows. If the aliases were not specifically generated for that
3016
statement by EagerLoader, the EagerLoader will not take effect when the
3017
rows are fetched. This prevents columns from being grabbed accidentally
3018
as being part of an eager load when they were not meant for such, which
3019
can happen with textual SQL as well as some inheritance situations. It's
3020
particularly important since the "anonymous aliasing" of columns uses
3021
simple integer counts now to generate labels.
3027
Removed "parameters" argument from clauseelement.compile(), replaced with
3028
"column_keys". The parameters sent to execute() only interact with the
3029
insert/update statement compilation process in terms of the column names
3030
present but not the values for those columns. Produces more consistent
3031
execute/executemany behavior, simplifies things a bit internally.
3037
Added 'comparator' keyword argument to PickleType. By default, "mutable"
3038
PickleType does a "deep compare" of objects using their dumps()
3039
representation. But this doesn't work for dictionaries. Pickled objects
3040
which provide an adequate __eq__() implementation can be set up with
3041
"PickleType(comparator=operator.eq)"
3047
Added session.is_modified(obj) method; performs the same "history"
3048
comparison operation as occurs within a flush operation; setting
3049
include_collections=False gives the same result as is used when the flush
3050
determines whether or not to issue an UPDATE for the instance's row.
3056
Added "schema" argument to Sequence; use this with Postgres /Oracle when
3057
the sequence is located in an alternate schema. Implements part of, should fix.
3063
Fixed reflection of the empty string for mysql enums.
3069
Changed MySQL dialect to use the older LIMIT <offset>, <limit> syntax
3070
instead of LIMIT <l> OFFSET <o> for folks using 3.23.
3076
Added 'passive_deletes="all"' flag to relation(), disables all nulling-out
3077
of foreign key attributes during a flush where the parent object is
3084
Column defaults and onupdates, executing inline, will add parenthesis for
3085
subqueries and other parenthesis-requiring expressions
3091
The behavior of String/Unicode types regarding that they auto-convert to
3092
TEXT/CLOB when no length is present now occurs *only* for an exact type of
3093
String or Unicode with no arguments. If you use VARCHAR or NCHAR
3094
(subclasses of String/Unicode) with no length, they will be interpreted by
3095
the dialect as VARCHAR/NCHAR; no "magic" conversion happens there. This
3096
is less surprising behavior and in particular this helps Oracle keep
3097
string-based bind parameters as VARCHARs and not CLOBs.
3103
Fixes to ShardedSession to work with deferred columns.
3109
User-defined shard_chooser() function must accept "clause=None" argument;
3110
this is the ClauseElement passed to session.execute(statement) and can be
3111
used to determine correct shard id (since execute() doesn't take an
3118
Adjusted operator precedence of NOT to match '==' and others, so that
3119
~(x <operator> y) produces NOT (x <op> y), which is better compatible
3120
with older MySQL versions.. This doesn't apply to "~(x==y)"
3121
as it does in 0.3 since ~(x==y) compiles to "x != y", but still applies
3122
to operators like BETWEEN.
3126
:tickets: 757, 768, 779, 728
3131
:version: 0.4.0beta5
3138
Connection pool fixes; the better performance of beta4 remains but fixes
3139
"connection overflow" and other bugs which were present (like).
3145
Fixed bugs in determining proper sync clauses from custom inherit
3152
Extended 'engine_from_config' coercion for QueuePool size / overflow.
3158
mysql views can be reflected again.
3164
AssociationProxy can now take custom getters and setters.
3170
Fixed malfunctioning BETWEEN in orm queries.
3176
Fixed OrderedProperties pickling
3182
SQL-expression defaults and sequences now execute "inline" for all
3183
non-primary key columns during an INSERT or UPDATE, and for all columns
3184
during an executemany()-style call. inline=True flag on any insert/update
3185
statement also forces the same behavior with a single execute().
3186
result.postfetch_cols() is a collection of columns for which the previous
3187
single insert or update statement contained a SQL-side default expression.
3193
Fixed PG executemany() behavior.
3199
postgres reflects tables with autoincrement=False for primary key columns
3200
which have no defaults.
3206
postgres no longer wraps executemany() with individual execute() calls,
3207
instead favoring performance. "rowcount"/"concurrency" checks with
3208
deleted items (which use executemany) are disabled with PG since psycopg2
3209
does not report proper rowcount for executemany().
3212
:tags: tickets, fixed
3218
:tags: tickets, fixed
3224
:tags: tickets, fixed
3230
:tags: tickets, fixed
3236
:tags: tickets, fixed
3242
:version: 0.4.0beta4
3243
:released: Wed Aug 22 2007
3249
Tidied up what ends up in your namespace when you 'from sqlalchemy import *':
3255
'table' and 'column' are no longer imported. They remain available by
3256
direct reference (as in 'sql.table' and 'sql.column') or a glob import
3257
from the sql package. It was too easy to accidentally use a
3258
sql.expressions.table instead of schema.Table when just starting out
3259
with SQLAlchemy, likewise column.
3265
Internal-ish classes like ClauseElement, FromClause, NullTypeEngine,
3266
etc., are also no longer imported into your namespace
3272
The 'Smallinteger' compatiblity name (small i!) is no longer imported,
3273
but remains in schema.py for now. SmallInteger (big I!) is still
3280
The connection pool uses a "threadlocal" strategy internally to return
3281
the same connection already bound to a thread, for "contextual" connections;
3282
these are the connections used when you do a "connectionless" execution
3283
like insert().execute(). This is like a "partial" version of the
3284
"threadlocal" engine strategy but without the thread-local transaction part
3285
of it. We're hoping it reduces connection pool overhead as well as
3286
database usage. However, if it proves to impact stability in a negative way,
3287
we'll roll it right back.
3293
Fix to bind param processing such that "False" values (like blank strings)
3294
still get processed/encoded.
3300
Fix to select() "generative" behavior, such that calling column(),
3301
select_from(), correlate(), and with_prefix() does not modify the
3302
original select object
3308
Added a "legacy" adapter to types, such that user-defined TypeEngine
3309
and TypeDecorator classes which define convert_bind_param() and/or
3310
convert_result_value() will continue to function. Also supports
3311
calling the super() version of those methods.
3317
Added session.prune(), trims away instances cached in a session that
3318
are no longer referenced elsewhere. (A utility for strong-ref
3325
Added close() method to Transaction. Closes out a transaction using
3326
rollback if it's the outermost transaction, otherwise just ends
3327
without affecting the outer transaction.
3333
Transactional and non-transactional Session integrates better with
3334
bound connection; a close() will ensure that connection
3335
transactional state is the same as that which existed on it before
3336
being bound to the Session.
3342
Modified SQL operator functions to be module-level operators,
3343
allowing SQL expressions to be pickleable.
3349
Small adjustment to mapper class.__init__ to allow for Py2.6
3350
object.__init__() behavior.
3356
Fixed 'prefix' argument for select()
3362
Connection.begin() no longer accepts nested=True, this logic is now
3363
all in begin_nested().
3369
Fixes to new "dynamic" relation loader involving cascades
3372
:tags: tickets, fixed
3378
:tags: tickets, fixed
3384
:version: 0.4.0beta3
3385
:released: Thu Aug 16 2007
3391
SQL types optimization:
3397
New performance tests show a combined mass-insert/mass-select test as
3398
having 68% fewer function calls than the same test run against 0.3.
3404
General performance improvement of result set iteration is around 10-20%.
3410
In types.AbstractType, convert_bind_param() and convert_result_value()
3411
have migrated to callable-returning bind_processor() and
3412
result_processor() methods. If no callable is returned, no pre/post
3413
processing function is called.
3419
Hooks added throughout base/sql/defaults to optimize the calling of bind
3420
aram/result processors so that method call overhead is minimized.
3426
Support added for executemany() scenarios such that unneeded "last row id"
3427
logic doesn't kick in, parameters aren't excessively traversed.
3433
Added 'inherit_foreign_keys' arg to mapper().
3439
Added support for string date passthrough in sqlite.
3442
:tags: tickets, fixed
3448
:tags: tickets, fixed
3454
:tags: tickets, fixed
3460
:tags: tickets, fixed
3466
:version: 0.4.0beta2
3467
:released: Tue Aug 14 2007
3470
:tags: oracle, improvements.
3473
Auto-commit after LOAD DATA INFILE for mysql.
3476
:tags: oracle, improvements.
3479
A rudimental SessionExtension class has been added, allowing user-defined
3480
functionality to take place at flush(), commit(), and rollback() boundaries.
3483
:tags: oracle, improvements.
3486
Added engine_from_config() function for helping to create_engine() from an
3490
:tags: oracle, improvements.
3493
base_mapper() becomes a plain attribute.
3496
:tags: oracle, improvements.
3499
session.execute() and scalar() can search for a Table with which to bind from
3500
using the given ClauseElement.
3503
:tags: oracle, improvements.
3506
Session automatically extrapolates tables from mappers with binds, also uses
3507
base_mapper so that inheritance hierarchies bind automatically.
3510
:tags: oracle, improvements.
3513
Moved ClauseVisitor traversal back to inlined non-recursive.
3516
:tags: tickets, fixed
3522
:tags: tickets, fixed
3528
:tags: tickets, fixed
3534
:tags: tickets, fixed
3540
:version: 0.4.0beta1
3541
:released: Sun Aug 12 2007
3547
Speed! Along with recent speedups to ResultProxy, total number of function
3548
calls significantly reduced for large loads.
3554
test/perf/masseagerload.py reports 0.4 as having the fewest number of
3555
function calls across all SA versions (0.1, 0.2, and 0.3).
3561
New collection_class api and implementation. Collections are
3562
now instrumented via decorations rather than proxying. You can now have
3563
collections that manage their own membership, and your class instance will
3564
be directly exposed on the relation property. The changes are transparent
3571
InstrumentedList (as it was) is removed, and relation properties no
3572
longer have 'clear()', '.data', or any other added methods beyond those
3573
provided by the collection type. You are free, of course, to add them to
3580
__setitem__-like assignments now fire remove events for the existing
3587
dict-likes used as collection classes no longer need to change __iter__
3588
semantics- itervalues() is used by default instead. This is a backwards
3589
incompatible change.
3595
Subclassing dict for a mapped collection is no longer needed in most
3596
cases. orm.collections provides canned implementations that key objects
3597
by a specified column or a custom function of your choice.
3603
Collection assignment now requires a compatible type- assigning None to
3604
clear a collection or assigning a list to a dict collection will now
3605
raise an argument error.
3611
AttributeExtension moved to interfaces, and .delete is now .remove The
3612
event method signature has also been swapped around.
3618
Major overhaul for Query:
3624
All selectXXX methods are deprecated. Generative methods are now the
3625
standard way to do things, i.e. filter(), filter_by(), all(), one(),
3626
etc. Deprecated methods are docstring'ed with their new replacements.
3632
Class-level properties are now usable as query elements... no more
3633
'.c.'! "Class.c.propname" is now superceded by "Class.propname". All
3634
clause operators are supported, as well as higher level operators such
3635
as Class.prop==<some instance> for scalar attributes,
3636
Class.prop.contains(<some instance>) and Class.prop.any(<some
3637
expression>) for collection-based attributes (all are also
3638
negatable). Table-based column expressions as well as columns mounted
3639
on mapped classes via 'c' are of course still fully available and can be
3640
freely mixed with the new attributes.
3646
Removed ancient query.select_by_attributename() capability.
3652
The aliasing logic used by eager loading has been generalized, so that
3653
it also adds full automatic aliasing support to Query. It's no longer
3654
necessary to create an explicit Alias to join to the same tables
3655
multiple times; *even for self-referential relationships*.
3657
- join() and outerjoin() take arguments "aliased=True". Yhis causes
3658
their joins to be built on aliased tables; subsequent calls to
3659
filter() and filter_by() will translate all table expressions (yes,
3660
real expressions using the original mapped Table) to be that of the
3661
Alias for the duration of that join() (i.e. until reset_joinpoint() or
3662
another join() is called).
3664
- join() and outerjoin() take arguments "id=<somestring>". When used
3665
with "aliased=True", the id can be referenced by add_entity(cls,
3666
id=<somestring>) so that you can select the joined instances even if
3667
they're from an alias.
3669
- join() and outerjoin() now work with self-referential relationships!
3670
Using "aliased=True", you can join as many levels deep as desired,
3671
i.e. query.join(['children', 'children'], aliased=True); filter
3672
criterion will be against the rightmost joined table
3678
Added query.populate_existing(), marks the query to reload all
3679
attributes and collections of all instances touched in the query,
3680
including eagerly-loaded entities.
3686
Added eagerload_all(), allows eagerload_all('x.y.z') to specify eager
3687
loading of all properties in the given path.
3693
Major overhaul for Session:
3699
New function which "configures" a session called "sessionmaker()". Send
3700
various keyword arguments to this function once, returns a new class
3701
which creates a Session against that stereotype.
3707
SessionTransaction removed from "public" API. You now can call begin()/
3708
commit()/rollback() on the Session itself.
3714
Session also supports SAVEPOINT transactions; call begin_nested().
3720
Session supports two-phase commit behavior when vertically or
3721
horizontally partitioning (i.e., using more than one engine). Use
3728
Session flag "transactional=True" produces a session which always places
3729
itself into a transaction when first used. Upon commit(), rollback() or
3730
close(), the transaction ends; but begins again on the next usage.
3736
Session supports "autoflush=True". This issues a flush() before each
3737
query. Use in conjunction with transactional, and you can just
3738
save()/update() and then query, the new objects will be there. Use
3739
commit() at the end (or flush() if non-transactional) to flush remaining
3746
New scoped_session() function replaces SessionContext and assignmapper.
3747
Builds onto "sessionmaker()" concept to produce a class whos Session()
3748
construction returns the thread-local session. Or, call all Session
3749
methods as class methods, i.e. Session.save(foo); Session.commit().
3750
just like the old "objectstore" days.
3756
Added new "binds" argument to Session to support configuration of
3757
multiple binds with sessionmaker() function.
3763
A rudimental SessionExtension class has been added, allowing
3764
user-defined functionality to take place at flush(), commit(), and
3765
rollback() boundaries.
3771
Query-based relation()s available with dynamic_loader(). This is a
3772
*writable* collection (supporting append() and remove()) which is also a
3773
live Query object when accessed for reads. Ideal for dealing with very
3774
large collections where only partial loading is desired.
3780
flush()-embedded inline INSERT/UPDATE expressions. Assign any SQL
3781
expression, like "sometable.c.column + 1", to an instance's attribute.
3782
Upon flush(), the mapper detects the expression and embeds it directly in
3783
the INSERT or UPDATE statement; the attribute gets deferred on the
3784
instance so it loads the new value the next time you access it.
3790
A rudimental sharding (horizontal scaling) system is introduced. This
3791
system uses a modified Session which can distribute read and write
3792
operations among multiple databases, based on user-defined functions
3793
defining the "sharding strategy". Instances and their dependents can be
3794
distributed and queried among multiple databases based on attribute
3795
values, round-robin approaches or any other user-defined
3802
Eager loading has been enhanced to allow even more joins in more places.
3803
It now functions at any arbitrary depth along self-referential and
3804
cyclical structures. When loading cyclical structures, specify
3805
"join_depth" on relation() indicating how many times you'd like the table
3806
to join to itself; each level gets a distinct table alias. The alias
3807
names themselves are generated at compile time using a simple counting
3808
scheme now and are a lot easier on the eyes, as well as of course
3809
completely deterministic.
3815
Added composite column properties. This allows you to create a type which
3816
is represented by more than one column, when using the ORM. Objects of
3817
the new type are fully functional in query expressions, comparisons,
3818
query.get() clauses, etc. and act as though they are regular single-column
3819
scalars... except they're not! Use the function composite(cls, *columns)
3820
inside of the mapper's "properties" dict, and instances of cls will be
3821
created/mapped to a single attribute, comprised of the values correponding
3828
Improved support for custom column_property() attributes which feature
3829
correlated subqueries, works better with eager loading now.
3835
Primary key "collapse" behavior; the mapper will analyze all columns in
3836
its given selectable for primary key "equivalence", that is, columns which
3837
are equivalent via foreign key relationship or via an explicit
3838
inherit_condition. primarily for joined-table inheritance scenarios where
3839
different named PK columns in inheriting tables should "collapse" into a
3840
single-valued (or fewer-valued) primary key. Fixes things like.
3846
Joined-table inheritance will now generate the primary key columns of all
3847
inherited classes against the root table of the join only. This implies
3848
that each row in the root table is distinct to a single instance. If for
3849
some rare reason this is not desireable, explicit primary_key settings on
3850
individual mappers will override it.
3856
When "polymorphic" flags are used with joined-table or single-table
3857
inheritance, all identity keys are generated against the root class of the
3858
inheritance hierarchy; this allows query.get() to work polymorphically
3859
using the same caching semantics as a non-polymorphic get. Note that this
3860
currently does not work with concrete inheritance.
3866
Secondary inheritance loading: polymorphic mappers can be constructed
3867
*without* a select_table argument. inheriting mappers whose tables were
3868
not represented in the initial load will issue a second SQL query
3869
immediately, once per instance (i.e. not very efficient for large lists),
3870
in order to load the remaining columns.
3876
Secondary inheritance loading can also move its second query into a
3877
column-level "deferred" load, via the "polymorphic_fetch" argument, which
3878
can be set to 'select' or 'deferred'
3884
It's now possible to map only a subset of available selectable columns
3885
onto mapper properties, using include_columns/exclude_columns..
3891
Added undefer_group() MapperOption, sets a set of "deferred" columns
3892
joined by a "group" to load as "undeferred".
3898
Rewrite of the "deterministic alias name" logic to be part of the SQL
3899
layer, produces much simpler alias and label names more in the style of
3906
Speed! Clause compilation as well as the mechanics of SQL constructs have
3907
been streamlined and simplified to a signficant degree, for a 20-30%
3908
improvement of the statement construction/compilation overhead of 0.3.
3914
All "type" keyword arguments, such as those to bindparam(), column(),
3915
Column(), and func.<something>(), renamed to "type_". Those objects still
3916
name their "type" attribute as "type".
3922
case_sensitive=(True|False) setting removed from schema items, since
3923
checking this state added a lot of method call overhead and there was no
3924
decent reason to ever set it to False. Table and column names which are
3925
all lower case will be treated as case-insenstive (yes we adjust for
3926
Oracle's UPPERCASE style too).
3932
Added context manager (with statement) support for transactions.
3938
Added support for two phase commit, works with mysql and postgres so far.
3944
Added a subtransaction implementation that uses savepoints.
3950
Added support for savepoints.
3956
Tables can be reflected from the database en-masse without declaring
3957
them in advance. MetaData(engine, reflect=True) will load all tables
3958
present in the database, or use metadata.reflect() for finer control.
3964
DynamicMetaData has been renamed to ThreadLocalMetaData
3970
The ThreadLocalMetaData constructor now takes no arguments.
3976
BoundMetaData has been removed- regular MetaData is equivalent
3982
Numeric and Float types now have an "asdecimal" flag; defaults to True for
3983
Numeric, False for Float. When True, values are returned as
3984
decimal.Decimal objects; when False, values are returned as float(). The
3985
defaults of True/False are already the behavior for PG and MySQL's DBAPI
3992
New SQL operator implementation which removes all hardcoded operators from
3993
expression structures and moves them into compilation; allows greater
3994
flexibility of operator compilation; for example, "+" compiles to "||"
3995
when used in a string context, or "concat(a,b)" on MySQL; whereas in a
3996
numeric context it compiles to "+". Fixes.
4002
"Anonymous" alias and label names are now generated at SQL compilation
4003
time in a completely deterministic fashion... no more random hex IDs
4009
Significant architectural overhaul to SQL elements (ClauseElement). All
4010
elements share a common "mutability" framework which allows a consistent
4011
approach to in-place modifications of elements as well as generative
4012
behavior. Improves stability of the ORM which makes heavy usage of
4013
mutations to SQL expressions.
4019
select() and union()'s now have "generative" behavior. Methods like
4020
order_by() and group_by() return a *new* instance - the original instance
4021
is left unchanged. Non-generative methods remain as well.
4027
The internals of select/union vastly simplified- all decision making
4028
regarding "is subquery" and "correlation" pushed to SQL generation phase.
4029
select() elements are now *never* mutated by their enclosing containers or
4030
by any dialect's compilation process
4036
select(scalar=True) argument is deprecated; use select(..).as_scalar().
4037
The resulting object obeys the full "column" interface and plays better
4044
Added select().with_prefix('foo') allowing any set of keywords to be
4045
placed before the columns clause of the SELECT
4051
Added array slice support to row[<index>]
4057
Result sets make a better attempt at matching the DBAPI types present in
4058
cursor.description to the TypeEngine objects defined by the dialect, which
4059
are then used for result-processing. Note this only takes effect for
4060
textual SQL; constructed SQL statements always have an explicit type map.
4066
Result sets from CRUD operations close their underlying cursor immediately
4067
and will also autoclose the connection if defined for the operation; this
4068
allows more efficient usage of connections for successive CRUD operations
4069
with less chance of "dangling connections".
4075
Column defaults and onupdate Python functions (i.e. passed to
4076
ColumnDefault) may take zero or one arguments; the one argument is the
4077
ExecutionContext, from which you can call "context.parameters[someparam]"
4078
to access the other bind parameter values affixed to the statement. The connection used for the execution is available as well
4079
so that you can pre-execute statements.
4085
Added "explcit" create/drop/execute support for sequences (i.e. you can
4086
pass a "connectable" to each of those methods on Sequence).
4092
Better quoting of identifiers when manipulating schemas.
4098
Standardized the behavior for table reflection where types can't be
4099
located; NullType is substituted instead, warning is raised.
4105
ColumnCollection (i.e. the 'c' attribute on tables) follows dictionary
4106
semantics for "__contains__"
4112
Speed! The mechanics of result processing and bind parameter processing
4113
have been overhauled, streamlined and optimized to issue as little method
4114
calls as possible. Bench tests for mass INSERT and mass rowset iteration
4115
both show 0.4 to be over twice as fast as 0.3, using 68% fewer function
4122
You can now hook into the pool lifecycle and run SQL statements or other
4123
logic at new each DBAPI connection, pool check-out and check-in.
4129
Connections gain a .properties collection, with contents scoped to the
4130
lifetime of the underlying DBAPI connection
4136
Removed auto_close_cursors and disallow_open_cursors arguments from Pool;
4137
reduces overhead as cursors are normally closed by ResultProxy and
4144
proxyengine is temporarily removed, pending an actually working
4151
SelectResults has been replaced by Query. SelectResults /
4152
SelectResultsExt still exist but just return a slightly modified Query
4153
object for backwards-compatibility. join_to() method from SelectResults
4154
isn't present anymore, need to use join().
4160
Table and column names loaded via reflection are now Unicode.
4166
All standard column types are now supported, including SET.
4172
Table reflection can now be performed in as little as one round-trip.
4178
ANSI and ANSI_QUOTES sql modes are now supported.
4184
Indexes are now reflected.
4190
Added PGArray datatype for using postgres array datatypes.
4196
Very rudimental support for OUT parameters added; use sql.outparam(name,
4197
type) to set up an OUT parameter, just like bindparam(); after execution,
4198
values are avaiable via result.out_parameters dictionary.