コード例 #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)
コード例 #2
0
ファイル: unload.py プロジェクト: sangkyunyoon/studio
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)
コード例 #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)
コード例 #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)