0.1 Changelog
0.1.7
Released: Fri May 05 2006
some fixes to topological sort algorithm
added DISTINCT ON support to Postgres (just supply distinct=[col1,col2..])
added mod (% operator) to sql expressions
“order_by” mapper property inherited from inheriting mapper
fix to column type used when mapper UPDATES/DELETEs
with convert_unicode=True, reflection was failing, has been fixed
types types types! still weren’t working….have to use TypeDecorator again :(
mysql binary type converts array output to buffer, fixes PickleType
fixed the attributes.py memory leak once and for all
unittests are qualified based on the databases that support each one
fixed bug where column defaults would clobber VALUES clause of insert objects
fixed bug where table def w/ schema name would force engine connection
fix for parenthesis to work correctly with subqueries in INSERT/UPDATE
HistoryArraySet gets extend() method
fixed lazyload support for other comparison operators besides =
lazyload fix where two comparisons in the join condition point to thesamem column
added “constructnew” flag to mapper, will use new to create instancesinstead of _init (standard in 0.2)
added selectresults.py to SVN, missed it last time
tweak to allow a many-to-many relationship from a table to itself viaan association table
small fix to “translate_row” function used by polymorphic example
create_engine uses cgi.parse_qsl to read query string (out the window in 0.2)
fixed function names LOCAL_TIME/LOCAL_TIMESTAMP -> LOCALTIME/LOCALTIMESTAMP
fixed order of ORDER BY/HAVING in compile
0.1.6
Released: Wed Apr 12 2006
support for MS-SQL added courtesy Rick Morrison, Runar Petursson
the latest SQLSoup from J. Ellis
ActiveMapper has preliminary support for inheritance (Jeff Watkins)
added a “mods” system which allows pluggable modules that modify/augmentcore functionality, using the function “install_mods(*modnames)”.
added the first “mod”, SelectResults, which modifies mapper selects toreturn generators that turn ranges into LIMIT/OFFSET queries(Jonas Borgstr?
factored out querying capabilities of Mapper into a separate Query objectwhich is Session-centric. this improves the performance of mapper.using(session)and makes other things possible.
objectstore/Session refactored, the official way to save objects is nowvia the flush() method. The begin/commit functionality of Session is factoredinto LegacySession which is still established as the default behavior, untilthe 0.2 series.
types system is bound to an engine at query compile time, not schemaconstruction time. this simplifies the types system as well as the ProxyEngine.
added ‘version_id’ keyword argument to mapper. this keyword should reference aColumn object with type Integer, preferably non-nullable, which will be used onthe mapped table to track version numbers. this number is incremented on eachsave operation and is specified in the UPDATE/DELETE conditions so that itfactors into the returned row count, which results in a ConcurrencyError if thevalue received is not the expected count.
added ‘entity_name’ keyword argument to mapper. a mapper is now associatedwith a class via the class object as well as an optional entity_name parameter,which is a string defaulting to None. any number of primary mappers can becreated for a class, qualified by the entity name. instances of those classeswill issue all of their load and save operations through theirentity_name-qualified mapper, and maintain separate a identity in the identitymap for an otherwise equivalent object.
overhaul to the attributes system. code has been clarified, and also fixed tosupport proper polymorphic behavior on object attributes.
added “for_update” flag to Select objects
fix for postgres1 DateTime type
documentation pages mostly switched over to Markdown syntax
0.1.5
Released: Mon Mar 27 2006
added SQLSession concept to SQLEngine. this object keeps track of retrieving aconnection from the connection pool as well as an in-progress transaction.methods push_session() and pop_session() added to SQLEngine which push/pop a newSQLSession onto the engine, allowing operation upon a second connection “nested”within the previous one, allowing nested transactions. Other tricks are sure tocome later regarding SQLSession.
added nest_on argument to objectstore.Session. This is a single SQLEngine orlist of engines for which push_session()/pop_session() will be called each timethis Session becomes the active session (via objectstore.push_session() orequivalent). This allows a unit of work Session to take advantage of the nestedtransaction feature without explicitly calling push_session/pop_session on theengine.
factored apart objectstore/unitofwork to separate “Session scoping” from“uow commit heavy lifting”
added populate_instance() method to MapperExtension. allows an extension tomodify the population of object attributes. this method can call thepopulate_instance() method on another mapper to proxy the attribute populationfrom one mapper to another; some row translation logic is also built in to helpwith this.
fixed Oracle8-compatibility “use_ansi” flag which converts JOINs tocomparisons with the = and (+) operators, passes basic unittests
tweaks to Oracle LIMIT/OFFSET support
Oracle reflection uses ALL** views instead of USER** to get largerlist of stuff to reflect from
fixes to Oracle foreign key reflectionReferences: #105
objectstore.commit(obj1, obj2,…) adds an extra step to seek out privaterelations on properties and delete child objects, even though its not a globalcommit
lots and lots of fixes to mappers which use inheritance, strengthened theconcept of relations on a mapper being made towards the “local” table for thatmapper, not the tables it inherits. allows more complex compositional patternsto work with lazy/eager loading.
added support for mappers to inherit from others based on the same table,just specify the same table as that of both parent/child mapper.
some minor speed improvements to the attributes system with regards toinstantiating and populating new objects.
INSERTs can receive clause elements as VALUES arguments, not just literalvalues
support for calling multi-tokened functions, i.e. schema.mypkg.func()
added J. Ellis’ SQLSoup module to extensions package
added “polymorphic” examples illustrating methods to load multiple object typesfrom one mapper, the second of which uses the new populate_instance() method.small improvements to mapper, UNION construct to help the examples along
improvements/fixes to session.refresh()/session.expire() (which may havebeen called “invalidate” earlier..)
added session.expunge() which totally removes an object from the currentsession
added args, *kwargs pass-thru to engine.transaction(func) allowing easiercreation of transactionalizing decorator functions
added iterator interface to ResultProxy: “for row in result:…”
added assertion to tx = session.begin(); tx.rollback(); tx.begin(), i.e. cantuse it after a rollback()
added date conversion on bind parameter fix to SQLite enabling dates towork with pysqlite1
improvements to subqueries to more intelligently construct their FROMclausesReferences: #116
fixed two bugs with column labels with regards to bind parameters: bind paramkeynames they are now generated from a column “label” in all relevant cases totake advantage of excess-name-length rules, and checks for a peculiar collisionagainst a column named the same as “tablename_colname” added
major overhaul to unit of work documentation, other documentation sections.
fixed attributes bug where if an object is committed, its lazy-loaded list gotblown away if it hadn’t been loaded
added unique_connection() method to engine, connection pool to return aconnection that is not part of the thread-local context or any currenttransaction
added invalidate() function to pooled connection. will remove the connectionfrom the pool. still need work for engines to auto-reconnect to a stale DBthough.
added distinct() function to column elements so you can dofunc.count(mycol.distinct())
added “always_refresh” flag to Mapper, creates a mapper that will alwaysrefresh the attributes of objects it gets/selects from the DB, overwriting anychanges made.
0.1.4
Released: Mon Mar 13 2006
create_engine() now uses genericized parameters; host/hostname,db/dbname/database, password/passwd, etc. for all engine connections. makesengine URIs much more “universal”
added support for SELECT statements embedded into a column clause, using theflag “scalar=True”
another overhaul to EagerLoading when used in conjunction with mappers thatinherit; improvements to eager loads figuring out their aliased queriescorrectly, also relations set up against a mapper with inherited mappers willcreate joins against the table that is specific to the mapper itself (i.e. andnot any tables that are inherited/are further down the inheritance chain),this can be overridden by using custom primary/secondary joins.
added J.Ellis patch to mapper.py so that selectone() throws an exceptionif query returns more than one object row, selectfirst() to not throw theexception. also adds selectfirst_by (synonymous with get_by) and selectone_by
added onupdate parameter to Column, will exec SQL/python upon an updatestatement.Also adds “for_update=True” to all DefaultGenerator subclasses
added support for Oracle table reflection contributed by Andrija Zaric;still some bugs to work out regarding composite primary keys/dictionary selection
checked in an initial Firebird module, awaiting testing.
added sql.ClauseParameters dictionary object as the result forcompiled.get_params(), does late-typeprocessing of bind parameters sothat the original values are easier to access
more docs for indexes, column defaults, connection pooling, engine construction
overhaul to the construction of the types system. uses a simpler inheritancepattern so that any of the generic types can be easily subclassed, with no needfor TypeDecorator.
added “convert_unicode=False” parameter to SQLEngine, will cause all Stringtypes to perform unicode encoding/decoding (makes Strings act like Unicodes)
added ‘encoding=”utf8”’ parameter to engine. the given encoding will beused for all encode/decode calls within Unicode types as well as Stringswhen convert_unicode=True.
improved support for mapping against UNIONs, added polymorph.py exampleto illustrate multi-class mapping against a UNION
fix to SQLite LIMIT/OFFSET syntax
added backref() function, allows backreferences to have keyword argumentsthat will be passed to the backref.
Sequences and ColumnDefault objects can do execute()/scalar() standalone
SQL functions (i.e. func.foo()) can do execute()/scalar() standalone
fix to SQL functions so that the ANSI-standard functions, i.e. current_timestampetc., do not specify parenthesis. all other functions do.
added settattr_clean and append_clean to SmartProperty, which setattributes without triggering a “dirty” event or any history. used as:myclass.prop1.setattr_clean(myobject, ‘hi’)
improved support to column defaults when used by mappers; mappers will pullpre-executed defaults from statement’s executed bind parameters(pre-conversion) to populate them into a saved object’s attributes; if anyPassiveDefaults have fired off, will instead post-fetch the row from the DB topopulate the object.
added ‘get_session().invalidate(*obj)’ method to objectstore, instances willrefresh() themselves upon the next attribute access.
improvements to SQL func calls including an “engine” keyword argument sothey can be execute()d or scalar()ed standalone, also added func accessor toSQLEngine
fix to MySQL4 custom table engines, i.e. TYPE instead of ENGINE
slightly enhanced logging, includes timestamps and a somewhat configurableformatting system, in lieu of a full-blown logging system
improvements to the ActiveMapper class from the TG gang, includingmany-to-many relationships
added Double and TinyInt support to mysql
0.1.3
Released: Thu Mar 02 2006
completed “post_update” feature, will add a second update statement beforeinserts and after deletes in order to reconcile a relationship without anydependencies being created; used when persisting two rows that are dependenton each other
completed mapper.using(session) function, localized per-object Sessionfunctionality; objects can be declared and manipulated as local to anyuser-defined Session
fix to Oracle “row_number over” clause with multiple tables
mapper.get() was not selecting multiple-keyed objects if the mapper’s table was a join,such as in an inheritance relationship, this is fixed.
overhaul to sql/schema packages so that the sql package can run all on its own,producing selects, inserts, etc. without any engine dependencies. builds uponnew TableClause/ColumnClause lexical objects. Schema’s Table/Column objectsare the “physical” subclasses of them. simplifies schema/sql relationship,extensions (like proxyengine), and speeds overall performance by a large margin.removes the entire getattr() behavior that plagued 0.1.1.
refactoring of how the mapper “synchronizes” data between two objects into aseparate module, works better with properties attached to a mapper that has anadditional inheritance relationship to one of the related tables, also the samemethodology used to synchronize parent/child objects now used by mapper tosynchronize between inherited and inheriting mappers.
made objectstore “check for out-of-identitymap” more aggressive, will perform thecheck when object attributes are modified or the object is deleted
Index object fully implemented, can be constructed standalone, or via“index” and “unique” arguments on Columns.
added “convert_unicode” flag to SQLEngine, will treat all String/CHAR typesas Unicode types, with raw-byte/utf-8 translation on the bind parameter andresult set side.
postgres maintains a list of ANSI functions that must have no parenthesis sofunction calls with no arguments work consistently
tables can be created with no engine specified. this will default their engineto a module-scoped “default engine” which is a ProxyEngine. this engine canbe connected via the function “global_connect”.
added “refresh(*obj)” method to objectstore / Session to reload the attributes ofany set of objects from the database unconditionally
0.1.2
Released: Fri Feb 24 2006
fixed a recursive call in schema that was somehow running 994 times then returningnormally. broke nothing, slowed down everything. thanks to jpellerin for finding this.
0.1.1
Released: Thu Feb 23 2006
small fix to Function class so that expressions with a func.foo() use the type of theFunction object (i.e. the left side) as the type of the boolean expression, not theother side which is more of a moving target (changeset 1020).
creating self-referring mappers with backrefs slightly easier (but still not that easy -changeset 1019)
fixes to one-to-one mappings (changeset 1015)
psycopg1 date/time issue with None fixed (changeset 1005)
two issues related to postgres, which doesn’t want to give you the “lastrowid”since oids are deprecated:
postgres database-side defaults that are on primary key cols do executeexplicitly beforehand, even though that’s not the idea of a PassiveDefault. this isbecause sequences on columns get reflected as PassiveDefaults, but need to be explicitlyexecuted on a primary key col so we know what we just inserted.
if you did add a row that has a bunch of database-side defaults on it,and the PassiveDefault thing was working the old way, i.e. they just execute onthe DB side, the “cant get the row back without an OID” exception that occurredalso will not happen unless someone (usually the ORM) explicitly asks for it.
fixed a glitch with engine.execute_compiled where it was making a secondResultProxy that just got thrown away.
began to implement newer logic in object properties. you can now saymyclass.attr.property, which will give you the PropertyLoader corresponding to thatattribute, i.e. myclass.mapper.props[‘attr’]
eager loading has been internally overhauled to use aliases at all times. morecomplicated chains of eager loads can now be created without any need for explicit“use aliases”-type instructions. EagerLoader code is also much simpler now.
a new somewhat experimental flag “use_update” added to relations, indicates thatthis relationship should be handled by a second UPDATE statement, either after aprimary INSERT or before a primary DELETE. handles circular row dependencies.
added exceptions module, all raised exceptions (except for someKeyError/AttributeError exceptions) descend from these classes.
fix to date types with MySQL, returned timedelta converted to datetime.time
two-phase objectstore.commit operations (i.e. begin/commit) now return atransactional object (SessionTrans), to more clearly indicate transaction boundaries.
Index object with create/drop support added to schema
fix to postgres, where it will explicitly pre-execute a PassiveDefault on a tableif it is a primary key column, pursuant to the ongoing “we cant get inserted rowsback from postgres” issue
change to information_schema query that gets back postgres table defs, nowuses explicit JOIN keyword, since one user had faster performance with 8.1
fix to engine.process_defaults so it works correctly with a table that hasdifferent column name/column keys (changeset 982)
a column can only be attached to one table - this is now asserted
postgres time types descend from Time type
fix to alltests so that it runs types test (now named testtypes)
fix to Join object so that it correctly exports its foreign keys (cs 973)
creating relationships against mappers that use inheritance fixed (cs 973)