Пример #1
0
def database_load_versioned(feed_file, db_url, **kwargs):
    db = Database(url=db_url)
    session = db.get_session()
    existing_file = session.query(FeedFile).get(feed_file.md5sum)

    if existing_file and existing_file.completed:
        log.debug("FeedFile: {} already at its newest.".format(feed_file.file_url))
        return

    session.merge(feed_file)
    session.commit()

    try:
        database_load(filename=feed_file.file_url, db_url=db_url, file_id=feed_file.md5sum, **kwargs)
        feed_file.completed = True
    except Exception, e:
        traceback.print_exc(file=sys.stdout)
        log.error('Error processing: {} Message: {}'.format(feed_file.file_url,e))
Пример #2
0
def create_shapes_geom(db_url, shape_id):
    db = Database(url=db_url, is_geospatial=True)
    session = db.get_session()
    session.merge(ShapeGeom.create_shape_geom(shape_id, session))
    session.commit()