Example #1
0
def unload(table, partial_path, mode="overwrite"):
    path = data_utils.make_data_path_from_key(partial_path[0])
    if os.path.isdir(path):
        shutil.rmtree(path)
    if mode == "append":
        try:
            old_frame = table_reader.read_parquet(
                util.make_data_path_from_key(partial_path[0]))
            new_frame = pd.concat([old_frame, table],
                                  axis=0,
                                  ignore_index=True)
            _write_dataframe(new_frame, path)
        except:
            _write_dataframe(table, path)
    else:
        _write_dataframe(table, path)
Example #2
0
def unload(table, partial_path, mode="overwrite"):
    path = data_utils.make_data_path_from_key(partial_path[0])
    if path == gateway.data_root or path == gateway.data_root + '/':
        raise_runtime_error(
            'Please check a path String and a type of path. Cannot use a root of directory for the path.'
        )
    if os.path.isdir(path):
        shutil.rmtree(path)
    if mode == "append":
        try:
            old_frame = table_reader.read_parquet(
                util.make_data_path_from_key(partial_path[0]))
            new_frame = pd.concat([old_frame, table],
                                  axis=0,
                                  ignore_index=True)
            _write_dataframe(new_frame, path)
        except:
            _write_dataframe(table, path)
    else:
        _write_dataframe(table, path)
Example #3
0
def _save_dataset(table, fname):
    DATASET_DIR_PATH = _get_dataset_path(fname)
    DATASET_FILE_PATH = DATASET_DIR_PATH + '''/{}'''.format(fname)
    _make_dir(_PATH_PARQUET)
    _make_dir(DATASET_DIR_PATH)
    _write_dataframe(table, DATASET_FILE_PATH)
Example #4
0
def unload(table, partial_path):
    path = data_utils.make_data_path_from_key(partial_path[0])
    if os.path.isdir(path):
        shutil.rmtree(path)
    _write_dataframe(table, path)