Skip to content

Streaming import and export ​

Status: partially implemented; the rest is Proposed / awaiting approval. The desktop app implements live export (table, chosen tables or whole database; SQL, CSV and JSON; optional GZIP; one read-only snapshot; temporary file renamed when complete), CSV import into a table and MySQL/MariaDB SQL import; see the user guide for current behavior and the desktop host's live behaviour details for the implemented mechanisms. Browser-demo jobs still simulate progress and summaries only. Limits and mechanisms described in neither remain proposals.

v0.1.0 Alpha scope ​

Basic SQL and CSV import/export for MySQL/MariaDB is part of the approved alpha feature scope (D022, 2026-10-26). The table below records that scope decision; for what is implemented, see the status above. Unimplemented mechanisms and limits remain Proposed.

Format / featureAlpha treatment
CSV export (table or query result)Required; streaming, explicit encoding/delimiter/quote/header and a NULL marker distinct from the empty string
SQL exportRequired; logical exporter (table structure plus batched inserts), no dependency on a native dump tool; InnoDB exported from a consistent read-only snapshot, non-transactional tables labelled as not snapshot-consistent; views, routines, triggers and events listed as omitted
CSV import into an existing tableRequired; validated against live metadata, parameterized batches inside an owned transaction, stop on first error, truthful committed/rejected/unknown counts
SQL importRequired; statements run one at a time through the safe execution path, no whole-file rollback promise, implicit DDL commits stated; implemented for MySQL/MariaDB read-write sessions since read-write was enabled (A15)
GZIPProposed: export kept (no expansion risk; GZIP export is implemented); import deferred unless quotas apply to decompressed bytes with a tested expansion-ratio cap
XLSX importDeferred (approved deferral)
XLSX and JSON export, ZIPProposed deferral; JSON export has since been implemented in the desktop app
PostgreSQL and SQLite transfersPostgreSQL was admitted to the beta: data-only SQL, CSV and JSON export and CSV import ship; PostgreSQL SQL import is not offered. SQLite transfers stay deferred

Files are reached only through native save/open dialogs that issue owner-scoped, one-shot grants; exports write to a temporary file beside the target and rename atomically, removing it on cancel or failure. The implemented quotas (CSV import 64 MiB, SQL import 1 GiB, export batches and grant counts) were approved on 2026-11-17 (A18); the export free-space floor is not implemented yet.

Pipeline ​

The desktop app implements this pipeline for live export and import (native dialogs as the authorized source or sink); the server path is planned.

Diagram source
flowchart LR
  Source[Authorized source] --> Decode[Bounded parser or engine reader]
  Decode --> Validate[Schema and policy validation]
  Validate --> Stream[Backpressured batches]
  Stream --> Sink[Database or authorized file sink]
  Stream --> Progress[Counts and explicit partial outcomes]

Keep format configuration independent of Vue. Engine adapters supply quoting, object definitions and snapshot capabilities; transfer services own streaming, quotas and progress. Use cancellable bounded buffers; do not collect a whole database, CSV or workbook in memory.

Format decisions ​

FormatProposed behavior / risks
SQLEngine-aware DDL/data output; native dump tool versus logical exporter requires evaluation; import may partially commit DDL
CSVExplicit encoding, delimiter, quoting, header, NULL and empty-string semantics; schema validation before writes
JSONTagged lossless values or documented plain export policy; streaming array/record framing
XLSXPlanned only, Deferred for the alpha; preserve text precision, reject formula execution, bound workbook expansion and rows
GZIPStreaming compression with cancellation and byte quotas
ZIPBound expanded size/entries; evaluate streaming writer versus quota-limited temporary storage and central-directory requirements

Compression is orthogonal to format. Structure-only is invalid for CSV and other formats without schema representation. No filename extension should imply a different format silently. Unsafe spreadsheet formula interpretation must be addressed without silently changing raw database values: use explicit safe-cell encoding/export options.

Jobs, files and recovery ​

Desktop uses a native file permission/dialog grant, not unrestricted renderer paths. Server uses scoped uploads/download tokens, randomized temporary names, canonicalized paths and owner checks. Reject path traversal, symlinks where unsafe, archive bombs and over-quota jobs. Clean temporary files on cancellation, timeout, completion and restart; bounded job history contains no secrets or raw record content by default.

Expose read/written counts, skipped/rejected rows, snapshot consistency and committed/partial/unknown outcomes. SQL scripts and nontransactional engines cannot promise whole-file rollback. Resume/checkpoint support is deferred until requirements justify durable storage. Cancellation must stop future work and report already committed effects accurately.

Approval and testing ​

Choose Rust CSV/JSON/XLSX/archive libraries after memory, license, Unicode, compression and malformed-input spikes. Test large streams under a measured memory budget, slow consumers, cancellation, disk full, truncated input, invalid encoding, precision, duplicate/FK failures and restart cleanup. Round-trip tests must use disposable engines and independently verify exported content. Simulation success is never backup verification.

StoneQL v0.1.0-beta.3 · Public beta for macOS, Windows and Linux · Keep backups and verify important changes on the server.