From 14b90d43c4717e3542f8c9aa57dec5c3ab71ce9f Mon Sep 17 00:00:00 2001 From: Gabor Szarnyas Date: Fri, 11 Aug 2023 12:35:01 +0200 Subject: [PATCH] duckdb: add page (#10549) --- pages/common/duckdb.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 pages/common/duckdb.md diff --git a/pages/common/duckdb.md b/pages/common/duckdb.md new file mode 100644 index 0000000000..4da3a97276 --- /dev/null +++ b/pages/common/duckdb.md @@ -0,0 +1,36 @@ +# duckdb + +> Command-line client for DuckDB, an in-process analytical SQL engine. +> More information: . + +- Start an interactive shell with a transient in-memory database: + +`duckdb` + +- Start an interactive shell on a database file. If the file does not exist, a new database is created: + +`duckdb {{path/to/dbfile}}` + +- Directly query a CSV, JSON, or Parquet file: + +`duckdb -c "{{SELECT * FROM 'data_source.[csv|csv.gz|json|json.gz|parquet]'}}"` + +- Run a SQL script: + +`duckdb -c ".read {{path/to/script.sql}}"` + +- Run query on database file and keep the interactive shell open: + +`duckdb {{path/to/dbfile}} -cmd "{{SELECT DISTINCT * FROM tbl}}"` + +- Run SQL queries in file on database and keep the interactive shell open: + +`duckdb {{path/to/dbfile}} -init {{path/to/script.sql}}` + +- Read CSV from stdin and write CSV to stdout: + +`cat {{path/to/source.csv}} | duckdb -c "{{COPY (FROM read_csv_auto('/dev/stdin')) TO '/dev/stdout' WITH (FORMAT CSV, HEADER)}}"` + +- Display help: + +`duckdb -help`