Re: [sqlalchemy] sql expression performance is bad ?

2014-03-14 Thread Ni Wesley
Yes, actually, that's the pattern I used from the beginning, i.e. for every request(actually tcp server connection request), create a session, do db operation, commit, and close. But it's too slow, for 1000 connections requests, it takes more than 40 seconds, so , just yesterday, when using mul

Re: [sqlalchemy] sql expression performance is bad ?

2014-03-14 Thread Jonathan Vanasco
You would probably do better with a pattern where you have a Session for every request , and just use that session. That is how most people implement SqlAlchemy for web. * request start * create a sqlalchemy session, either scoped or explicit * do things with your session : read , w

Re: [sqlalchemy] sqlalchemy with autoincrement and foreignkey

2014-03-14 Thread Michael Bayer
On Mar 14, 2014, at 1:28 AM, Yunlong Mao wrote: > Hi all, > > I have some problem with sqlalchemy and mysql. > > """ > class User(db.Model, UserMixin): > __tablename__ = 'user' > > id = Column(Integer, autoincrement=True, nullable=False, unique=True, > index=True) > coreid = Colu