@manager.option('-s', '--source', dest='source',
                default='data/serialized_dump.txt',
                required=False, help='Restore fixture from dump')
def restore(source='data/serialized_dump.txt'):
    print("Start importing data")
    with open(source, 'rb') as f:
        data = json.loads(f.readline())
    for model_data in data:
        try:
            restored = loads(model_data, db.metadata, db.session)
        except __HOLE__ as e:
            print('Table does not exist: {}'.format(e))
            continue
        if restored:
            print('Importing {} table...'.format(restored[0].__table__.name))
        for item in restored:
            db.session.merge(item)

        db.session.commit()

    print('Done')
dataset/ETHPy150Open xen/flask-project-template/manage.py/restore