Thanks Gaëtan!
the link was very helpful: it works fine opening the db once per thread.

Mario

On 23 June 2010 20:15, Gaëtan de Menten <[email protected]> wrote:
> On Wed, 2010-06-23 at 04:50 -0700, mrceresa wrote:
>> Hello all! first of all, thanks for the wonderful work here at elixir:
>> it is really a beautiful library!
>>
>> I'm writing to seek advice on how to share a db between different
>> threads. I'd like to do the following:
>>
>> 1) Create an in-memory db
>> 2) Watch for some directory changes with inotify
>> 3) When a change arrives, span a new thread and record some data on
>> the db
>>
>> The problem is that then the thread dies on session.commit() with:
>>
>> raise exc.DBAPIError.instance(statement, parameters, e,
>> connection_invalidated=is_disconnect)
>> OperationalError: (OperationalError) no such table: study u'SELECT
>> study.id AS study_id, study.name AS study_name, study.patient_id AS
>> study_patient_id \nFROM study \nWHERE study.name = ?' ['test3']
>>
>> as if the db were not initialized.
>>
>> I realized on the doc that the session should not be shared among
>> threads, so I was wondering if the best way to solve this is to put
>> the db on a file and open it once for thread.
>>
>> Thanks for any comment you might want to share!
>
> See
> http://www.sqlalchemy.org/docs/05/reference/dialects/sqlite.html#threading-behavior
>
> Hope it helps,
> Gaëtan.
>
> --
> 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.
>
>

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