Skip to main content
Skip to main content

clickhouse-format

Allows formatting input queries.

Keys:

  • --help or-h — Produce help message.
  • --query — Format queries of any length and complexity.
  • --hilite — Add syntax highlight with ANSI terminal escape sequences.
  • --oneline — Format in single line.
  • --max_line_length — Format in single line queries with length less than specified.
  • --comments — Keep comments in the output.
  • --quiet or -q — Just check syntax, no output on success.
  • --multiquery or -n — Allow multiple queries in the same file.
  • --obfuscate — Obfuscate instead of formatting.
  • --seed <string> — Seed arbitrary string that determines the result of obfuscation.
  • --backslash — Add a backslash at the end of each line of the formatted query. Can be useful when you copy a query from web or somewhere else with multiple lines, and want to execute it in command line.

Examples

  1. Formatting a query:

Result:

  1. Highlighting and single line:

Result:

  1. Multiqueries:

Result:

  1. Obfuscating:

Result:

Same query and another seed string:

Result:

  1. Adding backslash:

Result: