(Sorry if this message appears twice in the list - I first sent it using an unregistered mail address.)

Hello,

thank you for your quick reply.

is there a problem in mapping classes to selects ([1]) /within a function/?

with multiple threads, where the mappers initialization may first
proceed as the product of a thread running, yes. you'd want to
upgrade to 0.7 for the best versions of these fixes, or at least 0.6.

If you must stay on 0.5, make sure all modules are fully imported,
then run compile_mappers() before starting any threads.

I tried this first as migrating to version 0.7 or 0.6 sounds like a significant (and currently unplanned) effort, so I hoped we could stay with 0.5 for the moment.

So I identified our "standard" mapper calls to tables. It turned out they are invoked by a single function running in the startup phase, so I added a call to compile_mappers() at the end of this function. The function is invoked very early and even before the __init__() method of the WSGI application object - I hope this is early enough. Looking at the server logs one can see it is called right after server startup, as often as initial processes are configured.

Unfortunately, there are still errors displayed. Most of the time I found "'Mapper' object has no attribute '_props'".

I also tried to use the standard SQLAlchemy mapper() function instead of our wrapper mentioned in my first message (a variant of [1]). In most cases the system complained about the _props attribute as before, in rare cases the message "dictionary changed size during iteration" appeared. (I switched back to the standard mapper to find out if our wrapper could have an influence.)

Am I correct that the results indicate we *have* to switch to 0.6/0.7 for a solution, or did I oversee something? From your message:

If you must stay on 0.5, make sure all modules are fully imported,
then run compile_mappers() before starting any threads.

Could it be I am not loading enough modules? Does "all modules" mean all modules of the application, or all modules to map successfully?

Thanks and regards

                 Jochen


Reference:

[1] http://www.sqlalchemy.org/trac/wiki/UsageRecipes/SessionAwareMapper


--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to