Skip to content

Commit

Permalink
📝 SQLInsert Formatter (#165)
Browse files Browse the repository at this point in the history
* 📝 SQLInsert Formatter

Signed-off-by: Julio Jimenez <julio@julioj.com>

* README

Signed-off-by: Julio Jimenez <julio@julioj.com>

* sqlinsert

Signed-off-by: Julio Jimenez <julio@julioj.com>

---------

Signed-off-by: Julio Jimenez <julio@julioj.com>
  • Loading branch information
juliojimenez authored Mar 4, 2023
1 parent de95c12 commit 1ef7512
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ clickhouse-cl supports automatic input and output format processing for the form
| [CSV](https://clickhouse.com/docs/en/interfaces/formats/#csv) | :heavy_check_mark: | :heavy_check_mark: | '('(string*)*) ||
| [CSVWithNames](https://clickhouse.com/docs/en/interfaces/formats/#csvwithnames) | :heavy_check_mark: | :heavy_check_mark: | '('(string*)*) ||
| [CSVWithNamesAndTypes](https://clickhouse.com/docs/en/interfaces/formats/#csvwithnamesandtypes) | :heavy_check_mark: | :heavy_check_mark: | '('(string*)*) ||
| [SQLInsert](https://clickhouse.com/docs/en/interfaces/formats/#sqlinsert) || :heavy_check_mark: | string ||
| [JSON](https://clickhouse.com/docs/en/interfaces/formats/#json) | :heavy_check_mark: | :heavy_check_mark: | BOOST-JSON:JSON-OBJECT | jget *obj* *key* |
| [JSONAsString](https://clickhouse.com/docs/en/interfaces/formats/#jsonasstring) | :heavy_check_mark: ||||
| [JSONStrings](https://clickhouse.com/docs/en/interfaces/formats/#jsonstrings) | :heavy_check_mark: | :heavy_check_mark: | BOOST-JSON:JSON-OBJECT | jget *obj* *key* |
Expand Down
2 changes: 1 addition & 1 deletion clickhouse.asd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
:description "Common Lisp ClickHouse Client Library"
:author "julio@clickhouse.com"
:license "Apache-2.0"
:version "0.39.0"
:version "0.40.0"
:depends-on (#:boost-json
#:dexador
#:lexer
Expand Down
1 change: 1 addition & 0 deletions src/ch-sql-parser.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@
((equal chosen-format "CSV") (setf *format* 'csv))
((equal chosen-format "CSVWithNames") (setf *format* 'csvwithnames))
((equal chosen-format "CSVWithNamesAndTypes") (setf *format* 'csvwithnamesandtypes))
((equal chosen-format "SQLInsert") (setf *format* 'sqlinsert))
((equal chosen-format "JSON") (setf *format* 'json))
((equal chosen-format "JSONStrings") (setf *format* 'jsonstrings))
((equal chosen-format "JSONColumns") (setf *format* 'jsoncolumns))
Expand Down
6 changes: 4 additions & 2 deletions src/utils.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
(equalp formatting clickhouse.ch-sql-parser::'prettyspacenoescapes)
(equalp formatting clickhouse.ch-sql-parser::'prettyspacemonoblock)
(equalp formatting clickhouse.ch-sql-parser::'prettyspacenoescapesmonoblock)
(equalp formatting clickhouse.ch-sql-parser::'markdown)))
(equalp formatting clickhouse.ch-sql-parser::'markdown)
(equalp formatting clickhouse.ch-sql-parser::'sqlinsert)))
(format t "~d" (prettycompact-formatter b)))
((ver formatting) (cond ((or
(equalp formatting clickhouse.ch-sql-parser::'json)
Expand Down Expand Up @@ -97,7 +98,8 @@
(equalp formatting clickhouse.ch-sql-parser::'prettyspacenoescapes)
(equalp formatting clickhouse.ch-sql-parser::'prettyspacemonoblock)
(equalp formatting clickhouse.ch-sql-parser::'prettyspacenoescapesmonoblock)
(equalp formatting clickhouse.ch-sql-parser::'markdown))
(equalp formatting clickhouse.ch-sql-parser::'markdown)
(equalp formatting clickhouse.ch-sql-parser::'sqlinsert))
(prettycompact-formatter b))
((or
(equalp formatting clickhouse.ch-sql-parser::'tabseparated)
Expand Down

0 comments on commit 1ef7512

Please sign in to comment.