On Fri, Nov 13, 2009 at 2:16 PM, Michael Bayer <[email protected]> wrote:
>
> ffernand wrote:
>>
>> I've been using sqlalchemy for the past couple months in development
>> without incident until I started applying unique indexes. I've had
>> issues with duplicate rows as expected, but now i'm seeing a different
>> error that I hadn't seen before...
>>
>> NoSuchColumnError: "Could not locate column in row for column
>> 'rosetta_keys.id'"
>>
>> It's hard to reproduce because it only shows up (some of the time)
>> when the process forks and only when indexes are applied to tables in
>> question.
>>
>> It's not always the same table, but I can say that it occurs when two
>> processes are touching the same table. I'm using sqlsoup to make this
>> all happen.
>
>
> when you fork a child, any engines you have created must be replaced with
> new engines. TCP connections don't really travel across forks very well
> so you'll want to ensure create_engine() is called at the beginning of
> each child, and applied to all places where an engine is needed (i.e.
> sessions, metadata objects).
>
thanks for the quick reply...
I can say, that that is not the case... I do re-create the engine
(using create_engine) upon fork. After a fork the following is
executed.
orm.session.close_all()
conn = orm.session.connection()
conn.detach(); conn.close()
(the above i think is overkill) then I recreate...
engine = create_engine(conn_str, convert_unicode=True, echo=
False, echo_pool= False)
Session.configure(bind= engine, autoflush= True, autocommit= True,
expire_on_commit= True)
orm.db, orm.session = SqlSoup(MetaData(engine)), Session()
Also, the exception NoSuchColumnError never shows up until unique
indexes are applied thoughout the tables.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---