Skip to main content

Export CSV

The Export CSV tool allows users to generate downloadable CSV files from database data using a query-driven, join-aware form.

Unlike basic table exports, this tool supports:

  • Foreign key expansion
  • Multi-table joins
  • Explicit column selection
  • Deterministic, safe SQL generation

Exports are streamed directly from the database and downloaded to the user’s device.


What Is Export CSV?

Export CSV is a data extraction tool, not a static dump.

Each export:

  • Starts from a base table
  • Optionally joins related tables
  • Selects explicit fields to include
  • Produces a downloadable CSV file

The export uses the same join planning logic as GIS Layers and other advanced views, ensuring consistency across the platform.


Opening the Export CSV Form

The Export CSV form can be opened from:

  • Quick Actions → Export CSV
  • (Future) Table views or admin utilities

The form opens as a self-contained popup and handles the entire export process internally.


Core Concepts

Base Table (t0)

The base table is the starting point of the export query.

  • Acts as FROM table AS t0
  • All joins originate from this table
  • Determines the initial column list

The base table must be selected before columns can be chosen.


Selected Columns

Selected columns define:

  • What data appears in the CSV
  • The structure of each exported row
  • The CSV header names

Only selected columns are queried and exported.

Unchecked columns are not included in the export.


Foreign Key Expansion

If a column represents a foreign key, it may be expanded.

When expanded:

  • The related table’s columns become selectable
  • A deterministic LEFT JOIN is created automatically
  • Multiple join levels are supported

Foreign key expansion allows exporting:

  • Human-readable names instead of IDs
  • Related attributes from connected tables
  • Flattened, denormalized CSVs

Join Behavior

All joins generated by Export CSV are:

  • LEFT JOINs
  • Deterministic and deduplicated
  • Automatically aliased (t0, t1, t2, …)

This ensures:

  • No accidental row loss
  • Predictable SQL output
  • Safe handling of optional relationships

Column Tree Interface

Columns are presented in a recursive tree:

  • Base table columns appear at the top level
  • Foreign key columns can be expanded
  • Related table columns appear nested

Users may:

  • Search base table columns
  • Expand or collapse relationships
  • Select fields at any depth

Each selected field becomes a column in the exported CSV.


Output Format

CSV Structure

The exported CSV includes:

  • A header row with column aliases
  • One row per database record
  • Flattened values from joined tables

Column names use a predictable pattern:

relatedtable__column