pudl_diff.outputs
¶
Writing the rows that differ between two tables to Parquet files.
ParquetOutput
dataclass
¶
Metadata about a single Parquet side-output file written to disk.
Source code in src/pudl_diff/outputs.py
hash
instance-attribute
¶
"sha256:<hexdigest>", matching the convention PUDL's enriched
datapackage.json uses for its own resource files.
rows_written
instance-attribute
¶
Number of rows actually written to path.
total_row_count
instance-attribute
¶
Total number of differing rows on this side, before any capping by
max_rows_per_output_parquet.
RowDiffParquetOutputs
dataclass
¶
The left-only and right-only Parquet files written for one table's row diff.
Source code in src/pudl_diff/outputs.py
write_row_diff_parquet(row_diff, output_path, table_name, *, right_table_name=None, max_rows_per_output_parquet=None)
¶
Write a table's differing rows to left-only/right-only Parquet files.
Writes <table_name>_left_only.parquet and
<right_table_name>_right_only.parquet under output_path (created
if it doesn't exist), each matching the schema of the corresponding
source table. For a table with a primary key, each file holds that
side's rows from the symmetric difference of primary keys, plus that
side's values for rows whose non-PK data differs. For a table without
one, each file holds that side's rows from the symmetric difference of
whole rows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row_diff
|
RowSetDiff | KeyedRowDiff | None
|
The row-level comparison result to write out, e.g. from
|
required |
output_path
|
str | PathLike[str]
|
Directory to write the two Parquet files into. |
required |
table_name
|
str
|
Used as the filename prefix for the left output file,
and for the right one too unless |
required |
right_table_name
|
str | None
|
Used as the filename prefix for the right output
file, if it differs from |
None
|
max_rows_per_output_parquet
|
int | None
|
If given, caps the number of rows
written to each file. |
None
|
Returns:
| Type | Description |
|---|---|
RowDiffParquetOutputs | None
|
The two files' paths and metadata, or |
RowDiffParquetOutputs | None
|
|