On this page

Import / Export

BroadSQL moves data in two directions. DUMP writes data out: a table, a query result, the result of a Script or of an API call, into a file, a spreadsheet or a local H2 database. LOAD reads data in: the rows of a CSV file, inserted into an existing table after a preview.

Why export from BroadSQL

The data you need is usually already on screen: you ran a query, looked at the result, and now someone needs it in Excel, in a ticket, in a wiki page, or you want to keep a copy to work on without querying a remote system again. DUMP turns that result into a file in one command, with the same syntax for every destination, so there is no copy and paste through another tool and no second query to write.

Choosing a destination

You wantUsePage
A file for a person or a tool: CSV, tab separated text, JSON, Markdown, HTMLAS CSV, AS TEXT, AS JSON, AS MD, AS HTMLFiles and spreadsheets
A workbook, built up one worksheet at a timeAS XLSX, AS ODSFiles and spreadsheets
A local copy you can query, refresh and keep longer than the sourceAS H2Local H2 datasets
The result of a Script, with its argumentsDUMP LIB, DUMP @Script and API results
The result of an API callDUMP API RESULTScript and API results
Rows of a CSV file, inserted into a tableLOADImporting data

The common syntax, the sources, the default file names and formats, date and time handling, and the commands kept from earlier releases are described in Exporting data.

A first export

Run a query, check the result, then export exactly what you saw:

SELECT ID, NAME FROM CUSTOMER WHERE COUNTRY = 'FR';
DUMP / TO french AS MD;
2 row(s) exported to C:\BroadSQL\export\french.md.

french.md is a table ready to paste into an issue or a wiki page:

| ID | NAME |
| --- | --- |
| 1 | Ann |
| 3 | Chloe |

The file is written to the export folder (DefaultFolder, see Application settings).

A first import

Preview a CSV file against an existing table, then insert it:

LOAD CUSTOMER new_customers.csv PREVIEW;
LOAD CUSTOMER new_customers.csv EXECUTE;

The preview shows the target, the column mapping and the valid and rejected rows, and changes nothing. See Importing data.