Boris SABATIER <[email protected]> wrote:

> @Michael:
> Are you sure the default value of isolation_level is None ?

OK what I forgot to clarify in my other email is that you’re working with
“connect_args” here, which with engine_from_config would not be a separate
.ini value in any case; things that go into create_engine()->connect_args
are supposed to be in the query string. So the isolation_level you’re
talking about here isn’t SQLAlchemy’s version of this, it’s the one that’s
specific to the pysqlite DBAPI.

However, none of that matters, because you’re trying to use SAVEPOINT and
you definitely don’t just want to turn on pysqlite’s autocommit and do
nothing else.

Your use case here is specifically addressed here:

http://docs.sqlalchemy.org/en/rel_0_9/dialects/sqlite.html#pysqlite-serializable

You will need to implement the events given there in order to use SAVEPOINT
transactions, which does include the “isolation_level=None” but also
critically re-implements the fact that you need to emit BEGIN at transaction
start.





> Because when I didn't set to None, I can't use nested session with
> sqlite and when I set it to None it's works.
> 
> 2014-12-30 19:42 GMT+01:00 Michael Bayer <[email protected]>:
>> Boris Sabatier <[email protected]> wrote:
>> 
>> Hi,
>> 
>> I need to pass connect_args={'isolation_level':None} when I create my
>> engine.
>> 
>> 
>> 
>> “None” is the default that’s used if isolation_level is not passed, and
>> means to do nothing.  So just don’t pass it, there’s no need to pass “None”.
>> 
>> 
>> With create_engine, it's work well.
>> 
>> But I would like to use engine_from_config instead of create_engine.
>> 
>> This is what I tried and the errors :
>> 
>> # ini file :
>> sqlalchemy.connect_args = {'isolation_level':None}
>> 
>> 
>> well if this were to be available in an .ini file, that’s not Python code in
>> an .ini file, it would have to be interpreted, such as:
>> 
>> sqlalchemy.connect_args = none
>> 
>> there’s a system by which these values are interpreted on a case-by-case
>> basis that’s stated in each dialect class, if the type is something other
>> than string.    But this parameter isn’t part of that, since it’s just a
>> string type, and there’s no “None” handling.   You’d just omit the argument
>> to use the default value.
>> 
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "sqlalchemy" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/sqlalchemy/ZVhiJa7QZOQ/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/sqlalchemy.
>> For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to