pub async fn export_data<S: StorageClient + StorageSchemaContextOps + StorageSyncContextOps + StorageOperationContextOps + Clone + Send + Sync + 'static>(
__arg0: State<AppState<S>>,
__arg1: Extension<i64>,
__arg2: Query<ExportQuery>,
) -> Result<Response, HttpError>Expand description
Re-execute a single query and stream the result out as a download.
Rows are pulled chunk-at-a-time and encoded straight into the response
body, so peak memory stays flat regardless of result size. This is a
fresh execution, not a snapshot of what the browser buffered: data may
have changed between display and export. Only csv and jsonl are
supported; jsonl carries one object per line because a JSON array
cannot be appended to without backtracking.
Transport note: this route sits behind the session-header auth middleware, so browsers fetch it with script (which can attach the session header) and buffer the body before saving. A native anchor download is not used because it cannot send the header, and passing the session through the URL would leak it via history and logs.