On 6/1/07, Michael Bayer <[EMAIL PROTECTED]> wrote: > pylons is the reason pulling the engine off the session is even > becoming popular, because it is actually using the bind_to feature, > as well as that it didnt really create any easy way to get at the > engine repository (not to mention the issues i raised on the pylons > list). things to note about bind_to is that the session may not be > bound to anything, and also can be bound to *multiple* engines in the > case that someone is making it do that. which is why the "official" > way to get the engine is session.get_bind(<mapper>).
Well, I guess it's a Pylonsism but the session is always bound to an engine at this point, and no mappers exist yet. I'm not sure how your one engine registry or engine key would help with this. You're saying people should just get the engine through pylons.database.engines["default"] or something rather than going through the session_context? Alternatively, pylons.database could expose the global engine. Or one could have a SQLAlchemy class with .create_engine(), .make_session(), .create_session_context() methods. Then it would be easy to subclass that if you need to override one of the parts, and the other parts would automatically use your new method. Then the default model would have: from pylons database import SQLAlchemy sqla = SQLAlchemy() engine = sqla.create_engine() ctx = sqla.session_context() Does that sound like a good approach? Could it be made to scale for multiple engines by adding some engine key arguments? Also, the create_engine method could hand back a cached engine if a compatible one has already been created. -- Mike Orr <[EMAIL PROTECTED]> --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---