@@ -0,0 +1,1873 @@
+from sqlalchemy import create_engine, exc%0Afrom sqlalchemy.ext.declarative import declarative_base%0Afrom sqlalchemy import Column, Integer, String, Boolean, Enum%0Afrom sqlalchemy.orm import sessionmaker%0Afrom sqlalchemy.pool import NullPool%0A%0A%22%22%22%0Adisable connection pool for the following reason:%0A(1) TimeoutError: QueuePool limit of size 5 overflow 10 reached, connection timed out, timeout 30%0A%22%22%22%0A#class LookLively( object ):%0A#    %22%22%22Ensures that MySQL connections checked out of the pool are alive.%22%22%22%0A#%0A#    def checkout( self, dbapi_con, con_record, con_proxy ):%0A#        try:%0A#            try:%0A#                dbapi_con.ping( False )%0A#            except TypeError:%0A#                dbapi_con.ping()%0A#        except dbapi_con.OperationalError, ex:%0A#            if ex.args%5B 0 %5D in ( 2006, 2013, 2014, 2045, 2055 ):%0A#                raise exc.DisconnectionError()%0A#            else:%0A#                raise%0A#%0A#%0A#engine = create_engine( 'mysql+pymysql://%3Cuser_name%3E:%3Cpassword%3E@%3Cmysql_ser_host%3E/%3Cdatabase_name%3E', echo=False, echo_pool=%22debug%22, pool_recycle=1800, listeners=%5B %0ALookLively() %5D )%0A%0Aengine = create_engine( 'mysql+pymysql://%3Cuser_name%3E:%3Cpassword%3E@%3Cmysql_ser_host%3E/%3Cdatabase_name%3E', echo=False, poolclass=NullPool )%0A%0ASession = sessionmaker( bind=engine )%0A%0ABase = declarative_base()%0A%0Aclass User( Base ):%0A    __tablename__ = 'user'%0A%0A    id = Column( Integer, primary_key=True )%0A    name = Column( String( 32 ) )%0A    email = Column( String( 64 ) )%0A    # extension number%0A    ext_num = Column( String( 16 ) )%0A    cellphone = Column( String( 11 ) )%0A    passwd = Column( String( 32 ) )%0A    product = Column( String( 128 ) )%0A%0A    def __repr__( self ):%0A        return %22%3CUser(name='%25s', passwd='%25s', product='%25s')%3E%22 %25 ( self.name, self.passwd, self.product )%0A        %0Aif __name__ == '__main__':%0A    # python models.py%0A    # create table%0A    Base.metadata.create_all( engine )%0A

Create models.py