Thanks a lot, Paul. Great point, works just great. That pretty much solved the issue.
log_dic log_typle = (session['login'], session['password']) if not log_dic.has_key((log_typle)): engine = create_engine(uri) log_dic[log_typle] = engine else: engine = log_dic[(session['login'], session['password'])] Does this create new connection with the same name or start using the existing one? I'm almost 100% that latter, just making sure. Right now I'm binding meta to the engine, which obviosly makes all the tables work with the last engine plugged in What'll be your advice for this matter. The most obvious way i see is using Contextual Session. This way I'll have to add Session = scoped_session(sessionmaker(autoflush=True, transactional=True, bind=current_user_engine)) But I'll have to rewrite all the SQL statements so that they'll start running using sessions. select([func.count("*")], from_obj=[sell_table]).sess.execute() What'll be your best practice advice on this one? On Oct 17, 3:35 pm, "Paul Johnston" <[EMAIL PROTECTED]> wrote: > Hi, > > Here's how it should work: every time the user logs in, SA creates a > > > new engine with his log/pass or uses the one that was already opened > > and then uses it. > > Unless something has changed recently, this pattern is not particularly > supported. > > Still, you could probably get it working with bound sessions. If the engine > doesn't exist in the users, session, create the engine and save in the > session. Don't know why the Pylons session save was failing, perhaps it > doesn't allow arbitrary Python objects. You could keep your own dictionary, > keyed on (username, password) tuples and avoid sessions altogether. > > Paul --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---