Skip to main content

Module transform_common

Module transform_common 

Source
Expand description

Shared plumbing for the row-level transform commands (sample, shard).

Both commands follow the same pipeline: split the dump into per-table temp files, build a schema graph, walk each table’s data rows, spill selected rows to disk, then synthesize a single SQL output file. This module owns the pieces that were previously duplicated between the two commands:

Re-exports§

pub use crate::parser::RowFlow;

Structs§

RowSpillReader
Reader for row spill files written by RowSpillWriter.
RowSpillWriter
Writer for spilling selected rows to a temp file with bounded memory.
SplitPhase
Result of the phase-0 split into per-table temp files.

Enums§

RowFormat
Row format indicator for spilled/converted rows.
UnifiedRow
Combined row representation for both MySQL INSERT and PostgreSQL COPY.

Functions§

build_schema_graph
Build a schema graph from a directory of split per-table files.
convert_copy_to_insert_values
Convert PostgreSQL COPY format (tab-separated) to INSERT VALUES format.
convert_row_to_postgres
Convert a MySQL-style row to PostgreSQL syntax.
for_each_data_row
Walk every data row of a per-table SQL file, invoking f for each row.
is_copy_data_block
Returns true if stmt is a PostgreSQL COPY data block (ends with the \. terminator).
is_numeric
Check if a byte slice represents a numeric value.
quote_ident
Quote an identifier for the given dialect.
split_to_temp_tables
Phase 0 shared by sample/shard: split the input dump into per-table temp files, with an optional byte-based progress bar.
write_dialect_footer
Write the dialect-specific session footer (restores header settings).
write_dialect_header
Write the dialect-specific session header (FK checks off, encoding, etc.).
write_insert_chunk
Write a chunk of spilled rows as a single multi-row INSERT statement.