Export, import and transfer
Rows are written as they arrive, so a large table never has to fit in memory.
⌘⌥E on any grid. Format, scope and the options that format needs, and nothing else.Export
Scope is the selection, the loaded rows, or the entire table or query. The last re-executes the statement and streams straight to disk with a progress sheet you can cancel. Export runs off the main thread and writes through a buffered file handle.
=, +, -, @, tab or carriage return is prefixed so a spreadsheet shows it as text. The switch is on by default (ADR-0032).Dump and import
Dump writes a database, a schema or a set of tables as SQL, structure and data or either alone, in the engine’s dialect. Import runs a SQL script, statement by statement through the same splitter the editor uses, and reports progress and any failure with the statement that caused it.
Import Data
Import Data… — it used to be Import from CSV — reads CSV, TSV, Excel (.xlsx), JSON and JSON Lines into a table. The sheet names the file, the sheet of the workbook and the table, and each table column chooses the file column that fills it; Match by Name and Match by Position do the whole table at once. The file is mapped, not loaded: rows go in as they are read, with type coercion, and the rows that could not be coerced are shown rather than dropped.
- Any sheet of a workbook can be imported, not only the first.
- The encoding — UTF-8, UTF-16, Windows-1252, ISO-8859-1 — and the separator are read from the file and can be changed, so a CSV that Excel saved in UTF-16, or separated with semicolons, arrives as text rather than odd characters.
- A number typed in Excel arrives as it was typed. Excel stores
-8.59940239as-8.5994023899999995; Tinker reads it back as the shortest decimal that is the same number. A workbook Tinker exported is left exactly as written, so a 29-digitnumericcomes back digit for digit. - The sheet names a column that is NOT NULL, has no default and is not filled, before the server refuses the first row. An old
.xlsworkbook, or any other binary file, is refused with a message asking for.xlsxrather than read as noise.
Transfer between databases
Transfer copies tables from one connection to another, including across engines, streaming rows through in batches. Across engines the table is rebuilt in the target’s own terms — its spelling of the types, defaults it can read, the primary key, the indexes and the foreign keys — and the rows travel as the target’s literals: a PostgreSQL array arrives as JSON, a zone offset as ±HH:MM. Data sync compares rows by primary key and generates the INSERT, UPDATE and DELETE statements that would make the target match; like structure sync it shows destructive statements separately. Neither ever holds a table in memory.