files.parquet.pq_restore

files.parquet.pq_restore(
    file_basename,
    schema,
    data_dir=None,
    archive=True,
    archive_dir=None,
)

Restore an archived parquet file into the schema directory.

For workflow-oriented examples, see Parquet Utilities Examples and Data management ideas.

Parameters

Name Type Description Default
file_basename str Archived parquet basename to restore. May include or omit the .parquet suffix and should refer to a file in <data_dir>/<schema>/<archive_dir>/. required
schema str Name of the parquet schema directory. required
data_dir str Root directory of the parquet data repository. If omitted, defaults to DATA_DIR or the current working directory. None
archive bool If True and an active destination file already exists, archive the current active file before restoring the archived version. True
archive_dir str Name of the archive directory under the schema directory. Defaults to "archive". None

Returns

Name Type Description
str or None Restored active parquet file path as a string, or None if the restore could not be completed.

Examples

>>> pq_restore("company_20240614T062835Z", "comp")
>>> pq_restore("company_20240614T062835Z.parquet", "comp", archive=False)