1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-06-07 23:26:00 +02:00

duckdb: add direct querying option (#16564)

This commit is contained in:
Gabor Szarnyas 2025-05-25 23:02:44 +02:00 committed by GitHub
parent 969da941ae
commit f42b9da9b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,10 +11,14 @@
`duckdb {{path/to/dbfile}}`
- Directly query a CSV, JSON, or Parquet file:
- Query a CSV, JSON, or Parquet file using SQL:
`duckdb -c "{{SELECT * FROM 'data_source.[csv|csv.gz|json|json.gz|parquet]'}}"`
- Directly query a CSV, JSON, or Parquet file using the `file` view:
`duckdb {{data_source.[csv|csv.gz|json|json.gz|parquet]}} -c "{{ SELECT * FROM file }}"`
- Run an SQL script:
`duckdb -f {{path/to/script.sql}}`
@ -23,10 +27,6 @@
`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('/dev/stdin')) TO '/dev/stdout' WITH (FORMAT CSV, HEADER)}}"`