toExport
A function for exporting Polars DataFrames to various file formats with configurable options. This is the recommended way to export ETL data as it provides consistent formatting and multiple export format support.Basic Usage
Key Methods
toExport(data, name, outputDir, options)
Exports a Polars DataFrame to the specified output directory in the chosen format.Usage
Parameters
data
(pl.DataFrame): Polars DataFrame to exportname
(string): Name for the output fileoutputDir
(string): Directory path for output filesoptions
(ExportOptions): Optional configuration object
ExportOptions Interface
Configuration options for the export function.Properties
keys?
(string[]): Primary keys for the dataset (used in singer format)exportFormat?
(‘csv’ | ‘json’ | ‘jsonl’ | ‘parquet’ | ‘singer’): Output format (defaults to ‘singer’ or DEFAULT_EXPORT_FORMAT env var)outputFilePrefix?
(string): Prefix to add to output filenamesstringifyObjects?
(boolean): Whether to stringify object valuesreservedVariables?
(Record<string, string>
): Custom variables for prefix formattingallowObjects?
(boolean): Whether to allow object values in singer format (defaults to true)schema?
(SingerHeaderMap): Singer schema definition