Beispiel #1
0
def main():
    conf = appconfig('config:/home/cspot/webapps/cspot/cspot/development.ini', name='main')
    engine = engine_from_config(conf, 'sqlalchemy.')

    DBSession.configure(bind=engine)

    Base.metadata.bind = engine
    Base.metadata.bind.echo = True
    Base.metadata.drop_all(engine)
    Base.metadata.create_all(engine)
Beispiel #2
0
def main():
    conf = appconfig('config:/home/cspot/webapps/cspot/cspot/production.ini', name='main')
    engine = engine_from_config(conf, 'sqlalchemy.')

    DBSession.configure(bind=engine)
    session = DBSession()
    conn = session.connection()

    # conn.execute('alter table projects add reviewed')

    files = conn.execute("select id, filename from `values` where type = 'file'")

    for id, filename in files.fetchall():
        if filename:
            files = [filename]
        else:
            files = []

        conn.execute("update `values` set text_value = %s where id = %s", simplejson.dumps(files), id)
        print id, files

    mark_changed(session)
    transaction.commit()