Skip to main content

Output Formats

The .mode dot command may be used to change the appearance of the tables returned in the terminal output. In addition to customizing the appearance, these modes have additional benefits. This can be useful for presenting Goose output elsewhere by redirecting the terminal output to a file. Using the insert mode will build a series of SQL statements that can be used to insert the data at a later point. The markdown mode is particularly useful for building documentation and the latex mode is useful for writing academic papers.

List of Output Formats

ModeDescription
asciiColumns/rows delimited by 0x1F and 0x1E
boxTables using unicode box-drawing characters
csvComma-separated values
columnOutput in columns (See .width)
duckboxTables with extensive features (default)
htmlHTML <table> code
insert ⟨TABLE⟩SQL insert statements for ⟨TABLE⟩
jsonResults in a JSON array
jsonlinesResults in a NDJSON
latexLaTeX tabular environment code
lineOne value per line
listValues delimited by `
markdownMarkdown table format
quoteEscape answers as for SQL
tableASCII-art table
tabsTab-separated values
tclTCL list elements
trashNo output

Changing the Output Format

Use the vanilla .mode dot command to query the appearance currently in use.

.mode
current output mode: duckbox

Use the .mode dot command with an argument to set the output format.

.mode markdown
SELECT 'quacking intensifies' AS incoming_ducks;
|    incoming_ducks    |
|----------------------|
| quacking intensifies |

The output appearance can also be adjusted with the .separator command. If using an export mode that relies on a separator (csv or tabs for example), the separator will be reset when the mode is changed. For example, .mode csv will set the separator to a comma (,). Using .separator "|" will then convert the output to be pipe-separated.

.mode csv
SELECT 1 AS col_1, 2 AS col_2
UNION ALL
SELECT 10 AS col1, 20 AS col_2;
col_1,col_2
1,2
10,20
.separator "|"
SELECT 1 AS col_1, 2 AS col_2
UNION ALL
SELECT 10 AS col1, 20 AS col_2;
col_1|col_2
1|2
10|20

duckbox Mode

By default, Goose renders query results in duckbox mode, which is a feature-rich ASCII-art style output format.

The duckbox mode supports the large_number_rendering option, which allows human-readable rendering of large numbers. It has three levels:

  • off – All numbers are printed using regular formatting.
  • footer (default) – Large numbers are augmented with the human-readable format. Only applies to single-row results.
  • all - All large numbers are replaced with the human-readable format.

See the following examples:

.large_number_rendering off
SELECT pi() * 1_000_000_000 AS x;
┌───────────────────┐
│ x │
│ double │
├───────────────────┤
│ 3141592653.589793 │
└───────────────────┘
.large_number_rendering footer
SELECT pi() * 1_000_000_000 AS x;
┌───────────────────┐
│ x │
│ double │
├───────────────────┤
│ 3141592653.589793 │
│ (3.14 billion) │
└───────────────────┘
.large_number_rendering all
SELECT pi() * 1_000_000_000 AS x;
┌──────────────┐
│ x │
│ double │
├──────────────┤
│ 3.14 billion │
└──────────────┘