Skip to content

Async CSV/COPY: import_csv / export_csv / import_text / export_text on AsyncConnection #64

@StefanSteiner

Description

@StefanSteiner

Summary

The copy module is sync-only — import_csv, export_csv, import_text, export_text are all defined under impl Connection and have no async counterparts on AsyncConnection. Async users either block-on-thread or fall back to the Arrow path. The underlying primitives (AsyncClient::copy_in / copy_out) already exist, so this is plumbing, not new protocol work.

Current state

All four CSV/text COPY methods live in hyperdb-api/src/copy.rs:

AsyncConnection exposes none of these. Original gap analysis: §4 of docs/RUST_API_GAP_ANALYSIS.md (predecessor repo).

Proposed work

  • Add async equivalents on AsyncConnection: export_csv, export_text, export_csv_string, import_csv, import_csv_with_header, import_text. Use impl AsyncRead/AsyncWrite (from tokio::io) instead of std::io::Read/Write.
  • Mirror the existing sync API surface and behavior exactly — same arguments, same return types, same error semantics.
  • Add tests that exercise each async path against a real Hyper instance (use the existing TestConnection patterns in hyperdb-api/tests/).
  • Add an example under hyperdb-api/examples/ demonstrating async CSV import + export.

Backwards compatibility

Purely additive. New methods on AsyncConnection only.

Performance note

The plumbing path is AsyncClient::copy_in/copy_out (already implemented). The async wrappers should stream through chunked I/O without buffering the full CSV — match the streaming behavior of the sync versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions