0.4 Changelog

0.4.8

Released: Sun Oct 12 2008

orm

  • [orm]

Fixed bug regarding inherit_condition passedwith “A=B” versus “B=A” leading to errorsReferences: #1039

  • [orm]

Changes made to new, dirty and deletedcollections inSessionExtension.before_flush() will takeeffect for that flush.

  • [orm]

Added label() method to InstrumentedAttributeto establish forwards compatibility with 0.5.

sql

  • [sql]

column.in_(someselect) can now be used asa columns-clause expression without the subquerybleeding into the FROM clauseReferences: #1074

mysql

  • [mysql]

Added MSMediumInteger type.References: #1146

sqlite

  • [sqlite]

Supplied a custom strftime() function whichhandles dates before 1900.References: #968

  • [sqlite]

String’s (and Unicode’s, UnicodeText’s, etc.)convert_unicode logic disabled in the sqlite dialect,to adjust for pysqlite 2.5.0’s new requirement thatonly Python unicode objects are accepted;http://itsystementwicklung.de/pipermail/list-pysqlite/2008-March/000018.html

oracle

  • [oracle]

has_sequence() now takes schema name into accountReferences: #1155

  • [oracle]

added BFILE to the list of reflected typesReferences: #1121

0.4.7p1

Released: Thu Jul 31 2008

orm

  • [orm]

Added “add()” and “add_all()” to scoped_sessionmethods. Workaround for 0.4.7:

  1. from sqlalchemy.orm.scoping import ScopedSession, instrument
  2. setattr(ScopedSession, "add", instrument("add"))
  3. setattr(ScopedSession, "add_all", instrument("add_all"))

  • [orm]

Fixed non-2.3 compatible usage of set() and generatorexpression within relation().

0.4.7

Released: Sat Jul 26 2008

orm

  • [orm]

The contains() operator when used with many-to-manywill alias() the secondary (association) table sothat multiple contains() calls will not conflictwith each otherReferences: #1058

  • [orm]

fixed bug preventing merge() from functioning inconjunction with a comparable_property()

  • [orm]

the enable_typechecks=False setting on relation()now only allows subtypes with inheriting mappers.Totally unrelated types, or subtypes not set up withmapper inheritance against the target mapper arestill not allowed.

  • [orm]

Added is_active flag to Sessions to detect whena transaction is in progress. Thisflag is always True with a “transactional”(in 0.5 a non-“autocommit”) Session.References: #976

sql

  • [sql]

Fixed bug when calling select([literal(‘foo’)])or select([bindparam(‘foo’)]).

schema

  • [schema]

create_all(), drop_all(), create(), drop() all raisean error if the table name or schema name containsmore characters than that dialect’s configuredcharacter limit. Some DB’s can handle too-longtable names during usage, and SQLA can handle thisas well. But various reflection/checkfirst-during-create scenarios fail since we arelooking for the name within the DB’s catalog tables.References: #571

  • [schema]

The index name generated when you say “index=True”on a Column is truncated to the length appropriatefor the dialect. Additionally, an Index with a too-long name cannot be explicitly dropped withIndex.drop(), similar to.References: #571, #820

mysql

  • [mysql]

Added ‘CALL’ to the list of SQL keywords which returnresult rows.

oracle

  • [oracle]

Oracle get_default_schema_name() “normalizes” the namebefore returning, meaning it returns a lower-case namewhen the identifier is detected as case insensitive.

  • [oracle]

creating/dropping tables takes schema name into accountwhen searching for the existing table, so that tablesin other owner namespaces with the same name do notconflictReferences: #709

  • [oracle]

Cursors now have “arraysize” set to 50 by default onthem, the value of which is configurable using the“arraysize” argument to create_engine() with theOracle dialect. This to account for cx_oracle’s defaultsetting of “1”, which has the effect of many round tripsbeing sent to Oracle. This actually works well inconjunction with BLOB/CLOB-bound cursors, of whichthere are any number available but only for the life ofthat row request (so BufferedColumnRow is still needed,but less so).References: #1062

  • [oracle]

    • sqlite
      • add SLFloat type, which matches the SQLite REALtype affinity. Previously, only SLNumeric was providedwhich fulfills NUMERIC affinity, but that’s not thesame as REAL.

misc

  • [postgres]

Repaired server_side_cursors to properly detecttext() clauses.

  • [postgres]

Added PGCidr type.References: #1092

0.4.6

Released: Sat May 10 2008

orm

  • [orm]

Fix to the recent relation() refactoring which fixesexotic viewonly relations which join between local andremote table multiple times, with a common column sharedbetween the joins.

  • [orm]

Also re-established viewonly relation() configurationsthat join across multiple tables.

  • [orm]

Added experimental relation() flag to help withprimaryjoins across functions, etc.,_local_remote_pairs=[tuples]. This complements a complexprimaryjoin condition allowing you to provide theindividual column pairs which comprise the relation’slocal and remote sides. Also improved lazy load SQLgeneration to handle placing bind params inside offunctions and other expressions. (partial progresstowards)References: #610

  • [orm]

repaired single table inheritance such that youcan single-table inherit from a joined-table inheritingmapper without issue.References: #1036

  • [orm]

Fixed “concatenate tuple” bug which could occur withQuery.order_by() if clause adaption had taken place.References: #1027

  • [orm]

Removed ancient assertion that mapped selectables require“alias names” - the mapper creates its own alias now ifnone is present. Though in this case you need to use theclass, not the mapped selectable, as the source of columnattributes - so a warning is still issued.

  • [orm]

fixes to the “exists” function involving inheritance (any(),has(), ~contains()); the full target join will be renderedinto the EXISTS clause for relations that link to subclasses.

  • [orm]

restored usage of append_result() extension method for primaryquery rows, when the extension is present and only a single-entity result is being returned.

  • [orm]

Also re-established viewonly relation() configurations thatjoin across multiple tables.

  • [orm]

removed ancient assertion that mapped selectables require“alias names” - the mapper creates its own alias now ifnone is present. Though in this case you need to usethe class, not the mapped selectable, as the source ofcolumn attributes - so a warning is still issued.

  • [orm]

refined mapper.saveobj() which was unnecessarily calling__ne() on scalar values during flushReferences: #1015

  • [orm]

added a feature to eager loading whereby subqueries setas column_property() with explicit label names (which is notnecessary, btw) will have the label anonymized whenthe instance is part of the eager join, to preventconflicts with a subquery or column of the same nameon the parent object.References: #1019

  • [orm]

set-based collections |=, -=, ^= and &= are stricter abouttheir operands and only operate on sets, frozensets orsubclasses of the collection type. Previously, they wouldaccept any duck-typed set.

  • [orm]

added an example dynamic_dict/dynamic_dict.py, illustratinga simple way to place dictionary behavior on top ofa dynamic_loader.

sql

  • [sql]

Added COLLATE support via the .collate()expression operator and collate(, ) sqlfunction.

  • [sql]

Fixed bug with union() when applied to non-Table connectedselect statements

  • [sql]

improved behavior of text() expressions when used asFROM clauses, such as select().select_from(text(“sometext”))References: #1014

  • [sql]

Column.copy() respects the value of “autoincrement”,fixes usage with MigrateReferences: #1021

mssql

  • [mssql]

Added “odbc_autotranslate” parameter to engine / dburiparameters. Any given string will be passed through to theODBC connection string as:

”AutoTranslate=%s” % odbc_autotranslate

References: #1005

  • [mssql]

Added “odbc_options” parameter to engine / dburiparameters. The given string is simply appended to theSQLAlchemy-generated odbc connection string.

This should obviate the need of adding a myriad of ODBCoptions in the future.

firebird

  • [firebird]

Handle the “SUBSTRING(:string FROM :start FOR :length)”builtin.

misc

  • [declarative] [extension]

Joined table inheritance mappers use a slightly relaxedfunction to create the “inherit condition” to the parenttable, so that other foreign keys to not-yet-declaredTable objects don’t trigger an error.

  • [declarative] [extension]

fixed reentrant mapper compile hang whena declared attribute is used within ForeignKey,ie. ForeignKey(MyOtherClass.someattribute)

  • [engines]

Pool listeners can now be provided as a dictionary ofcallables or a (possibly partial) duck-type ofPoolListener, your choice.

  • [engines]

added “rollback_returned” option to Pool which willdisable the rollback() issued when connections arereturned. This flag is only safe to use with a databasewhich does not support transactions (i.e. MySQL/MyISAM).

  • [ext]

set-based association proxies |=, -=, ^= and &= arestricter about their operands and only operate on sets,frozensets or other association proxies. Previously, theywould accept any duck-typed set.

0.4.5

Released: Fri Apr 04 2008

orm

  • [orm]

A small change in behavior to session.merge() - existingobjects are checked for based on primary key attributes, notnecessarily _instance_key. So the widely requestedcapability, that:

x = MyObject(id=1)x = sess.merge(x)

will in fact load MyObject with id #1 from the database ifpresent, is now available. merge() still copies the stateof the given object to the persistent one, so an examplelike the above would typically have copied “None” from allattributes of “x” onto the persistent copy. These can bereverted using session.expire(x).

  • [orm]

Also fixed behavior in merge() whereby collection elementspresent on the destination but not the merged collectionwere not being removed from the destination.

  • [orm]

Added a more aggressive check for “uncompiled mappers”,helps particularly with declarative layerReferences: #995

  • [orm]

The methodology behind “primaryjoin”/”secondaryjoin” hasbeen refactored. Behavior should be slightly moreintelligent, primarily in terms of error messages whichhave been pared down to be more readable. In a slightnumber of scenarios it can better resolve the correctforeign key than before.

  • [orm]

Added comparable_property(), adds query Comparatorbehavior to regular, unmanaged Python properties

  • [orm] [‘machines’] [Company.employees.of_type(Engineer)]

the functionality of query.with_polymorphic() hasbeen added to mapper() as a configuration option.

  • It’s set via several forms:
  • with_polymorphic=’’with_polymorphic=[mappers]with_polymorphic=(‘’, selectable)with_polymorphic=([mappers], selectable)

This controls the default polymorphic loading strategyfor inherited mappers. When a selectable is not given,outer joins are created for all joined-table inheritingmappers requested. Note that the auto-create of joinsis not compatible with concrete table inheritance.

The existing select_table flag on mapper() is nowdeprecated and is synonymous withwith_polymorphic(‘*’, select_table). Note that theunderlying “guts” of select_table have beencompletely removed and replaced with the newer,more flexible approach.

The new approach also automatically allows eager loadsto work for subclasses, if they are present, forexample:

  1. sess.query(Company).options(
  2. eagerload_all(
  3. ))

to load Company objects, their employees, and the‘machines’ collection of employees who happen to beEngineers. A “with_polymorphic” Query option should beintroduced soon as well which would allow per-Querycontrol of with_polymorphic() on relations.

  • [orm]

added two “experimental” features to Query,“experimental” in that their specific name/behavioris not carved in stone just yet: _values() and_from_self(). We’d like feedback on these.

  • _values(*columns) is given a list of columnexpressions, and returns a new Query that onlyreturns those columns. When evaluated, the returnvalue is a list of tuples just like when usingadd_column() or add_entity(), the only difference isthat “entity zero”, i.e. the mapped class, is notincluded in the results. This means it finally makessense to use group_by() and having() on Query, whichhave been sitting around uselessly until now.

A future change to this method may include that itsability to join, filter and allow other options notrelated to a “resultset” are removed, so the feedbackwe’re looking for is how people want to use_values()…i.e. at the very end, or do people preferto continue generating after it’s called.

  • _from_self() compiles the SELECT statement for theQuery (minus any eager loaders), and returns a newQuery that selects from that SELECT. So basically youcan query from a Query without needing to extract theSELECT statement manually. This gives meaning tooperations like query[3:5]._from_self().filter(somecriterion). There’s not much controversial hereexcept that you can quickly create highly nestedqueries that are less efficient, and we want feedbackon the naming choice.
  • [orm]

query.order_by() and query.group_by() will acceptmultiple arguments using *args (like select()already does).

  • [orm]

Added some convenience descriptors to Query:query.statement returns the full SELECT construct,query.whereclause returns just the WHERE part of theSELECT construct.

  • [orm]

Fixed/covered case when using a False/0 value as apolymorphic discriminator.

  • [orm]

Fixed bug which was preventing synonym() attributes frombeing used with inheritance

  • [orm]

Fixed SQL function truncation of trailing underscoresReferences: #996

  • [orm]

When attributes are expired on a pending instance, anerror will not be raised when the “refresh” action istriggered and no result is found.

  • [orm]

Session.execute can now find binds from metadata

  • [orm]

Adjusted the definition of “self-referential” to be anytwo mappers with a common parent (this affects whether ornot aliased=True is required when joining with Query).

  • [orm]

Made some fixes to the “from_joinpoint” argument toquery.join() so that if the previous join was aliased andthis one isn’t, the join still happens successfully.

  • [orm]

    • Assorted “cascade deletes” fixes:
      • Fixed “cascade delete” operation of dynamic relations,which had only been implemented for foreign-keynulling behavior in 0.4.2 and not actual cascadingdeletes

      • Delete cascade without delete-orphan cascade on amany-to-one will not delete orphans which weredisconnected from the parent before session.delete()is called on the parent (one-to-many already hadthis).

      • Delete cascade with delete-orphan will delete orphanswhether or not it remains attached to its also-deletedparent.

      • delete-orphan cascade is properly detected on relationsthat are present on superclasses when using inheritance.References: #895

  • [orm]

Fixed order_by calculation in Query to properly aliasmapper-config’ed order_by when using select_from()

  • [orm]

Refactored the diffing logic that kicks in when replacingone collection with another into collections.bulk_replace,useful to anyone building multi-level collections.

  • [orm]

Cascade traversal algorithm converted from recursive toiterative to support deep object graphs.

sql

  • [sql]

schema-qualified tables now will place the schemanameahead of the tablename in all column expressions as wellas when generating column labels. This prevents cross-schema name collisions in all casesReferences: #999

  • [sql]

can now allow selects which correlate all FROM clausesand have no FROM themselves. These are typicallyused in a scalar context, i.e. SELECT x, (SELECT x WHERE y)FROM table. Requires explicit correlate() call.

  • [sql]

‘name’ is no longer a required constructor argument forColumn(). It (and .key) may now be deferred until thecolumn is added to a Table.

  • [sql]

like(), ilike(), contains(), startswith(), endswith() takean optional keyword argument “escape=”, whichis set as the escape character using the syntax “x LIKE yESCAPE ‘’”.References: #791, #993

  • [sql]

random() is now a generic sql function and will compile tothe database’s random implementation, if any.

  • [sql]

update().values() and insert().values() take keywordarguments.

  • [sql]

Fixed an issue in select() regarding its generation ofFROM clauses, in rare circumstances two clauses could beproduced when one was intended to cancel out the other.Some ORM queries with lots of eager loads might have seenthis symptom.

  • [sql]

The case() function now also takes a dictionary as itswhens parameter. It also interprets the “THEN”expressions as values by default, meaning case([(x==y,“foo”)]) will interpret “foo” as a bound value, not a SQLexpression. use text(expr) for literal SQL expressions inthis case. For the criterion itself, these may be literalstrings only if the “value” keyword is present, otherwiseSA will force explicit usage of either text() orliteral().

mysql

  • [mysql]

The connection.info keys the dialect uses to cache serversettings have changed and are now namespaced.

mssql

  • [mssql]

Reflected tables will now automatically load other tableswhich are referenced by Foreign keys in the auto-loadedtable,.References: #979

  • [mssql]

Added executemany check to skip identity fetch,.References: #916

  • [mssql]

Added stubs for small date type.References: #884

  • [mssql]

Added a new ‘driver’ keyword parameter for the pyodbc dialect.Will substitute into the ODBC connection string if given,defaults to ‘SQL Server’.

  • [mssql]

Added a new ‘max_identifier_length’ keyword parameter forthe pyodbc dialect.

  • [mssql]

Improvements to pyodbc + Unix. If you couldn’t get thatcombination to work before, please try again.

oracle

  • [oracle]

The “owner” keyword on Table is now deprecated, and isexactly synonymous with the “schema” keyword. Tables cannow be reflected with alternate “owner” attributes,explicitly stated on the Table object or not using“schema”.

  • [oracle]

All of the “magic” searching for synonyms, DBLINKs etc.during table reflection are disabled by default unless youspecify “oracle_resolve_synonyms=True” on the Tableobject. Resolving synonyms necessarily leads to somemessy guessing which we’d rather leave off by default.When the flag is set, tables and related tables will beresolved against synonyms in all cases, meaning if asynonym exists for a particular table, reflection will useit when reflecting related tables. This is stickierbehavior than before which is why it’s off by default.

misc

  • [declarative] [extension]

The “synonym” function is now directly usable with“declarative”. Pass in the decorated property using the“descriptor” keyword argument, e.g.: somekey =synonym(‘_somekey’, descriptor=property(g, s))

  • [declarative] [extension]

The “deferred” function is usable with “declarative”.Simplest usage is to declare deferred and Column together,e.g.: data = deferred(Column(Text))

  • [declarative] [extension]

Declarative also gained @synonym_for(…) and@comparable_using(…), front-ends for synonym andcomparable_property.

  • [declarative] [extension]

Improvements to mapper compilation when using declarative;already-compiled mappers will still trigger compiles ofother uncompiled mappers when usedReferences: #995

  • [declarative] [extension]

Declarative will complete setup for Columns lacking names,allows a more DRY syntax.

class Foo(Base):

tablename = ‘foos’id = Column(Integer, primary_key=True)

  • [declarative] [extension]

inheritance in declarative can be disabled when sending“inherits=None” to mapper_args.

  • [declarative] [extension]

declarativebase() takes optional kwarg “mapper”, whichis any callable/class/method that produces a mapper,such as declarativebase(mapper=scopedsession.mapper).This property can also be set on individual declarativeclasses using the “__mapper_cls” property.

  • [postgres]

Got PG server side cursors back into shape, added fixedunit tests as part of the default test suite. Addedbetter uniqueness to the cursor IDReferences: #1001

0.4.4

Released: Wed Mar 12 2008

orm

  • [orm]

any(), has(), contains(), ~contains(), attribute level ==and != now work properly with self-referential relations -the clause inside the EXISTS is aliased on the “remote”side to distinguish it from the parent table. Thisapplies to single table self-referential as well asinheritance-based self-referential.

  • [orm]

Repaired behavior of == and != operators at the relation()level when compared against NULL for one-to-one relationsReferences: #985

  • [orm]

Fixed bug whereby session.expire() attributes were notloading on an polymorphically-mapped instance mapped by aselect_table mapper.

  • [orm]

Added query.with_polymorphic() - specifies a list ofclasses which descend from the base class, which will beadded to the FROM clause of the query. Allows subclassesto be used within filter() criterion as well as eagerlyloads the attributes of those subclasses.

  • [orm]

Your cries have been heard: removing a pending item froman attribute or collection with delete-orphan expunges theitem from the session; no FlushError is raised. Note thatif you session.save()’ed the pending item explicitly, theattribute/collection removal still knocks it out.

  • [orm]

session.refresh() and session.expire() raise an error whencalled on instances which are not persistent within thesession

  • [orm]

Fixed potential generative bug when the same Query wasused to generate multiple Query objects using join().

  • [orm]

Fixed bug which was introduced in 0.4.3, whereby loadingan already-persistent instance mapped with joined tableinheritance would trigger a useless “secondary” load fromits joined table, when using the default “select”polymorphicfetch. This was due to attributes beingmarked as expired during its first load and not gettingunmarked from the previous “secondary” load. Attributesare now unexpired based on presence in _dict after anyload or commit operation succeeds.

  • [orm]

Deprecated Query methods apply_sum(), apply_max(),apply_min(), apply_avg(). Better methodologies arecoming….

  • [orm]

relation() can accept a callable for its first argument,which returns the class to be related. This is in placeto assist declarative packages to define relations withoutclasses yet being in place.

  • [orm]

Added a new “higher level” operator called “of_type()”:used in join() as well as with any() and has(), qualifiesthe subclass which will be used in filter criterion, e.g.:

query.filter(Company.employees.of_type(Engineer).

any(Engineer.name==’foo’))

or

query.join(Company.employees.of_type(Engineer)).

filter(Engineer.name==’foo’)

  • [orm]

Preventive code against a potential lost-reference bug inflush().

  • [orm]

Expressions used in filter(), filter_by() and others, whenthey make usage of a clause generated from a relationusing the identity of a child object (e.g.,filter(Parent.child==)), evaluate the actualprimary key value of at execution time so thatthe autoflush step of the Query can complete, therebypopulating the PK value of in the case that was pending.

  • [orm]

setting the relation()-level order by to a column in themany-to-many “secondary” table will now work with eagerloading, previously the “order by” wasn’t aliased againstthe secondary table’s alias.

  • [orm]

Synonyms riding on top of existing descriptors are nowfull proxies to those descriptors.

sql

  • [sql]

Can again create aliases of selects against textual FROMclauses.References: #975

  • [sql]

The value of a bindparam() can be a callable, in whichcase it’s evaluated at statement execution time to get thevalue.

  • [sql]

Added exception wrapping/reconnect support to result setfetching. Reconnect works for those databases that raisea catchable data error during results (i.e. doesn’t workon MySQL)References: #978

  • [sql]

Implemented two-phase API for “threadlocal” engine, viaengine.begin_twophase(), engine.prepare()References: #936

  • [sql]

Fixed bug which was preventing UNIONS from beingcloneable.References: #986

  • [sql]

Added “bind” keyword argument to insert(), update(),delete() and DDL(). The .bind property is now assignableon those statements as well as on select().

  • [sql]

Insert statements can now be compiled with extra “prefix”words between INSERT and INTO, for vendor extensions likeMySQL’s INSERT IGNORE INTO table.

misc

  • [dialects]

Invalid SQLite connection URLs now raise an error.

  • [dialects]

postgres TIMESTAMP renders correctlyReferences: #981

  • [dialects]

postgres PGArray is a “mutable” type by default; when usedwith the ORM, mutable-style equality/ copy-on-writetechniques are used to test for changes.

  • [extensions]

a new super-small “declarative” extension has been added,which allows Table and mapper() configuration to takeplace inline underneath a class declaration. Thisextension differs from ActiveMapper and Elixir in that itdoes not redefine any SQLAlchemy semantics at all; literalColumn, Table and relation() constructs are used to definethe class behavior and table definition.

0.4.3

Released: Thu Feb 14 2008

general

  • [general]

Fixed a variety of hidden and some not-so-hiddencompatibility issues for Python 2.3, thanks to new supportfor running the full test suite on 2.3.

  • [general]

Warnings are now issued as type exceptions.SAWarning.

orm

  • [orm]

Every Session.begin() must now be accompanied by acorresponding commit() or rollback() unless the session isclosed with Session.close(). This also includes the begin()which is implicit to a session created withtransactional=True. The biggest change introduced here isthat when a Session created with transactional=True raisesan exception during flush(), you must callSession.rollback() or Session.close() in order for thatSession to continue after an exception.

  • [orm]

Fixed merge() collection-doubling bug when merging transiententities with backref’ed collections.References: #961

  • [orm]

merge(dont_load=True) does not accept transient entities,this is in continuation with the fact thatmerge(dont_load=True) does not accept any “dirty” objectseither.

  • [orm]

Added standalone “query” class attribute generated by ascoped_session. This provides MyClass.query without usingSession.mapper. Use via:

MyClass.query = Session.query_property()

  • [orm]

The proper error message is raised when trying to accessexpired instance attributes with no session present

  • [orm]

dynamic_loader() / lazy=”dynamic” now accepts and usesthe order_by parameter in the same way in which it workswith relation().

  • [orm]

Added expire_all() method to Session. Calls expire() forall persistent instances. This is handy in conjunctionwith…

  • [orm]

Instances which have been partially or fully expired willhave their expired attributes populated during a regularQuery operation which affects those objects, preventing aneedless second SQL statement for each instance.

  • [orm]

Dynamic relations, when referenced, create a strongreference to the parent object so that the query still has aparent to call against even if the parent is only created(and otherwise dereferenced) within the scope of a singleexpression.References: #938

  • [orm]

Added a mapper() flag “eager_defaults”. When set to True,defaults that are generated during an INSERT or UPDATEoperation are post-fetched immediately, instead of beingdeferred until later. This mimics the old 0.3 behavior.

  • [orm]

query.join() can now accept class-mapped attributes asarguments. These can be used in place or in any combinationwith strings. In particular this allows construction ofjoins to subclasses on a polymorphic relation, i.e.:

query(Company).join([‘employees’, Engineer.name])

  • [orm] [(‘employees’] [Engineer.name] [people.join(engineer))]

query.join() can also accept tuples of attribute name/someselectable as arguments. This allows construction of joinsfrom subclasses of a polymorphic relation, i.e.:

query(Company).join(

)

  • [orm]

General improvements to the behavior of join() inconjunction with polymorphic mappers, i.e. joining from/topolymorphic mappers and properly applying aliases.

  • [orm]

Fixed/improved behavior when a mapper determines the natural“primary key” of a mapped join, it will more effectivelyreduce columns which are equivalent via foreign keyrelation. This affects how many arguments need to be sentto query.get(), among other things.References: #933

  • [orm]

The lazy loader can now handle a join condition where the“bound” column (i.e. the one that gets the parent id sent asa bind parameter) appears more than once in the joincondition. Specifically this allows the common task of arelation() which contains a parent-correlated subquery, suchas “select only the most recent child item”.References: #946

  • [orm]

Fixed bug in polymorphic inheritance where an incorrectexception is raised when base polymorphic_on column does notcorrespond to any columns within the local selectable of aninheriting mapper more than one level deep

  • [orm]

Fixed bug in polymorphic inheritance which made it difficultto set a working “order_by” on a polymorphic mapper.

  • [orm]

Fixed a rather expensive call in Query that was slowing downpolymorphic queries.

  • [orm]

“Passive defaults” and other “inline” defaults can now beloaded during a flush() call if needed; in particular, thisallows constructing relations() where a foreign key columnreferences a server-side-generated, non-primary-keycolumn.References: #954

  • [orm]

    • Additional Session transaction fixes/changes:
      • Fixed bug with session transaction management: parenttransactions weren’t started on the connection whenadding a connection to a nested transaction.

      • session.transaction now always refers to the innermostactive transaction, even when commit/rollback are calleddirectly on the session transaction object.

      • Two-phase transactions can now be prepared.

      • When preparing a two-phase transaction fails on oneconnection, all the connections are rolled back.

      • session.close() didn’t close all transactions whennested transactions were used.

      • rollback() previously erroneously set the currenttransaction directly to the parent of the transactionthat could be rolled back to. Now it rolls back the nexttransaction up that can handle it, but sets the currenttransaction to its parent and inactivates thetransactions in between. Inactive transactions can onlybe rolled back or closed, any other call results in anerror.

      • autoflush for commit() wasn’t flushing for simplesubtransactions.

      • unitofwork flush didn’t close the failed transactionwhen the session was not in a transaction and committingthe transaction failed.

  • [orm]

Miscellaneous tickets:References: #940, #964

sql

  • [sql]

Added “schema.DDL”, an executable free-form DDL statement.DDLs can be executed in isolation or attached to Table orMetaData instances and executed automatically when thoseobjects are created and/or dropped.

  • [sql]

Table columns and constraints can be overridden on a anexisting table (such as a table that was already reflected)using the ‘useexisting=True’ flag, which now takes intoaccount the arguments passed along with it.

  • [sql]

Added a callable-based DDL events interface, adds hooksbefore and after Tables and MetaData create and drop.

  • [sql]

Added generative where() method to delete() andupdate() constructs which return a new object with criterionjoined to existing criterion via AND, just likeselect().where().

  • [sql]

Added “ilike()” operator to column operations. Compiles toILIKE on postgres, lower(x) LIKE lower(y) on allothers.References: #727

  • [sql]

Added “now()” as a generic function; on SQLite, Oracleand MSSQL compiles as “CURRENT_TIMESTAMP”; “now()” onall others.References: #943

  • [sql]

The startswith(), endswith(), and contains() operators nowconcatenate the wildcard operator with the given operand inSQL, i.e. “’%’ || ” in all cases, accepttext(‘something’) operands properlyReferences: #962

  • [sql]

cast() accepts text(‘something’) and other non-literaloperands properlyReferences: #962

  • [sql]

fixed bug in result proxy where anonymously generatedcolumn labels would not be accessible using their straightstring name

  • [sql]

Deferrable constraints can now be defined.

  • [sql]

Added “autocommit=True” keyword argument to select() andtext(), as well as generative autocommit() method onselect(); for statements which modify the database throughsome user-defined means other than the usual INSERT/UPDATE/DELETE etc. This flag will enable “autocommit” behaviorduring execution if no transaction is in progress.References: #915

  • [sql]

The ‘.c.’ attribute on a selectable now gets an entry forevery column expression in its columns clause. Previously,“unnamed” columns like functions and CASE statements weren’tgetting put there. Now they will, using their full stringrepresentation if no ‘name’ is available.

  • [sql]

a CompositeSelect, i.e. any union(), union_all(),intersect(), etc. now asserts that each selectable containsthe same number of columns. This conforms to thecorresponding SQL requirement.

  • [sql]

The anonymous ‘label’ generated for otherwise unlabeledfunctions and expressions now propagates outwards at compiletime for expressions like select([select([func.foo()])]).

  • [sql]

Building on the above ideas, CompositeSelects now build uptheir “.c.” collection based on the names present in thefirst selectable only; corresponding_column() now worksfully for all embedded selectables.

  • [sql]

Oracle and others properly encode SQL used for defaults likesequences, etc., even if no unicode idents are used sinceidentifier preparer may return a cached unicode identifier.

  • [sql]

Column and clause comparisons to datetime objects on theleft hand side of the expression now work (d < table.c.col).(datetimes on the RHS have always worked, the LHS exceptionis a quirk of the datetime implementation.)

misc

  • [dialects]

Better support for schemas in SQLite (linked in by ATTACHDATABASE … AS name). In some cases in the past, schemanames were omitted from generated SQL for SQLite. This isno longer the case.

  • [dialects]

table_names on SQLite now picks up temporary tables as well.

  • [dialects]

Auto-detect an unspecified MySQL ANSI_QUOTES mode duringreflection operations, support for changing the modemidstream. Manual mode setting is still required if noreflection is used.

  • [dialects]

Fixed reflection of TIME columns on SQLite.

  • [dialects]

Finally added PGMacAddr type to postgresReferences: #580

  • [dialects]

Reflect the sequence associated to a PK field (typicallywith a BEFORE INSERT trigger) under Firebird

  • [dialects]

Oracle assembles the correct columns in the result setcolumn mapping when generating a LIMIT/OFFSET subquery,allows columns to map properly to result sets even iflong-name truncation kicks inReferences: #941

  • [dialects]

MSSQL now includes EXEC in the _is_select regexp, whichshould allow row-returning stored procedures to be used.

  • [dialects]

MSSQL now includes an experimental implementation ofLIMIT/OFFSET using the ANSI SQL row_number() function, so itrequires MSSQL-2005 or higher. To enable the feature, add“has_window_funcs” to the keyword arguments for connect, oradd “?has_window_funcs=1” to your dburi query arguments.

  • [ext]

Changed ext.activemapper to use a non-transactional sessionfor the objectstore.

  • [ext]

Fixed output order of “[‘a’] + obj.proxied” binary operationon association-proxied lists.

0.4.2p3

Released: Wed Jan 09 2008

general

  • [general]

sub version numbering scheme changed to suitesetuptools version number rules; easy_install -ushould now get this version over 0.4.2.

orm

  • [orm]

fixed bug with session.dirty when using “mutablescalars” (such as PickleTypes)

  • [orm]

added a more descriptive error message when flushingon a relation() that has non-locally-mapped columnsin its primary or secondary join condition

  • [orm]

suppressing all errors inInstanceState.__cleanup() now.

  • [orm]

fixed an attribute history bug whereby assigning anew collection to a collection-based attribute whichalready had pending changes would generate incorrecthistoryReferences: #922

  • [orm]

fixed delete-orphan cascade bug whereby setting thesame object twice to a scalar attribute could log itas an orphanReferences: #925

  • [orm]

Fixed cascades on a += assignment to a list-basedrelation.

  • [orm]

synonyms can now be created against props that don’texist yet, which are later added via add_property().This commonly includes backrefs. (i.e. you can makesynonyms for backrefs without worrying about theorder of operations)References: #919

  • [orm]

fixed bug which could occur with polymorphic “union”mapper which falls back to “deferred” loading ofinheriting tables

  • [orm]

the “columns” collection on a mapper/mapped class(i.e. ‘c’) is against the mapped table, not theselect_table in the case of polymorphic “union”loading (this shouldn’t be noticeable).

  • [orm]

fixed fairly critical bug whereby the same instance could be listedmore than once in the unitofwork.new collection; most typicallyreproduced when using a combination of inheriting mappers andScopedSession.mapper, as the multiple init calls per instancecould save() the object with distinct _state objects

  • [orm]

added very rudimentary yielding iterator behavior to Query. Callquery.yield_per() and evaluate the Query in aniterative context; every collection of N rows will be packaged upand yielded. Use this method with extreme caution since it doesnot attempt to reconcile eagerly loaded collections acrossresult batch boundaries, nor will it behave nicely if the sameinstance occurs in more than one batch. This means that an eagerlyloaded collection will get cleared out if it’s referenced in more thanone batch, and in all cases attributes will be overwritten on instancesthat occur in more than one batch.

  • [orm]

Fixed in-place set mutation operators for set collections and associationproxied sets.References: #920

sql

  • [sql]

Text type is properly exported now and does notraise a warning on DDL create; String types with nolength only raise warnings during CREATE TABLEReferences: #912

  • [sql]

new UnicodeText type is added, to specify anencoded, unlengthed Text type

  • [sql]

fixed bug in union() so that select() statementswhich don’t derive from FromClause objects can beunioned

  • [sql]

changed name of TEXT to Text since its a “generic”type; TEXT name is deprecated until 0.5. The“upgrading” behavior of String to Text when nolength is present is also deprecated until 0.5; willissue a warning when used for CREATE TABLEstatements (String with no length for SQL expressionpurposes is still fine)References: #912

  • [sql]

generative select.order_by(None) / group_by(None)was not managing to reset order by/group bycriterion, fixedReferences: #924

misc

  • [dialects]

Fixed reflection of mysql empty string columndefaults.

  • [ext]

‘+’, ‘’, ‘+=’ and ‘=’ support for associationproxied lists.

  • [dialects]

mssql - narrowed down the test for “date”/”datetime”in MSDate/ MSDateTime subclasses so that incoming“datetime” objects don’t get mis-interpreted as“date” objects and vice versa.References: #923

  • [dialects]

Fixed the missing call to subtype result processor for the PGArraytype.References: #913

0.4.2

Released: Wed Jan 02 2008

orm

  • [orm]

a major behavioral change to collection-based backrefs: they nolonger trigger lazy loads ! “reverse” adds and removesare queued up and are merged with the collection when it isactually read from and loaded; but do not trigger a load beforehand.For users who have noticed this behavior, this should be much moreconvenient than using dynamic relations in some cases; for those whohave not, you might notice your apps using a lot fewer queries thanbefore in some situations.References: #871

  • [orm]

mutable primary key support is added. primary key columns can bechanged freely, and the identity of the instance will change uponflush. In addition, update cascades of foreign key referents (primarykey or not) along relations are supported, either in tandem with thedatabase’s ON UPDATE CASCADE (required for DB’s like Postgres) orissued directly by the ORM in the form of UPDATE statements, by settingthe flag “passive_cascades=False”.

  • [orm]

inheriting mappers now inherit the MapperExtensions of their parentmapper directly, so that all methods for a particular MapperExtensionare called for subclasses as well. As always, any MapperExtensioncan return either EXT_CONTINUE to continue extension processingor EXT_STOP to stop processing. The order of mapper resolution is: .

Note that if you instantiate the same extension class separatelyand then apply it individually for two mappers in the same inheritancechain, the extension will be applied twice to the inheriting class,and each method will be called twice.

To apply a mapper extension explicitly to each inheriting class buthave each method called only once per operation, use the sameinstance of the extension for both mappers.References: #490

  • [orm]

MapperExtension.before_update() and after_update() are now calledsymmetrically; previously, an instance that had no modified columnattributes (but had a relation() modification) could be called withbefore_update() but not after_update()References: #907

  • [orm]

columns which are missing from a Query’s select statementnow get automatically deferred during load.

  • [orm]

mapped classes which extend “object” and do not provide aninit() method will now raise TypeError if non-empty argsor *kwargs are present at instance construction time (and arenot consumed by any extensions such as the scoped_session mapper),consistent with the behavior of normal Python classesReferences: #908

  • [orm]

fixed Query bug when filter_by() compares a relation against NoneReferences: #899

  • [orm]

improved support for pickling of mapped entities. Per-instancelazy/deferred/expired callables are now serializable so thatthey serialize and deserialize with _state.

  • [orm]

new synonym() behavior: an attribute will be placed on the mappedclass, if one does not exist already, in all cases. if a propertyalready exists on the class, the synonym will decorate the propertywith the appropriate comparison operators so that it can be used incolumn expressions just like any other mapped attribute (i.e. usable infilter(), etc.) the “proxy=True” flag is deprecated and no longer meansanything. Additionally, the flag “map_column=True” will automaticallygenerate a ColumnProperty corresponding to the name of the synonym,i.e.: ‘somename’:synonym(‘_somename’, map_column=True) will map thecolumn named ‘somename’ to the attribute ‘_somename’. See the examplein the mapper docs.References: #801

  • [orm]

Query.select_from() now replaces all existing FROM criterion withthe given argument; the previous behavior of constructing a listof FROM clauses was generally not useful as is requiredfilter() calls to create join criterion, and new tables introducedwithin filter() already add themselves to the FROM clause. Thenew behavior allows not just joins from the main table, but selectstatements as well. Filter criterion, order bys, eager loadclauses will be “aliased” against the given statement.

  • [orm]

this month’s refactoring of attribute instrumentation changesthe “copy-on-load” behavior we’ve had since midway through 0.3with “copy-on-modify” in most cases. This takes a sizable chunkof latency out of load operations and overall does less workas only attributes which are actually modified get their“committed state” copied. Only “mutable scalar” attributes(i.e. a pickled object or other mutable item), the reason forthe copy-on-load change in the first place, retain the oldbehavior.

  • [orm] [attrname]

a slight behavioral change to attributes is, del’ing an attributedoes not cause the lazyloader of that attribute to fire off again;the “del” makes the effective value of the attribute “None”. Tore-trigger the “loader” for an attribute, usesession.expire(instance,).

  • [orm]

query.filter(SomeClass.somechild == None), when comparinga many-to-one property to None, properly generates “id IS NULL”including that the NULL is on the right side.

  • [orm]

query.order_by() takes into account aliased joins, i.e.query.join(‘orders’, aliased=True).order_by(Order.id)

  • [orm]

eagerload(), lazyload(), eagerload_all() take an optionalsecond class-or-mapper argument, which will select the mapperto apply the option towards. This can select among othermappers which were added using add_entity().

  • [orm]

eagerloading will work with mappers added via add_entity().

  • [orm]

added “cascade delete” behavior to “dynamic” relations just likethat of regular relations. if passive_deletes flag (also just added)is not set, a delete of the parent item will trigger a full load ofthe child items so that they can be deleted or updated accordingly.

  • [orm]

also with dynamic, implemented correct count() behavior as wellas other helper methods.

  • [orm]

fix to cascades on polymorphic relations, such that cascadesfrom an object to a polymorphic collection continue cascadingalong the set of attributes specific to each element in the collection.

  • [orm]

query.get() and query.load() do not take existing filter or othercriterion into account; these methods always look up the given idin the database or return the current instance from the identity map,disregarding any existing filter, join, group_by or other criterionwhich has been configured.References: #893

  • [orm]

added support for version_id_col in conjunction with inheriting mappers.version_id_col is typically set on the base mapper in an inheritancerelationship where it takes effect for all inheriting mappers.References: #883

  • [orm]

relaxed rules on column_property() expressions having labels; anyColumnElement is accepted now, as the compiler auto-labels non-labeledColumnElements now. a selectable, like a select() statement, stillrequires conversion to ColumnElement via as_scalar() or label().

  • [orm]

fixed backref bug where you could not del instance.attr if attrwas None

  • [orm]

several ORM attributes have been removed or made private:mapper.get_attr_by_column(), mapper.set_attr_by_column(),mapper.pks_by_table, mapper.cascade_callable(),MapperProperty.cascade_callable(), mapper.canload(),mapper.save_obj(), mapper.delete_obj(), mapper._mapper_registry,attributes.AttributeManager

  • [orm]

Assigning an incompatible collection type to a relation attribute nowraises TypeError instead of sqlalchemy’s ArgumentError.

  • [orm]

Bulk assignment of a MappedCollection now raises an error if a key in theincoming dictionary does not match the key that the collection’s keyfuncwould use for that value.References: #886

  • [orm] [newval1] [newval2]

Custom collections can now specify a @converter method to translateobjects used in “bulk” assignment into a stream of values, as in:

  1. obj.col =
  2. # or
  3. obj.dictcol = {'foo': newval1, 'bar': newval2}

The MappedCollection uses this hook to ensure that incoming key/valuepairs are sane from the collection’s perspective.

  • [orm]

fixed endless loop issue when using lazy=”dynamic” on bothsides of a bi-directional relationshipReferences: #872

  • [orm]

more fixes to the LIMIT/OFFSET aliasing applied with Query + eagerloads,in this case when mapped against a select statementReferences: #904

  • [orm]

fix to self-referential eager loading such that if the same mappedinstance appears in two or more distinct sets of columns in the sameresult set, its eagerly loaded collection will be populated regardlessof whether or not all of the rows contain a set of “eager” columns forthat collection. this would also show up as a KeyError when fetchingresults with join_depth turned on.

  • [orm]

fixed bug where Query would not apply a subquery to the SQL when LIMITwas used in conjunction with an inheriting mapper where the eagerloader was only in the parent mapper.

  • [orm]

clarified the error message which occurs when you try to update()an instance with the same identity key as an instance already presentin the session.

  • [orm]

some clarifications and fixes to merge(instance, dont_load=True).fixed bug where lazy loaders were getting disabled on returned instances.Also, we currently do not support merging an instance which has uncommittedchanges on it, in the case that dont_load=True is used….this willnow raise an error. This is due to complexities in merging the“committed state” of the given instance to correctly correspond to thenewly copied instance, as well as other modified state.Since the use case for dont_load=True is caching, the given instancesshouldn’t have any uncommitted changes on them anyway.We also copy the instances over without using any events now, so thatthe ‘dirty’ list on the new session remains unaffected.

  • [orm]

fixed bug which could arise when using session.begin_nested() in conjunctionwith more than one level deep of enclosing session.begin() statements

  • [orm]

fixed session.refresh() with instance that has custom entity_nameReferences: #914

sql

  • [sql]

generic functions ! we introduce a database of known SQL functions, suchas current_timestamp, coalesce, and create explicit function objectsrepresenting them. These objects have constrained argument lists, aretype aware, and can compile in a dialect-specific fashion. So sayingfunc.char_length(“foo”, “bar”) raises an error (too many args),func.coalesce(datetime.date(2007, 10, 5), datetime.date(2005, 10, 15))knows that its return type is a Date. We only have a few functionsrepresented so far but will continue to add to the systemReferences: #615

  • [sql]

auto-reconnect support improved; a Connection can now automaticallyreconnect after its underlying connection is invalidated, withoutneeding to connect() again from the engine. This allows an ORM sessionbound to a single Connection to not need a reconnect.Open transactions on the Connection must be rolled back after an invalidationof the underlying connection else an error is raised. Also fixedbug where disconnect detect was not being called for cursor(), rollback(),or commit().

  • [sql]

added new flag to String and createengine(),assert_unicode=(True|False|’warn’|None). Defaults to _False or None oncreateengine() and String, ‘warn’ on the Unicode type. When _True,results in all unicode conversion operations raising an exception when anon-unicode bytestring is passed as a bind parameter. ‘warn’ resultsin a warning. It is strongly advised that all unicode-aware applicationsmake proper use of Python unicode objects (i.e. u’hello’ and not ‘hello’)so that data round trips accurately.

  • [sql]

generation of “unique” bind parameters has been simplified to use the same“unique identifier” mechanisms as everything else. This doesn’t affectuser code, except any code that might have been hardcoded against the generatednames. Generated bind params now have the form “_”,whereas before only the second bind of the same name would have this form.

  • [sql]

select().as_scalar() will raise an exception if the select does not haveexactly one expression in its columns clause.

  • [sql]

bindparam() objects themselves can be used as keys for execute(), i.e.statement.execute({bind1:’foo’, bind2:’bar’})

  • [sql]

added new methods to TypeDecorator, process_bind_param() andprocess_result_value(), which automatically take advantage of the processingof the underlying type. Ideal for using with Unicode or Pickletype.TypeDecorator should now be the primary way to augment the behavior of anyexisting type including other TypeDecorator subclasses such as PickleType.

  • [sql]

selectables (and others) will issue a warning when two columns intheir exported columns collection conflict based on name.

  • [sql]

tables with schemas can still be used in sqlite, firebird,schema name just gets droppedReferences: #890

  • [sql]

changed the various “literal” generation functions to use an anonymousbind parameter. not much changes here except their labels now looklike “:param_1”, “:param_2” instead of “:literal”

  • [sql]

column labels in the form “tablename.columname”, i.e. with a dot, are nowsupported.

  • [sql]

from_obj keyword argument to select() can be a scalar or a list.

firebird

  • [firebird] [backend]

does properly reflect domains (partially fixing) andPassiveDefaultsReferences: #410

  • [firebird] [3562] [backend]

reverted to use default poolclass (was set to SingletonThreadPool in0.4.0 for test purposes)

  • [firebird] [backend]

map func.length() to ‘char_length’ (easily overridable with the UDF‘strlen’ on old versions of Firebird)

misc

  • [dialects]

sqlite SLDate type will not erroneously render “microseconds” portionof a datetime or time object.

  • [dialects]

    • oracle
      • added disconnect detection support for Oracle

      • some cleanup to binary/raw types so that cx_oracle.LOB is detectedon an ad-hoc basisReferences: #902

  • [dialects]

    • MSSQL
      • PyODBC no longer has a global “set nocount on”.

      • Fix non-identity integer PKs on autoload

      • Better support for convert_unicode

      • Less strict date conversion for pyodbc/adodbapi

      • Schema-qualified tables / autoloadReferences: #824, #839, #842, #901

0.4.1

Released: Sun Nov 18 2007

orm

  • [orm]

eager loading with LIMIT/OFFSET applied no longer adds the primarytable joined to a limited subquery of itself; the eager loads nowjoin directly to the subquery which also provides the primary table’scolumns to the result set. This eliminates a JOIN from all eager loadswith LIMIT/OFFSET.References: #843

  • [orm]

session.refresh() and session.expire() now support an additional argument“attribute_names”, a list of individual attribute keynames to be refreshedor expired, allowing partial reloads of attributes on an already-loadedinstance.References: #802

  • [orm]

added op() operator to instrumented attributes; i.e.User.name.op(‘ilike’)(‘%somename%’)References: #767

  • [orm]

Mapped classes may now define eq, hash, and nonzero methodswith arbitrary semantics. The orm now handles all mapped instances onan identity-only basis. (e.g. ‘is’ vs ‘==’)References: #676

  • [orm]

the “properties” accessor on Mapper is removed; it now throws an informativeexception explaining the usage of mapper.get_property() andmapper.iterate_properties

  • [orm]

added having() method to Query, applies HAVING to the generated statementin the same way as filter() appends to the WHERE clause.

  • [orm]

The behavior of query.options() is now fully based on paths, i.e. anoption such as eagerload_all(‘x.y.z.y.x’) will apply eagerloading toonly those paths, i.e. and not ‘x.y.x’; eagerload(‘children.children’)applies only to exactly two-levels deep, etc.References: #777

  • [orm]

PickleType will compare using == when set up with mutable=False,and not the is operator. To use is or any other comparator, sendin a custom comparison function using PickleType(comparator=my_custom_comparator).

  • [orm]

query doesn’t throw an error if you use distinct() and an order_by()containing UnaryExpressions (or other) togetherReferences: #848

  • [orm]

order_by() expressions from joined tables are properly added to columnsclause when using distinct()References: #786

  • [orm]

fixed error where Query.add_column() would not accept a class-boundattribute as an argument; Query also raises an error if an invalidargument was sent to add_column() (at instances() time)References: #858

  • [orm]

added a little more checking for garbage-collection dereferences inInstanceState.__cleanup() to reduce “gc ignored” errors on appshutdown

  • [orm]

The session API has been solidified:

  • [orm]

It’s an error to session.save() an object which is alreadypersistentReferences: #840

  • [orm]

It’s an error to session.delete() an object which is _not_persistent.

  • [orm]

session.update() and session.delete() raise an error when updatingor deleting an instance that is already in the session with adifferent identity.

  • [orm]

The session checks more carefully when determining “object X alreadyin another session”; e.g. if you pickle a series of objects andunpickle (i.e. as in a Pylons HTTP session or similar), they can gointo a new session without any conflict

  • [orm]

merge() includes a keyword argument “dont_load=True”. setting thisflag will cause the merge operation to not load any data from thedatabase in response to incoming detached objects, and will acceptthe incoming detached object as though it were already present inthat session. Use this to merge detached objects from externalcaching systems into the session.

  • [orm]

Deferred column attributes no longer trigger a load operation when theattribute is assigned to. In those cases, the newly assigned valuewill be present in the flushes’ UPDATE statement unconditionally.

  • [orm]

Fixed a truncation error when re-assigning a subset of a collection(obj.relation = obj.relation[1:])References: #834

  • [orm]

De-cruftified backref configuration code, backrefs which step onexisting properties now raise an errorReferences: #832

  • [orm]

Improved behavior of add_property() etc., fixed involvingsynonym/deferred.References: #831

  • [orm]

Fixed clear_mappers() behavior to better clean up after itself.

  • [orm]

Fix to “row switch” behavior, i.e. when an INSERT/DELETE is combinedinto a single UPDATE; many-to-many relations on the parent objectupdate properly.References: #841

  • [orm]

Fixed hash for association proxy- these collections are unhashable,just like their mutable Python counterparts.

  • [orm]

Added proxying of saveorupdate, contains and __iter methods forscoped sessions.

  • [orm]

fixed very hard-to-reproduce issue where by the FROM clause of Querycould get polluted by certain generative callsReferences: #852

sql

  • [sql]

the “shortname” keyword parameter on bindparam() has beendeprecated.

  • [sql]

Added contains operator (generates a “LIKE %%” clause).

  • [sql]

anonymous column expressions are automatically labeled.e.g. select([x 5]) produces “SELECT x 5 AS anon_1”.This allows the labelname to be present in the cursor.descriptionwhich can then be appropriately matched to result-column processingrules. (we can’t reliably use positional tracking for result-columnmatches since text() expressions may represent multiple columns).

  • [sql]

operator overloading is now controlled by TypeEngine objects - theone built-in operator overload so far is String types overloading‘+’ to be the string concatenation operator.User-defined types can also define their own operator overloadingby overriding the adapt_operator(self, op) method.

  • [sql]

untyped bind parameters on the right side of a binary expressionwill be assigned the type of the left side of the operation, to betterenable the appropriate bind parameter processing to take effectReferences: #819

  • [sql]

Removed regular expression step from most statement compilations.Also fixesReferences: #833

  • [sql]

Fixed empty (zero column) sqlite inserts, allowing inserts onautoincrementing single column tables.

  • [sql]

Fixed expression translation of text() clauses; this repairs variousORM scenarios where literal text is used for SQL expressions

  • [sql]

Removed ClauseParameters object; compiled.params returns a regulardictionary now, as well as result.last_inserted_params() /last_updated_params().

  • [sql]

Fixed INSERT statements w.r.t. primary key columns that haveSQL-expression based default generators on them; SQL expressionexecutes inline as normal but will not trigger a “postfetch” conditionfor the column, for those DB’s who provide it via cursor.lastrowid

  • [sql]

func. objects can be pickled/unpickledReferences: #844

  • [sql]

rewrote and simplified the system used to “target” columns acrossselectable expressions. On the SQL side this is represented by the“corresponding_column()” method. This method is used heavily by the ORMto “adapt” elements of an expression to similar, aliased expressions,as well as to target result set columns originally bound to atable or selectable to an aliased, “corresponding” expression. The newrewrite features completely consistent and accurate behavior.

  • [sql]

Added a field (“info”) for storing arbitrary data on schema itemsReferences: #573

  • [sql]

The “properties” collection on Connections has been renamed “info” tomatch schema’s writable collections. Access is still available viathe “properties” name until 0.5.

  • [sql]

fixed the close() method on Transaction when using strategy=’threadlocal’

  • [sql]

fix to compiled bind parameters to not mistakenly populate NoneReferences: #853

  • [sql]

._execute_clauseelement becomes a public methodConnectable.execute_clauseelement

misc

  • [dialects]

Added experimental support for MaxDB (versions >= 7.6.03.007 only).

  • [dialects]

oracle will now reflect “DATE” as an OracleDateTime column, notOracleDate

  • [dialects]

added awareness of schema name in oracle table_names() function,fixes metadata.reflect(schema=’someschema’)References: #847

  • [dialects]

MSSQL anonymous labels for selection of functions made deterministic

  • [dialects]

sqlite will reflect “DECIMAL” as a numeric column.

  • [dialects]

Made access dao detection more reliableReferences: #828

  • [dialects]

Renamed the Dialect attribute ‘preexecute_sequences’ to‘preexecute_pk_sequences’. An attribute proxy is in place forout-of-tree dialects using the old name.

  • [dialects]

Added test coverage for unknown type reflection. Fixed sqlite/mysqlhandling of type reflection for unknown types.

  • [dialects]

Added REAL for mysql dialect (for folks exploiting theREAL_AS_FLOAT sql mode).

  • [dialects]

mysql Float, MSFloat and MSDouble constructed without argumentsnow produce no-argument DDL, e.g.’FLOAT’.

  • [misc]

Removed unused util.hash().

0.4.0

Released: Wed Oct 17 2007

(see 0.4.0beta1 for the start of major changes against 0.3,as well as http://www.sqlalchemy.org/trac/wiki/WhatsNewIn04 )

Added initial Sybase support (mxODBC so far)References: #785

Added partial index support for PostgreSQL. Use the postgres_where keywordon the Index.

string-based query param parsing/config file parser understandswider range of string values for booleansReferences: #817

backref remove object operation doesn’t fail if the other-sidecollection doesn’t contain the item, supports noload collectionsReferences: #813

removed len from “dynamic” collection as it would require issuinga SQL “count()” operation, thus forcing all list evaluations to issueredundant SQLReferences: #818

inline optimizations added to locate_dirty() which can greatly speed uprepeated calls to flush(), as occurs with autoflush=TrueReferences: #816

The IdentifierPreprarer’s _requires_quotes test is now regex based. Anyout-of-tree dialects that provide custom sets of legal_characters orillegal_initial_characters will need to move to regexes or override_requires_quotes.

Firebird has supports_sane_rowcount and supports_sane_multi_rowcount setto False due to ticket #370 (right way).

    • Improvements and fixes on Firebird reflection:
      • FBDialect now mimics OracleDialect, regarding case-sensitivity of TABLE andCOLUMN names (see ‘case_sensitive remotion’ topic on this current file).

      • FBDialect.table_names() doesn’t bring system tables (ticket:796).

      • FB now reflects Column’s nullable property correctly.

Fixed SQL compiler’s awareness of top-level column labels as usedin result-set processing; nested selects which contain the same columnnames don’t affect the result or conflict with result-column metadata.

query.get() and related functions (like many-to-one lazyloading)use compile-time-aliased bind parameter names, to preventname conflicts with bind parameters that already exist in themapped selectable.

Fixed three- and multi-level select and deferred inheritance loading(i.e. abc inheritance with no select_table).References: #795

Ident passed to id_chooser in shard.py always a list.

The no-arg ResultProxy.row_processor() is now the class attribute__process_row.

Added support for returning values from inserts and updates forPostgreSQL 8.2+.References: #797

PG reflection, upon seeing the default schema name being used explicitlyas the “schema” argument in a Table, will assume that this is theuser’s desired convention, and will explicitly set the “schema” argumentin foreign-key-related reflected tables, thus making them match onlywith Table constructors that also use the explicit “schema” argument(even though its the default schema).In other words, SA assumes the user is being consistent in this usage.

fixed sqlite reflection of BOOL/BOOLEANReferences: #808

Added support for UPDATE with LIMIT on mysql.

null foreign key on a m2o doesn’t trigger a lazyloadReferences: #803

oracle does not implicitly convert to unicode for non-typed resultsets (i.e. when no TypeEngine/String/Unicode type is even being used;previously it was detecting DBAPI types and converting regardless).should fixReferences: #800

fix to anonymous label generation of long table/column namesReferences: #806

Firebird dialect now uses SingletonThreadPool as poolclass.

Firebird now uses dialect.preparer to format sequences names

Fixed breakage with postgres and multiple two-phase transactions. Two-phasecommits and rollbacks didn’t automatically end up with a new transactionas the usual dbapi commits/rollbacks do.References: #810

Added an option to the _ScopedExt mapper extension to not automaticallysave new objects to session on object initialization.

fixed Oracle non-ansi join syntax

PickleType and Interval types (on db not supporting it natively) are nowslightly faster.

Added Float and Time types to Firebird (FBFloat and FBTime). FixedBLOB SUB_TYPE for TEXT and Binary types.

Changed the API for the in operator. in() now accepts a single argumentthat is a sequence of values or a selectable. The old API of passing invalues as varargs still works but is deprecated.

0.4.0beta6

Released: Thu Sep 27 2007

The Session identity map is now weak referencing by default, useweak_identity_map=False to use a regular dict. The weak dict we are usingis customized to detect instances which are “dirty” and maintain atemporary strong reference to those instances until changes are flushed.

Mapper compilation has been reorganized such that most compilation occursupon mapper construction. This allows us to have fewer calls tomapper.compile() and also to allow class-based properties to force acompilation (i.e. User.addresses == 7 will compile all mappers; this is). The only caveat here is that an inheriting mapper nowlooks for its inherited mapper upon construction; so mappers withininheritance relationships need to be constructed in inheritance order(which should be the normal case anyway).References: #758

added “FETCH” to the keywords detected by Postgres to indicate aresult-row holding statement (i.e. in addition to “SELECT”).

Added full list of SQLite reserved keywords so that they get escapedproperly.

Tightened up the relationship between the Query’s generation of “eagerload” aliases, and Query.instances() which actually grabs the eagerlyloaded rows. If the aliases were not specifically generated for thatstatement by EagerLoader, the EagerLoader will not take effect when therows are fetched. This prevents columns from being grabbed accidentallyas being part of an eager load when they were not meant for such, whichcan happen with textual SQL as well as some inheritance situations. It’sparticularly important since the “anonymous aliasing” of columns usessimple integer counts now to generate labels.

Removed “parameters” argument from clauseelement.compile(), replaced with“column_keys”. The parameters sent to execute() only interact with theinsert/update statement compilation process in terms of the column namespresent but not the values for those columns. Produces more consistentexecute/executemany behavior, simplifies things a bit internally.

Added ‘comparator’ keyword argument to PickleType. By default, “mutable”PickleType does a “deep compare” of objects using their dumps()representation. But this doesn’t work for dictionaries. Pickled objectswhich provide an adequate eq() implementation can be set up with“PickleType(comparator=operator.eq)”References: #560

Added session.is_modified(obj) method; performs the same “history”comparison operation as occurs within a flush operation; settinginclude_collections=False gives the same result as is used when the flushdetermines whether or not to issue an UPDATE for the instance’s row.

Added “schema” argument to Sequence; use this with Postgres /Oracle whenthe sequence is located in an alternate schema. Implements part of, should fix.References: #584, #761

Fixed reflection of the empty string for mysql enums.

Changed MySQL dialect to use the older LIMIT , syntaxinstead of LIMIT OFFSET for folks using 3.23.References: #794

Added ‘passive_deletes=”all”’ flag to relation(), disables all nulling-outof foreign key attributes during a flush where the parent object isdeleted.

Column defaults and onupdates, executing inline, will add parenthesis forsubqueries and other parenthesis-requiring expressions

The behavior of String/Unicode types regarding that they auto-convert toTEXT/CLOB when no length is present now occurs only for an exact type ofString or Unicode with no arguments. If you use VARCHAR or NCHAR(subclasses of String/Unicode) with no length, they will be interpreted bythe dialect as VARCHAR/NCHAR; no “magic” conversion happens there. Thisis less surprising behavior and in particular this helps Oracle keepstring-based bind parameters as VARCHARs and not CLOBs.References: #793

Fixes to ShardedSession to work with deferred columns.References: #771

User-defined shard_chooser() function must accept “clause=None” argument;this is the ClauseElement passed to session.execute(statement) and can beused to determine correct shard id (since execute() doesn’t take aninstance.)

Adjusted operator precedence of NOT to match ‘==’ and others, so that~(x y) produces NOT (x y), which is better compatiblewith older MySQL versions.. This doesn’t apply to “~(x==y)”as it does in 0.3 since ~(x==y) compiles to “x != y”, but still appliesto operators like BETWEEN.References: #764

Other tickets:,,.References: #728, #757, #768, #779

0.4.0beta5

no release date

Connection pool fixes; the better performance of beta4 remains but fixes“connection overflow” and other bugs which were present (like).References: #754

Fixed bugs in determining proper sync clauses from custom inheritconditions.References: #769

Extended ‘engine_from_config’ coercion for QueuePool size / overflow.References: #763

mysql views can be reflected again.References: #748

AssociationProxy can now take custom getters and setters.

Fixed malfunctioning BETWEEN in orm queries.

Fixed OrderedProperties picklingReferences: #762

SQL-expression defaults and sequences now execute “inline” for allnon-primary key columns during an INSERT or UPDATE, and for all columnsduring an executemany()-style call. inline=True flag on any insert/updatestatement also forces the same behavior with a single execute().result.postfetch_cols() is a collection of columns for which the previoussingle insert or update statement contained a SQL-side default expression.

Fixed PG executemany() behavior.References: #759

postgres reflects tables with autoincrement=False for primary key columnswhich have no defaults.

postgres no longer wraps executemany() with individual execute() calls,instead favoring performance. “rowcount”/”concurrency” checks withdeleted items (which use executemany) are disabled with PG since psycopg2does not report proper rowcount for executemany().

  • [fixed] [tickets]

References: #742

  • [fixed] [tickets]

References: #748

  • [fixed] [tickets]

References: #760

  • [fixed] [tickets]

References: #762

  • [fixed] [tickets]

References: #763

0.4.0beta4

Released: Wed Aug 22 2007

Tidied up what ends up in your namespace when you ‘from sqlalchemy import *’:

‘table’ and ‘column’ are no longer imported. They remain available bydirect reference (as in ‘sql.table’ and ‘sql.column’) or a glob importfrom the sql package. It was too easy to accidentally use asql.expressions.table instead of schema.Table when just starting outwith SQLAlchemy, likewise column.

Internal-ish classes like ClauseElement, FromClause, NullTypeEngine,etc., are also no longer imported into your namespace

The ‘Smallinteger’ compatibility name (small i!) is no longer imported,but remains in schema.py for now. SmallInteger (big I!) is stillimported.

The connection pool uses a “threadlocal” strategy internally to returnthe same connection already bound to a thread, for “contextual” connections;these are the connections used when you do a “connectionless” executionlike insert().execute(). This is like a “partial” version of the“threadlocal” engine strategy but without the thread-local transaction partof it. We’re hoping it reduces connection pool overhead as well asdatabase usage. However, if it proves to impact stability in a negative way,we’ll roll it right back.

Fix to bind param processing such that “False” values (like blank strings)still get processed/encoded.

Fix to select() “generative” behavior, such that calling column(),select_from(), correlate(), and with_prefix() does not modify theoriginal select objectReferences: #752

Added a “legacy” adapter to types, such that user-defined TypeEngineand TypeDecorator classes which define convert_bind_param() and/orconvert_result_value() will continue to function. Also supportscalling the super() version of those methods.

Added session.prune(), trims away instances cached in a session thatare no longer referenced elsewhere. (A utility for strong-refidentity maps).

Added close() method to Transaction. Closes out a transaction usingrollback if it’s the outermost transaction, otherwise just endswithout affecting the outer transaction.

Transactional and non-transactional Session integrates better withbound connection; a close() will ensure that connectiontransactional state is the same as that which existed on it beforebeing bound to the Session.

Modified SQL operator functions to be module-level operators,allowing SQL expressions to be pickleable.References: #735

Small adjustment to mapper class.init to allow for Py2.6object.init() behavior.

Fixed ‘prefix’ argument for select()

Connection.begin() no longer accepts nested=True, this logic is nowall in begin_nested().

Fixes to new “dynamic” relation loader involving cascades

  • [fixed] [tickets]

References: #735

  • [fixed] [tickets]

References: #752

0.4.0beta3

Released: Thu Aug 16 2007

SQL types optimization:

New performance tests show a combined mass-insert/mass-select test ashaving 68% fewer function calls than the same test run against 0.3.

General performance improvement of result set iteration is around 10-20%.

In types.AbstractType, convert_bind_param() and convert_result_value()have migrated to callable-returning bind_processor() andresult_processor() methods. If no callable is returned, no pre/postprocessing function is called.

Hooks added throughout base/sql/defaults to optimize the calling of bindparam/result processors so that method call overhead is minimized.

Support added for executemany() scenarios such that unneeded “last row id”logic doesn’t kick in, parameters aren’t excessively traversed.

Added ‘inherit_foreign_keys’ arg to mapper().

Added support for string date passthrough in sqlite.

  • [fixed] [tickets]

References: #738

  • [fixed] [tickets]

References: #739

  • [fixed] [tickets]

References: #743

  • [fixed] [tickets]

References: #744

0.4.0beta2

Released: Tue Aug 14 2007

oracle

  • [oracle] [improvements.]

Auto-commit after LOAD DATA INFILE for mysql.

  • [oracle] [improvements.]

A rudimental SessionExtension class has been added, allowing user-definedfunctionality to take place at flush(), commit(), and rollback() boundaries.

  • [oracle] [improvements.]

Added engine_from_config() function for helping to create_engine() from an.ini style config.

  • [oracle] [improvements.]

base_mapper() becomes a plain attribute.

  • [oracle] [improvements.]

session.execute() and scalar() can search for a Table with which to bind fromusing the given ClauseElement.

  • [oracle] [improvements.]

Session automatically extrapolates tables from mappers with binds, also usesbase_mapper so that inheritance hierarchies bind automatically.

  • [oracle] [improvements.]

Moved ClauseVisitor traversal back to inlined non-recursive.

misc

  • [fixed] [tickets]

References: #730

  • [fixed] [tickets]

References: #732

  • [fixed] [tickets]

References: #733

  • [fixed] [tickets]

References: #734

0.4.0beta1

Released: Sun Aug 12 2007

orm

  • [orm]

Speed! Along with recent speedups to ResultProxy, total number of functioncalls significantly reduced for large loads.

  • [orm]

test/perf/masseagerload.py reports 0.4 as having the fewest number offunction calls across all SA versions (0.1, 0.2, and 0.3).

  • [orm]

New collection_class api and implementation. Collections arenow instrumented via decorations rather than proxying. You can now havecollections that manage their own membership, and your class instance willbe directly exposed on the relation property. The changes are transparentfor most users.References: #213

  • [orm]

InstrumentedList (as it was) is removed, and relation properties nolonger have ‘clear()’, ‘.data’, or any other added methods beyond thoseprovided by the collection type. You are free, of course, to add them toa custom class.

  • [orm]

setitem-like assignments now fire remove events for the existingvalue, if any.

  • [orm]

dict-likes used as collection classes no longer need to change itersemantics- itervalues() is used by default instead. This is a backwardsincompatible change.

  • [orm]

Subclassing dict for a mapped collection is no longer needed in mostcases. orm.collections provides canned implementations that key objectsby a specified column or a custom function of your choice.

  • [orm]

Collection assignment now requires a compatible type- assigning None toclear a collection or assigning a list to a dict collection will nowraise an argument error.

  • [orm]

AttributeExtension moved to interfaces, and .delete is now .remove Theevent method signature has also been swapped around.

  • [orm]

Major overhaul for Query:

  • [orm]

All selectXXX methods are deprecated. Generative methods are now thestandard way to do things, i.e. filter(), filter_by(), all(), one(),etc. Deprecated methods are docstring’ed with their new replacements.

  • [orm]

Class-level properties are now usable as query elements… no more‘.c.’! “Class.c.propname” is now superseded by “Class.propname”. Allclause operators are supported, as well as higher level operators suchas Class.prop== for scalar attributes,Class.prop.contains() and Class.prop.any() for collection-based attributes (all are alsonegatable). Table-based column expressions as well as columns mountedon mapped classes via ‘c’ are of course still fully available and can befreely mixed with the new attributes.References: #643

  • [orm]

Removed ancient query.select_by_attributename() capability.

  • [orm]

The aliasing logic used by eager loading has been generalized, so thatit also adds full automatic aliasing support to Query. It’s no longernecessary to create an explicit Alias to join to the same tablesmultiple times; even for self-referential relationships.

  • join() and outerjoin() take arguments “aliased=True”. Yhis causestheir joins to be built on aliased tables; subsequent calls tofilter() and filter_by() will translate all table expressions (yes,real expressions using the original mapped Table) to be that of theAlias for the duration of that join() (i.e. until reset_joinpoint() oranother join() is called).

  • join() and outerjoin() take arguments “id=”. When usedwith “aliased=True”, the id can be referenced by add_entity(cls,id=) so that you can select the joined instances even ifthey’re from an alias.

  • join() and outerjoin() now work with self-referential relationships!Using “aliased=True”, you can join as many levels deep as desired,i.e. query.join([‘children’, ‘children’], aliased=True); filtercriterion will be against the rightmost joined table

  • [orm]

Added query.populate_existing(), marks the query to reload allattributes and collections of all instances touched in the query,including eagerly-loaded entities.References: #660

  • [orm]

Added eagerload_all(), allows eagerload_all(‘x.y.z’) to specify eagerloading of all properties in the given path.

  • [orm]

Major overhaul for Session:

  • [orm]

New function which “configures” a session called “sessionmaker()”. Sendvarious keyword arguments to this function once, returns a new classwhich creates a Session against that stereotype.

  • [orm]

SessionTransaction removed from “public” API. You now can call begin()/commit()/rollback() on the Session itself.

  • [orm]

Session also supports SAVEPOINT transactions; call begin_nested().

  • [orm]

Session supports two-phase commit behavior when vertically orhorizontally partitioning (i.e., using more than one engine). Usetwophase=True.

  • [orm]

Session flag “transactional=True” produces a session which always placesitself into a transaction when first used. Upon commit(), rollback() orclose(), the transaction ends; but begins again on the next usage.

  • [orm]

Session supports “autoflush=True”. This issues a flush() before eachquery. Use in conjunction with transactional, and you can justsave()/update() and then query, the new objects will be there. Usecommit() at the end (or flush() if non-transactional) to flush remainingchanges.

  • [orm]

New scoped_session() function replaces SessionContext and assignmapper.Builds onto “sessionmaker()” concept to produce a class whos Session()construction returns the thread-local session. Or, call all Sessionmethods as class methods, i.e. Session.save(foo); Session.commit().just like the old “objectstore” days.

  • [orm]

Added new “binds” argument to Session to support configuration ofmultiple binds with sessionmaker() function.

  • [orm]

A rudimental SessionExtension class has been added, allowinguser-defined functionality to take place at flush(), commit(), androllback() boundaries.

  • [orm]

Query-based relation()s available with dynamicloader(). This is a_writable collection (supporting append() and remove()) which is also alive Query object when accessed for reads. Ideal for dealing with verylarge collections where only partial loading is desired.

  • [orm]

flush()-embedded inline INSERT/UPDATE expressions. Assign any SQLexpression, like “sometable.c.column + 1”, to an instance’s attribute.Upon flush(), the mapper detects the expression and embeds it directly inthe INSERT or UPDATE statement; the attribute gets deferred on theinstance so it loads the new value the next time you access it.

  • [orm]

A rudimental sharding (horizontal scaling) system is introduced. Thissystem uses a modified Session which can distribute read and writeoperations among multiple databases, based on user-defined functionsdefining the “sharding strategy”. Instances and their dependents can bedistributed and queried among multiple databases based on attributevalues, round-robin approaches or any other user-definedsystem.References: #618

  • [orm]

Eager loading has been enhanced to allow even more joins in more places.It now functions at any arbitrary depth along self-referential andcyclical structures. When loading cyclical structures, specify“join_depth” on relation() indicating how many times you’d like the tableto join to itself; each level gets a distinct table alias. The aliasnames themselves are generated at compile time using a simple countingscheme now and are a lot easier on the eyes, as well as of coursecompletely deterministic.References: #659

  • [orm]

Added composite column properties. This allows you to create a type whichis represented by more than one column, when using the ORM. Objects ofthe new type are fully functional in query expressions, comparisons,query.get() clauses, etc. and act as though they are regular single-columnscalars… except they’re not! Use the function composite(cls, columns)inside of the mapper’s “properties” dict, and instances of cls will becreated/mapped to a single attribute, comprised of the values correspondingto columns.References: #211

  • [orm]

Improved support for custom column_property() attributes which featurecorrelated subqueries, works better with eager loading now.

  • [orm]

Primary key “collapse” behavior; the mapper will analyze all columns inits given selectable for primary key “equivalence”, that is, columns whichare equivalent via foreign key relationship or via an explicitinherit_condition. primarily for joined-table inheritance scenarios wheredifferent named PK columns in inheriting tables should “collapse” into asingle-valued (or fewer-valued) primary key. Fixes things like.References: #611

  • [orm]

Joined-table inheritance will now generate the primary key columns of allinherited classes against the root table of the join only. This impliesthat each row in the root table is distinct to a single instance. If forsome rare reason this is not desirable, explicit primary_key settings onindividual mappers will override it.

  • [orm]

When “polymorphic” flags are used with joined-table or single-tableinheritance, all identity keys are generated against the root class of theinheritance hierarchy; this allows query.get() to work polymorphicallyusing the same caching semantics as a non-polymorphic get. Note that thiscurrently does not work with concrete inheritance.

  • [orm]

Secondary inheritance loading: polymorphic mappers can be constructedwithout a select_table argument. inheriting mappers whose tables werenot represented in the initial load will issue a second SQL queryimmediately, once per instance (i.e. not very efficient for large lists),in order to load the remaining columns.

  • [orm]

Secondary inheritance loading can also move its second query into acolumn-level “deferred” load, via the “polymorphic_fetch” argument, whichcan be set to ‘select’ or ‘deferred’

  • [orm]

It’s now possible to map only a subset of available selectable columnsonto mapper properties, using include_columns/exclude_columns..References: #696

  • [orm]

Added undefer_group() MapperOption, sets a set of “deferred” columnsjoined by a “group” to load as “undeferred”.

  • [orm]

Rewrite of the “deterministic alias name” logic to be part of the SQLlayer, produces much simpler alias and label names more in the style ofHibernate

sql

  • [sql]

Speed! Clause compilation as well as the mechanics of SQL constructs havebeen streamlined and simplified to a significant degree, for a 20-30%improvement of the statement construction/compilation overhead of 0.3.

  • [sql]

All “type” keyword arguments, such as those to bindparam(), column(),Column(), and func.(), renamed to “type_”. Those objects stillname their “type” attribute as “type”.

  • [sql]

case_sensitive=(True|False) setting removed from schema items, sincechecking this state added a lot of method call overhead and there was nodecent reason to ever set it to False. Table and column names which areall lower case will be treated as case-insensitive (yes we adjust forOracle’s UPPERCASE style too).

mysql

  • [mysql]

Table and column names loaded via reflection are now Unicode.

  • [mysql]

All standard column types are now supported, including SET.

  • [mysql]

Table reflection can now be performed in as little as one round-trip.

  • [mysql]

ANSI and ANSI_QUOTES sql modes are now supported.

  • [mysql]

Indexes are now reflected.

oracle

  • [oracle]

Very rudimental support for OUT parameters added; use sql.outparam(name,type) to set up an OUT parameter, just like bindparam(); after execution,values are available via result.out_parameters dictionary.References: #507

misc

  • [transactions]

Added context manager (with statement) support for transactions.

  • [transactions]

Added support for two phase commit, works with mysql and postgres so far.

  • [transactions]

Added a subtransaction implementation that uses savepoints.

  • [transactions]

Added support for savepoints.

  • [metadata]

Tables can be reflected from the database en-masse without declaringthem in advance. MetaData(engine, reflect=True) will load all tablespresent in the database, or use metadata.reflect() for finer control.

  • [metadata]

DynamicMetaData has been renamed to ThreadLocalMetaData

  • [metadata]

The ThreadLocalMetaData constructor now takes no arguments.

  • [metadata]

BoundMetaData has been removed- regular MetaData is equivalent

  • [metadata]

Numeric and Float types now have an “asdecimal” flag; defaults to True forNumeric, False for Float. When True, values are returned asdecimal.Decimal objects; when False, values are returned as float(). Thedefaults of True/False are already the behavior for PG and MySQL’s DBAPImodules.References: #646

  • [metadata]

New SQL operator implementation which removes all hardcoded operators fromexpression structures and moves them into compilation; allows greaterflexibility of operator compilation; for example, “+” compiles to “||”when used in a string context, or “concat(a,b)” on MySQL; whereas in anumeric context it compiles to “+”. Fixes.References: #475

  • [metadata]

“Anonymous” alias and label names are now generated at SQL compilationtime in a completely deterministic fashion… no more random hex IDs

  • [metadata]

Significant architectural overhaul to SQL elements (ClauseElement). Allelements share a common “mutability” framework which allows a consistentapproach to in-place modifications of elements as well as generativebehavior. Improves stability of the ORM which makes heavy usage ofmutations to SQL expressions.

  • [metadata]

select() and union()’s now have “generative” behavior. Methods likeorderby() and group_by() return a _new instance - the original instanceis left unchanged. Non-generative methods remain as well.

  • [metadata]

The internals of select/union vastly simplified- all decision makingregarding “is subquery” and “correlation” pushed to SQL generation phase.select() elements are now never mutated by their enclosing containers orby any dialect’s compilation processReferences: #52, #569

  • [metadata]

select(scalar=True) argument is deprecated; use select(..).as_scalar().The resulting object obeys the full “column” interface and plays betterwithin expressions.

  • [metadata]

Added select().with_prefix(‘foo’) allowing any set of keywords to beplaced before the columns clause of the SELECTReferences: #504

  • [metadata]

Added array slice support to row[]References: #686

  • [metadata]

Result sets make a better attempt at matching the DBAPI types present incursor.description to the TypeEngine objects defined by the dialect, whichare then used for result-processing. Note this only takes effect fortextual SQL; constructed SQL statements always have an explicit type map.

  • [metadata]

Result sets from CRUD operations close their underlying cursor immediatelyand will also autoclose the connection if defined for the operation; thisallows more efficient usage of connections for successive CRUD operationswith less chance of “dangling connections”.

  • [metadata]

Column defaults and onupdate Python functions (i.e. passed toColumnDefault) may take zero or one arguments; the one argument is theExecutionContext, from which you can call “context.parameters[someparam]”to access the other bind parameter values affixed to the statement. The connection used for the execution is available as wellso that you can pre-execute statements.References: #559

  • [metadata]

Added “explicit” create/drop/execute support for sequences (i.e. you canpass a “connectable” to each of those methods on Sequence).

  • [metadata]

Better quoting of identifiers when manipulating schemas.

  • [metadata]

Standardized the behavior for table reflection where types can’t belocated; NullType is substituted instead, warning is raised.

  • [metadata]

ColumnCollection (i.e. the ‘c’ attribute on tables) follows dictionarysemantics for “containsReferences: #606

  • [engines]

Speed! The mechanics of result processing and bind parameter processinghave been overhauled, streamlined and optimized to issue as little methodcalls as possible. Bench tests for mass INSERT and mass rowset iterationboth show 0.4 to be over twice as fast as 0.3, using 68% fewer functioncalls.

  • [engines]

You can now hook into the pool lifecycle and run SQL statements or otherlogic at new each DBAPI connection, pool check-out and check-in.

  • [engines]

Connections gain a .properties collection, with contents scoped to thelifetime of the underlying DBAPI connection

  • [engines]

Removed auto_close_cursors and disallow_open_cursors arguments from Pool;reduces overhead as cursors are normally closed by ResultProxy andConnection.

  • [extensions]

proxyengine is temporarily removed, pending an actually workingreplacement.

  • [extensions]

SelectResults has been replaced by Query. SelectResults /SelectResultsExt still exist but just return a slightly modified Queryobject for backwards-compatibility. join_to() method from SelectResultsisn’t present anymore, need to use join().

  • [postgres]

Added PGArray datatype for using postgres array datatypes.