Ticket #7 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

scoped_session() rather than SessionContext

Reported by: guest Owned by: ged
Priority: minor Milestone: 0.4
Component: core Version: 0.4.0
Keywords: Cc: elixir-bugs@…

Description

In SQLAlchemy 0.4 (svn r3498) the use of SessionContext in elixir/init.py causes a deprecation warning from SQLAlchemy.

The call to SessionContext can be replaced with a call to sqlalchemy.orm.scoped_session. All the tests still pass (except test_events, but that is a separate issue) and I see no deprecation warnings.

The patch is against r203.

Attachments

scoped_session.patch (0.8 kB) - added by guest 5 years ago.
Patch to have elixir/init.py use scoped_session.

Change History

Changed 5 years ago by guest

Patch to have elixir/init.py use scoped_session.

Changed 5 years ago by ged

  • owner set to ged
  • status changed from new to accepted

As I said on the list, this patch is ok only for people using SA 0.4, while I 'd like to support both SA 0.4 and SA 0.3.10

Changed 5 years ago by guest

What about using sqlalchemy.version to discriminate between using SessionContext and scoped_session?

Changed 5 years ago by ged

  • status changed from accepted to closed
  • resolution set to fixed

This should be fixed now (as of r210). I used:

try: 
   import ... 
except ImportError:
   ...

This seemed more reliable and future-proof than explicit version checking.

Note: See TracTickets for help on using tickets.