CSV Export
CSV Export allows users to generate downloadable CSV files from application data using a query-driven, join-aware form.
Unlike basic table exports, CSV Export supports:
- Foreign key expansion
- Multi-table joins
- Explicit column selection
- Safe, deterministic query generation
Exports are streamed directly from the database and downloaded to the user’s device.
What Is CSV Export?
CSV Export is a snapshot output.
Each export:
- Represents data at a specific point in time
- Produces a file for external use
- Does not stay linked to live application data
CSV Export is ideal for reporting, analysis, and sharing structured data outside the application.
Opening the CSV Export Form
The CSV Export form can be opened from:
- Quick Actions → Export CSV
- (Future) Table views and admin utilities
The form is self-contained and handles the full export process.
Core Concepts
Base Table
The base table is the starting point of the export query.
- All joins originate from this table
- All rows in the export are derived from it
- Base table columns appear first in the column list
Column Selection
Only selected columns are included in the export.
This ensures:
- Minimal, intentional data output
- Predictable CSV structure
- No accidental data leakage
Unchecked columns are not queried or exported.
Foreign Key Expansion
Columns representing foreign keys may be expanded.
When expanded:
- Related table columns become selectable
- A
LEFT JOINis created automatically - Multiple levels of relationships may be explored
This allows exporting:
- Names instead of IDs
- Related metadata
- Flattened, denormalized datasets
Join Behavior
All joins generated by CSV Export are:
- LEFT JOINs
- Deterministic and deduplicated
- Automatically aliased
This ensures:
- No accidental row loss
- Predictable query results
- Safe handling of optional relationships
Column Tree Interface
Columns are displayed in a recursive tree:
- Base table columns appear at the top level
- Foreign key columns can be expanded
- Related table columns appear nested
Users can:
- Search base table columns
- Expand or collapse relationships
- Select fields at any depth
Each selected field becomes a column in the CSV.
Output Format
CSV Structure
Each exported CSV includes:
- A header row
- One row per database record
- Flattened values from joined tables
Column names follow a predictable pattern:
relatedtable__column