On Mon, Jul 26, 2010 at 22:19, Michael Hipp <[email protected]> wrote:
> Presumably these are really the same thing, but the SA docs say to create
> and throw away sessions frequently where Elixir seems to want you to use the
> same session ongoing.
>
> Some questions:
> - Does the global session used by Elixir cause loss of any of the capability
> of SA's connection pooling and maintenance?

Firstly, the global session used by Elixir is only there by default,
you can perfectly not use it and use a session configured any way you
like.  You can perfectly use a "normal" session with Elixir and you
can also use a global (the technical term is "scopedsession") with
straight SA. The only difference lies in the fact that SA does not
provide a default session, whereas Elixir does, and that default
session is a scoped one AND if Elixir detects a scoped session, it
adds some machinery so that instances of your classes are
automatically added to that session when they are instanciated.

Now concerning the actual question: as far as I know, it does not
cause any loss of capability. The only problem it ever caused me is
that sometimes, you do not want newly created instances to be added to
the session. In that case you'd have two options: either turn off the
"auto-add" feature for that entity with
"using_mapper_options(save_on_init=False)", or remove the particular
instance from the session before it gets flushed. Having a single
session in the Elixir namespace (as opposed to in an application
namespace) is also problematic when you are using several
*independent* modules which both use Elixir in the *same application*.
In that case, you should simply define your own session for one or
both of those modules and not use the default session.

> - The Elixir test_options.py file seems to show using SA session calls
> exactly as one would if Elixir were nowhere around; is this correct?

More or less, yes, the tests in the "TestSessionOptions" class are
testing the different ways you can provide your own session in Elixir.
Btw, it's a good idea to look at the tests like you just did to learn
more about the capabilities of Elixir...

> - What if the database takes a nap. How do we detect this? How to we get the
> connection/session working again once the database is back online.

Sorry, I have no idea. This is not Elixir specific though.

Hope it helps,
-- 
Gaƫtan de Menten

-- 
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