Skip to main content

Module export

Module export 

Source
Expand description

Export query results or whole tables to files.

All row-oriented formats (CSV, Parquet, Arrow IPC, Iceberg) go through hyperd’s native COPY (query) TO 'path' WITH (format => '…') writer. The MCP only issues a single SQL statement — no Rust-side type inference, no JSON intermediate, no in-memory buffering of the output. Hyperd writes the file (or directory) directly to disk and reports the written row count back as the statement’s affected-rows.

Supported formats:

  • CSVformat => 'csv', header => true.
  • Parquetformat => 'parquet'. Preserves NUMERIC precision, DATE/TIMESTAMP types, and column nullability. Order of magnitude faster than the previous JSON-mediated path.
  • Arrow IPC Streamformat => 'arrowstream'. Bit-identical to what Hyper speaks on the wire for its binary Arrow protocol.
  • Icebergformat => 'iceberg'. Destination is a directory (the Iceberg table root with metadata/ and data/ subdirs); hyperd creates it. Round-trips cleanly with load_iceberg.
  • Hyper — new .hyper file populated via CREATE DATABASE + ATTACH DATABASE + CREATE TABLE AS SELECT, openable directly in Tableau Desktop. (Cannot use plain std::fs::copy because on Windows hyperd holds an exclusive lock on the workspace file.)

Structs§

ExportOptions
Specifies what to export and where.
ExportResult
Returned by export_to_file with the exported row count and telemetry.

Functions§

export_to_file
Top-level export dispatcher. Resolves the source SQL, then delegates to the format-specific exporter.