Reddy SK
Reddy SK

Reputation: 1374

How can I suppress column header output when using mysqlsh?

I am trying to use mysqlsh but i need to suppress column headers. Unfortunately neither -N nor --skip-column-names doesn't work for the binary.

mysqlsh: unknown option -N
mysqlsh: unknown option --skip-column-names

I have this version:

mysqlsh   Ver 8.0.15-commercial for Linux on x86_64 - for MySQL 8.0.15 (MySQL Enterprise Server - Commercial)

I am not able to find other option then using sed

Upvotes: 1

Views: 1089

Answers (2)

Reddy SK
Reddy SK

Reputation: 1374

At the end I have used workaround:

/opt/mysql/8.0/bin/mysqlsh --uri ${URI} --sqlc -D ${SCHEMA} -e ${HEADER_SQL} | tail -n +2 > ${TMPFILE} 

Upvotes: 1

fancyPants
fancyPants

Reputation: 51868

I'm not yet familiar with mysqlsh and can't try it right now, but --result-format sounds promising.

--result-format={table|tabbed|vertical|json|json/raw}

Set the value of the resultFormat MySQL Shell configuration option for this session. Formats are as follows:

  • table

    The default for interactive mode, unless another value has been set persistently for the resultFormat configuration option in the configuration file, in which case that default applies. The --table alias can also be used.

  • tabbed

    The default for batch mode, unless another value has been set persistently for the resultFormat configuration option in the configuration file, in which case that default applies. The --tabbed alias can also be used.

  • vertical

    Produces output equivalent to the \G terminator for an SQL query. The --vertical or -E aliases can also be used.

  • json

    Produces pretty-printed JSON. json/raw

    Produces raw JSON.

If the --json command line option is used to activate JSON wrapping for output for the session, the --result-format option and its aliases and the value of the resultFormat configuration option are ignored.

Upvotes: 2

Related Questions