class documentation
Manage append-style writes across partitioned parquet files.
Rows are buffered in memory and flushed to the current parquet file. A new file is selected every num_rows writes. Filenames are zero-padded numeric counters such as 0000000000.parquet.
| Method | __enter__ |
Undocumented |
| Method | __exit__ |
Undocumented |
| Method | __init__ |
Manage writing rows into partitioned parquet files. |
| Method | remove |
Undocumented |
| Method | write |
Write a row to the current parquet file. |
| Instance Variable | buffer |
In-memory column buffer for the current file. |
| Instance Variable | current |
Path to the current parquet file. |
| Instance Variable | dir |
Directory containing parquet files. |
| Instance Variable | num |
Current parquet file index. |
| Instance Variable | num |
Maximum rows written to one parquet file. |
| Instance Variable | parquet |
Existing parquet files discovered in dir. |
| Instance Variable | row |
Number of rows currently buffered or loaded from the current file. |
| Static Method | _ensure |
Undocumented |
| Method | _find |
Undocumented |
| Method | _flush |
Write buffered data to parquet. |
| Method | _generate |
Undocumented |
| Method | _initialize |
Undocumented |
| Method | _read |
Undocumented |
Manage writing rows into partitioned parquet files.
Example
>>> record = { ... "file": "image.jpg", ... "source_name": "image", ... "task_name": "detection", ... "class_name": "car", ... "instance_id": 0, ... "task_type": "boundingbox", ... "annotation": "{}", ... } >>> manager = ParquetFileManager("/tmp/ldf-parquet-example", num_rows=2) >>> manager.num_rows 2
| Parameters | |
directory:PathType | Local directory where parquet files are stored. |
numint | Maximum rows per parquet file before a new file is created. |
Write a row to the current parquet file.
| Parameters | |
uuid:str | Unique row identifier. |
data:ParquetRecord | Annotation row data. |
groupstr | Unique identifier for the sample group. |