From e2b67c556926dc06c1dc9e863e25100526eb1911 Mon Sep 17 00:00:00 2001 From: Evan Zacks Date: Mon, 11 Nov 2024 10:00:46 -0800 Subject: [PATCH 1/2] CLI overview: fix CSV examples The `-c` arg was missing from the example commands, leading to errors: $ cat test.csv | duckdb "SELECT * FROM read_csv('/dev/stdin')" Error: unable to open database "SELECT * FROM read_csv('/dev/stdin')": IO Error: Cannot open file "SELECT * FROM read_csv('/dev/stdin')": No such file or directory Note: this also applies to `docs/archive/1.0/api/cli/overview.md` which was left unmodified per CONTRIBUTING.md. --- docs/api/cli/overview.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api/cli/overview.md b/docs/api/cli/overview.md index f50c8a4bff9..af5117fc2c6 100644 --- a/docs/api/cli/overview.md +++ b/docs/api/cli/overview.md @@ -259,7 +259,7 @@ COPY (SELECT 42 AS woot UNION ALL SELECT 43 AS woot) TO 'test.csv' (HEADER); First, read a file and pipe it to the `duckdb` CLI executable. As arguments to the DuckDB CLI, pass in the location of the database to open, in this case, an in-memory database, and a SQL command that utilizes `/dev/stdin` as a file location. ```bash -cat test.csv | duckdb "SELECT * FROM read_csv('/dev/stdin')" +cat test.csv | duckdb -c "SELECT * FROM read_csv('/dev/stdin')" ``` | woot | @@ -271,7 +271,7 @@ To write back to stdout, the copy command can be used with the `/dev/stdout` fil ```bash cat test.csv | \ - duckdb "COPY (SELECT * FROM read_csv('/dev/stdin')) TO '/dev/stdout' WITH (FORMAT 'csv', HEADER)" + duckdb -c "COPY (SELECT * FROM read_csv('/dev/stdin')) TO '/dev/stdout' WITH (FORMAT 'csv', HEADER)" ``` ```csv From affaffeeb52d6689a0534b8359e78e43aa1531d6 Mon Sep 17 00:00:00 2001 From: Gabor Szarnyas Date: Wed, 13 Nov 2024 13:12:46 +0100 Subject: [PATCH 2/2] Backport fix to v1.0 --- docs/archive/1.0/api/cli/overview.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/archive/1.0/api/cli/overview.md b/docs/archive/1.0/api/cli/overview.md index 9f9e7a39094..bef0df7e360 100644 --- a/docs/archive/1.0/api/cli/overview.md +++ b/docs/archive/1.0/api/cli/overview.md @@ -259,7 +259,7 @@ COPY (SELECT 42 AS woot UNION ALL SELECT 43 AS woot) TO 'test.csv' (HEADER); First, read a file and pipe it to the `duckdb` CLI executable. As arguments to the DuckDB CLI, pass in the location of the database to open, in this case, an in-memory database, and a SQL command that utilizes `/dev/stdin` as a file location. ```bash -cat test.csv | duckdb "SELECT * FROM read_csv('/dev/stdin')" +cat test.csv | duckdb -c "SELECT * FROM read_csv('/dev/stdin')" ``` | woot | @@ -271,7 +271,7 @@ To write back to stdout, the copy command can be used with the `/dev/stdout` fil ```bash cat test.csv | \ - duckdb "COPY (SELECT * FROM read_csv('/dev/stdin')) TO '/dev/stdout' WITH (FORMAT 'csv', HEADER)" + duckdb -c "COPY (SELECT * FROM read_csv('/dev/stdin')) TO '/dev/stdout' WITH (FORMAT 'csv', HEADER)" ``` ```csv