Hi there,

We ran into a silly problem which took quite some digging to discover
- I thought I'd share it here and ask for better solutions too.

We have a complicated app which uses a custom session.  We set the
custom session by assigning to elixir.session, eg:

 elixir.session = scoped_session(sessionmaker(autoflush=True,
transactional=True), scopefunc=custom_scope_func)

However, our elixir Entity-derived classes just happen to be imported
BEFORE that statement executes.

Of course, the result is that they are all using the original
elixir.session (ScopedSession), and not the one we set.  And nothing
really breaks to tell you that, so it is hard to find in a complex
app.

Now, we would not want to litter our modules with __session__ or have
to remember to add options to each class. Neither do we want to be
dependent on when what gets imported...

One partial solution to the problem is to NOT assign to
elixir.session, but just to call configure() on it.  However, it is
crucial to us to actually set a custom scopefunc and you cannot do
that with configure (unless I am mistaken).

Is it possible to change the scopefunc on a ScopedSession after
creation? Or, alternatively, is it possible to move all classes from
the old elixir.session to the new one we assign?

Regards
-i
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLElixir" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to