Esempio n. 1
0
def returns_session(dbname):
    from orm.Judgment import sessionmaker, create_engine

    engine = create_engine(Configuretion(dbname),
                           pool_size=20, max_overflow=100,
                           encoding=Config[dbname]['encoding'], echo=Config[dbname]['echo'])
    to_Session = sessionmaker(expire_on_commit=False)
    to_Session.configure(bind=engine)

    return to_Session
Esempio n. 2
0
    engine = create_engine(Configuretion(dbname),
                           pool_size=20, max_overflow=100,
                           encoding=Config[dbname]['encoding'], echo=Config[dbname]['echo'])
    to_Session = sessionmaker(expire_on_commit=False)
    to_Session.configure(bind=engine)

    return to_Session

if __name__ == '__main__':
    init_db()
    from orm.Sqlextend import SearchName, sessionmaker, Base_to, create_engine
    item = 'Sqlextend'
    engine = create_engine(Configuretion(
        item), encoding=Config[item]['encoding'], echo=Config[item]['echo'])

    to_Session = sessionmaker(expire_on_commit=False)
    to_Session.configure(bind=engine)
    #t_session = to_Session()
    insert = SearchName()
    point = Opration(to_Session, editor=insert, tablename=SearchName,
                     filter='name != ""', limit=10)

    for item in ['test12222', 'test23333', 'test32222', 'test']:
        insert.name = item
        point.set_value(insert)
        point.update()

    for item in point.query():
        insert.id = item.id
        insert.name = item.name
        point.set_value(insert)