Skip to main content

Batch downloading data

Batch downloading is especially useful when you need to download extremely large datasets. This approach offers several advantages over traditional query methods.

Key advantages

  • Streamed delivery — Data arrives as a stream rather than waiting for complete server-side processing
  • Resumable downloads — Write data to file as it arrives, allowing restart points if connection interrupts
  • Memory efficiency — Avoids double memory usage common with standard DataFrame downloads
  • Simplicity — Code length is comparable to standard query-to-DataFrame approaches

Small batch download example

The simplest implementation submits a single large query and writes batches to file:
An enhanced version prevents empty files and handles headers correctly:

Large batch download process

For very large datasets, splitting downloads into monthly chunks prevents resource constraints:
This monthly chunking approach allows downloading even the largest datasets without memory constraints, making it ideal for production data pipelines.