Skip to main content

export_to_file

Function export_to_file 

Source
pub fn export_to_file(
    engine: &Engine,
    opts: &ExportOptions,
) -> Result<ExportResult, McpError>
Expand description

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

§Errors

  • Returns ErrorCode::PermissionDenied if opts.path already exists and opts.overwrite is false.
  • Returns ErrorCode::SqlError when neither opts.sql nor opts.table is provided (for row-oriented formats).
  • Returns ErrorCode::UnsupportedFormat when opts.format is not one of hyper, csv, parquet, arrow_ipc, or iceberg.
  • Propagates any format-specific error from the delegated exporter (SQL execution, I/O, or format-option validation failures).