Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion features/data-grid.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ After a plain click on a cell, `Cmd+C` copies the value of the cell under the cu

**Copy rows as** offers TSV, TSV with Headers, JSON, CSV, CSV with Headers and Markdown. Whatever the format, `Cmd+V` in a table pastes the copied rows, not the text. To copy one value out of a selection, choose **Edit > Copy Special > Copy Cell Value** for the cell the cursor is on, or **Copy Cell Value** in the right-click menu for the cell under the pointer.

Right-click and open **Copy as** for CSV, CSV with Headers, Markdown, and **IN Clause**, which writes `('a', 'b', 'c')` for a `WHERE col IN (…)`. **INSERT Statement(s)** and **UPDATE Statement(s)** appear when the result comes from a single table whose structure has loaded, and never on MongoDB or Redis. UPDATE is also missing on a table without a primary key that has a column no match can compare, such as a SQL Server `sql_variant`. **Copy Column Values** on the header menu copies one column, one value per line. Every format is also in **Edit > Copy Special**, where IN Clause takes the one column a cell selection covers, or the cursor's column. Those items have no shortcut until you record one in **Settings > Keyboard**.
A binary value copies whole as `0x` and its hex digits, however much the cell shows, and pasting that into a binary column writes the bytes back. A pasted value that starts with `0x` but is not hex, such as one cut short with `…`, leaves the cell as it was, and pasted rows holding one are not added.

Right-click and open **Copy as** for CSV, CSV with Headers, Markdown, and **IN Clause**, which writes `('a', 'b', 'c')` for a `WHERE col IN (…)`, booleans as `1` and `0` on an engine without `TRUE` and `FALSE` such as SQL Server, and binary values as the engine's binary literal. **INSERT Statement(s)** and **UPDATE Statement(s)** appear when the result comes from a single table whose structure has loaded, and never on MongoDB or Redis. UPDATE is also missing on a table without a primary key that has a column no match can compare, such as a SQL Server `sql_variant`. **Copy Column Values** on the header menu copies one column, one value per line. Every format is also in **Edit > Copy Special**, where IN Clause takes the one column a cell selection covers, or the cursor's column. Those items have no shortcut until you record one in **Settings > Keyboard**.

Every copy follows the grid as shown: hidden columns are left out, columns keep their current order, and over a cell selection only those columns go out. INSERT and UPDATE write what a save of the same row would. They leave out the columns the server fills in, such as identity and computed columns. INSERT leaves a cell set to `DEFAULT` to the server, and UPDATE assigns it `DEFAULT`. The table name carries its schema. UPDATE finds the row as it is stored, not as you have edited it: by every column of the primary key, whether or not those cells are selected, or on a table without one by every column, hidden ones included, which also changes any identical copy of the row. A row you added and have not saved gets no UPDATE.

Expand Down
6 changes: 5 additions & 1 deletion features/import-export.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ As SQL, a results export writes `INSERT` statements only. A result set is the ou
| Compression (Snappy, Zstd, Gzip, None) | Snappy |
| Rows per group | 122,880 |

Column types come from the source engine's own declarations, so numbers, dates and booleans arrive as those rather than as strings. A value that will not convert is written as null rather than failing the export.
Column types come from the source engine's own declarations, so numbers, dates and booleans arrive as those rather than as strings. A timestamp or time with time zone is written adjusted to UTC, so it keeps the instant it names. A column holding a value that will not convert is written as text, and the export says which column.

<Warning>
Parquet holds one table per file. Selecting several writes `dump.users.parquet`, `dump.orders.parquet` and so on beside the name you chose.
Expand Down Expand Up @@ -418,6 +418,10 @@ Saved mappings stay on this Mac. They follow a renamed table and are forgotten w

CSV and JSON insert in batches, and the on-error and transaction options behave as they do for SQL. They add **Delete existing rows before import**, which clears the target table before writing rows. The deletion rolls back only if it belongs to a transaction the import rolls back and the table supports rollback. A row where no field matches a mapped column writes nothing and is reported rather than counted.

A binary column reads a value the way the export wrote it: `0x` and hex digits from CSV and XLSX, `0x` alone for zero bytes, and Base64 from JSON. A CSV or XLSX value without `0x`, or a JSON value that is not Base64, is written as its text. A value that starts with `0x` but is not hex fails its row. On MySQL, MariaDB, SQL Server and SQLite, a boolean column takes `true`, `false`, `yes`, `no`, `on`, `off`, `t`, `f`, `y` and `n` as `1` and `0`.

A CSV line of empty fields, such as `,,`, is a row, the way CSV export writes a row of NULLs. An empty line is skipped, except in a file of one column, where it is that column's NULL. Empty lines and lines of empty fields after the last value are not rows: a spreadsheet saves its empty rows that way. A JSON row `{}` is a row of column defaults.

### Update existing rows

**Import as** decides what an import into an existing table does with a row whose key the table already holds:
Expand Down
Loading