Hi,

I'm using a sqlite file based database, I'm having problem making
database calls from two different thread, the error is the following:

SQLite objects created in a thread can only be used in that same
thread

here is my sa configuration:

from sqlalchemy.orm import sessionmaker
from sqlalchemy.orm import scoped_session
from sqlalchemy import create_engine
from sqlalchemy.pool import NullPool
from myapp import settings
import sqlite3

connectionstring = 'sqlite:///' + settings.DATABASE_PATH+'?
check_same_thread=False'

#engine = create_engine(connectionstring, echo=settings.DEBUG,
echo_pool=settings.DEBUG)
engine = create_engine(connectionstring, echo=settings.DEBUG,
pool=NullPool(lambda: sqlite3.connect(settings.DATABASE_PATH)))

#engine = create_engine(connectionstring, echo=True, echo_pool=True)

sess = scoped_session(sessionmaker(bind=engine))
#sess = sessionmaker(bind=engine)

as you can see I'm using check_same_thread=False, Null connection pool
and scoped session, what's wrong?

thanks
Nicola

--

You received this message because you are subscribed to the Google Groups 
"sqlalchemy" 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/sqlalchemy?hl=en.


Reply via email to