Hi, Michael Bayer wrote:
> hey pylonistas - > > any chance this verbiage can be changed ? > > http://pylonshq.com/docs/quick_wiki.html > > import sqlalchemy.mods.threadlocal > from sqlalchemy import * > > <other stuff> > > "The first two lines setup SQLAlchemy to support threads and import > some useful objects such as the Table and Column classes. " > > While this line may seem harmless, I think people are getting fairly > mislead by that; SQLAlchemy can be used in a threaded environment > with or without the usage of the threadlocal mod. more importantly, > turning on the "threadlocal" mod greatly modifies the behavior of > sqlalchemy in such a way as to be incompatible with most of the basic > sqlalchemy examples on the SA site, including the tutorial...and > twice this week i have had people trying to mix it up with explicit > session usage, which causes a behavior that is extremely confusing if > you dont understand what "threadlocal" actually does, which is that > it automatically associates new instances with an implicitly created > session (thereby creating a conflict when you try to save() your new > instance elsewhere). > > the "threadlocal" mod was meant primarily as a migration path from > the 0.1 series where such behavior was the default, and should > probably not even be used for new projects, in favor of the > sessioncontext plugin which is more generic and less magical. > sessioncontext is more explicit, and compared to threadlocal fits > well into the "explicit is better than implicit" idea. > > even better would be to keep threadlocal/sessioncontext out of the > tutorials altogether, sticking to basic explicit session usage and > leaving the usage of those plugins to those who have read and > understood the documentation on the SA site. (that or, build a > contextual session into Pylons the way the turbogears folks do, so > that theres a single pattern of SA session usage within Pylons which > is unique to Pylons and wont as easily be confused with generic SA > session usage). I totally agree with that. Some people start out with the Pylons tutorial, maybe knowing not much about web development and only have a brief overview of what ORMs are. When you go to the SA docs to read more about "threadlocal", it doesn't even seem to be a core functionnality of SA because it's in the "Plugins" section. It talks about "default strategy", "ComposedSQLEngine objects", "threadlocal SessionContext", "MapperExtension", "SessionContext" aka "sqlalchemy.objectstore". All this vocabulary is confusing for the newbie, even the one that got through the SA tutorial. Of course, the above "Note" recommands to read the SA docs "before you get heavily into SQLAlchemy". But as I'm reading the Pylons "QuickWiki", I don't think I'll get that heavy with SQLAlchemy, yet. IMHO, the Pylons/SQLAlchemy QuickWiki tutorial should still describe how SA works, and should not go beyond what's explained in the SA tutorial to get you started. Regards, -- Alexandre CONRAD - TLV FRANCE Research & Development --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" 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/pylons-discuss -~----------~----~----~----~------~----~------~--~---
