Expand description
Cross-DB row copy: stream rows from one backend’s table or query
into another backend’s table, translating types via the unified
Value enum.
The default conflict policy is non-destructive — a copy into a
non-empty existing target table errors out before any INSERT (or
source SELECT) runs. Callers opt in to Append or Truncate via
IfExists.
Structs§
- AllTables
Options - Options for
copy_all_tables. - Copy
Options - Options for a copy operation.
- Cycle
Error - Error type for
topo_sort. Carries the cycle path so callers can surface it in the error message.
Enums§
- Bulk
Mode - Whether
copy_rowsshould route INSERT batches through the backend’s native bulk loader. - Copy
Format - Wire format used by the Postgres
COPYbulk path. - Copy
Source - Source side of a copy: a whole table or an arbitrary SELECT.
- IfExists
- What to do when the target table already exists and is non-empty.
Functions§
- copy_
all_ tables - Copy every table from
srctodstin FK-respecting order. - copy_
rows - Stream rows from
srctodstperopts. Returns the number of rows inserted into the target. - discover_
tables - Discover tables on
srcand apply include/exclude filters. Returns the filtered list inlist_tablesorder (alphabetical for most backends). Caller is expected to feed this intotopo_sortbefore issuing copies. - quote_
identifier - Backend-aware identifier quoting:
- topo_
sort - Topologically sort
tablesso parents are loaded before children, usingfksas the edge set. Tables referenced as parents but not present intables(e.g. excluded from--all-tablesselection) are dropped from the dependency graph. - translate_
ddl - Translate source column metadata into a
CREATE TABLE IF NOT EXISTSstatement for the destination backend. - translate_
type - Map a unified
TypeHintto a SQL type for the destination backend. The mapping favours portability over fidelity:Decimalcollapses to a(38,10)default on backends that need precision,Arraystores as a JSON-ish text, andOther/Nullfall back to the backend’s “wide string” type.