Skip to content

Output formats ​

Pick a format with --format / -F on the command line, \T in the REPL, or table_format in the config. \T alone lists them.

Table formats ​

For reading. They respect max_field_width, switch to vertical layout when expanded = "auto" and the table is too wide, and print a status line (3 rows · 0.4 ms) in the REPL.

FormatAlso acceptedLooks like
rounded (default)fancy_grid, fancy, round╭──┬──╮ with rounded corners
unicodepsql_unicode, box┌──┬──┐ single lines
doubledouble_grid╔══╦══╗ double lines
asciigrid, mysql+----+----+, like the mysql client
psqlLike psql: a -+- rule under the header, no outer border
simpleA ---- rule under the header
minimalColumn gaps and a ─ rule under the header
plainColumns separated by spaces only
markdowngithub, md, pipeA GitHub-flavoured Markdown table
verticalexpandedOne name: value line per column, one block per row, like mysql's \G

The same result in four of them:

rounded                   ascii                     markdown              psql
╭────────┬────────╮       +--------+--------+       | status | orders |    status | orders
│ status │ orders │       | status | orders |       |--------|-------:|   --------+--------
├────────┼────────┤       +--------+--------+       | new    |    666 |    new    |    666
│ new    │    666 │       | new    |    666 |       | paid   |    667 |    paid   |    667
├────────┼────────┤       +--------+--------+
│ paid   │    667 │       | paid   |    667 |
╰────────┴────────╯       +--------+--------+

In the boxed formats (rounded, unicode, double, ascii) a line separates the rows. Set row_lines = false in the config for a more compact table.

Machine formats ​

For other programs. They're never coloured, cut or turned vertical, and print only the data.

FormatAlso acceptedOutput
csvHeader row, then one line per row. NULL is an empty field.
tsvHeader row, tab-separated. Tabs, newlines and backslashes are escaped (\t, \n, \\). NULL is null_string.
jsonAn array of objects. Numbers and booleans stay typed, JSON columns are embedded, NULL is null.
jsonljsonlines, ndjsonOne JSON object per line
htmlA <table> with <thead> and <tbody>
sql-insertsql_insertINSERT INTO table (…) VALUES (…); per row
sql-updatesql_updateUPDATE table SET … WHERE first_column = …; per row

When quarry's output goes to a pipe or a file and you haven't chosen a format, it uses tsv.

In the REPL and in scripts, sql-insert and sql-update use the placeholder table name table; replace it with the real name. The TUI's export fills in the real name.

SQLite .mode ​

On SQLite, .mode accepts sqlite3's names too:

.modequarry format
linevertical
listplain
tabstsv
columnsimple
tableascii
insertsql-insert
qboxunicode

Vertical output ​

Vertical output shows one record at a time, one line per column, which suits wide rows. With expanded = "auto" (the default) a table that's wider than the terminal switches to it on its own; \x off (or expanded = "off") keeps the table and lets the pager scroll it sideways.

In the boxed formats (rounded, unicode, double, ascii) the records keep the table's look, each one numbered in the rule above it:

╭─ 1 ────────┬─────────────────────
│         id │ 1
│      email │ user1@example.com
│       name │ User 1
├─ 2 ────────┼─────────────────────
│         id │ 2
│      email │ user2@example.com
│       name │ User 2
╰────────────┴─────────────────────

\x cycles vertical output off → on → auto, and \x on, \x off, \x auto set it directly. End a single statement with \G instead of ; to show just that result vertically.

The other formats, and -F vertical (for scripts), use mysql's layout:

$ quarry shop.db -F vertical -e "select id, email, name from users where id = 1"
*************************** 1. row ***************************
   id: 1
email: user1@example.com
 name: User 1

Released under the MIT licence.