dependency update

In this release, we added support for SQLAlchemy 0.5, and dropped support for version 0.3 and earlier. All functionalities work fine with SQLAlchemy 0.4.6 and later, including the various 0.5 releases. If you use earlier 0.4 versions, some functionalities might be broken.

default session changes

The default session (elixir.session) now uses sessionmaker() instead of create_session(), which means it has now the following characteristics:

  • autoflush=True
  • autocommit=False (with SA 0.5 -- equivalent to transactional=True with SA 0.4)
  • autoexpire=True (with SA 0.5).

In practice, this means that if you were using Elixir's default session, your session.flush() are usually useless now, as it is done automatically whenever you commit() or execute an ORM query. What this also means is that you have to commit() changes to your session for them to be persisted. In most case, simply replacing all your calls to session.flush() by session.commit() will be enough to get you up to date.

Alternatively, if you preferred the old behavior, here is a good place to remind you that you can provide your own session configured to your needs to work with Elixir entities. You have several options to do so:

  • the ugly but efficient method: replace elixir's default session:
    elixir.session = scoped_session(sqlalchemy.orm.create_session)
    
  • the nice but slightly more verbose method: provide another session to all your entities, on a per module basis:
    my_session = scoped_session(sqlalchemy.orm.create_session)
    
    then, in each module defining entities, add:
    __session__ = my_session
    
  • or, the even more verbose method: on a per entity basis:
    class MyEntity(Entity):
        using_options(session=my_session)
    

relationships targets

Default "target entity resolving code" changed slightly. It now uses a global collection keyed on the entity name. This means that entities can refer to other entities in a different module simply with the target entity name instead of its full path. The full path is only required when there is an ambiguity (ie when there are two classes with the same name in two different modules).

objectstore

The deprecated objectstore alias to the default session (elixir.session) has been removed. If you were still using it, simply rename all its occurrences to session and you should do fine.

SessionContext

Support for the deprecated (in SQLAlchemy 0.4.x) SessionContext session was removed. If you were using it, please upgrade to scoped_session().