예제 #1
0
def index_10_stuffs(engine):
    connection = engine.connect()
    trans = connection.begin()
    session = Session(bind=connection)

    res = session.execute("""select files.id, files.md5, files.mimetype
                    from files left join content_items on files.id = content_items.id where files.indexed_on is NULL order by content_items.created_on limit :count""", {'count': 10})
    for fid, md5, content_type in res:
        print fid, md5, content_type

    # statement = """update files set content = 'teext cooontent'
    #             set indexed_on = (now() at time zone 'UTC')
    #             where file_id = 1122"""
    # connection.execute(statement)

    session.commit()
    session.close()
    trans.commit()
예제 #2
0
def ssCloseAll():
    s = Session()
    s.close_all()