Skip to content

Commit 18bb394

Browse files
committed
docs: add documentation for file export feature
1 parent 69c56c1 commit 18bb394

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ A command-line tool for querying databases via [ADBC](https://arrow.apache.org/a
1313
- **Interactive SQL shell** - Execute SQL queries with command history and intuitive navigation
1414
- **Syntax highlighting** - SQL queries highlighted for improved readability
1515
- **Formatted output** - Results displayed in clean, aligned tables with dynamic column width
16+
- **File export** - Export query results to JSON, CSV, or Arrow IPC files
1617
- **Fast and lightweight** - Built in Rust for high performance and minimal resource usage
1718

1819
## Installation
@@ -97,6 +98,14 @@ $ adbcli --driver duckdb --file select_example.sql
9798
└────┴───────┴────────────┘
9899
```
99100

101+
Execute a query and output the result to a file:
102+
103+
```console
104+
$ adbcli --driver duckdb --query "SELECT 42 AS the_answer" --output result.json
105+
$ adbcli --driver duckdb --query "SELECT 42 AS the_answer" --output result.csv
106+
$ adbcli --driver duckdb --query "SELECT 42 AS the_answer" --output result.arrow
107+
```
108+
100109
## Reference
101110

102111
```console
@@ -114,6 +123,7 @@ Options:
114123
--mode <mode> Table display style [default: utf8_compact]
115124
--query <query> Execute query and exit
116125
--file <file> Read and execute file and exit
126+
--output <file> Write result to file
117127
-h, --help Print help
118128
-V, --version Print version
119129
```

docs/index.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ A command-line tool for querying databases via [ADBC](https://arrow.apache.org/a
1717
- **Interactive SQL shell** - Execute SQL queries with command history and intuitive navigation
1818
- **Syntax highlighting** - SQL queries highlighted for improved readability
1919
- **Formatted output** - Results displayed in clean, aligned tables with dynamic column width
20+
- **File export** - Export query results to JSON, CSV, or Arrow IPC files
2021
- **Fast and lightweight** - Built in Rust for high performance and minimal resource usage
2122

2223
## Getting Started
@@ -91,3 +92,11 @@ $ adbcli --driver duckdb --file select_example.sql
9192
│ 2 │ Alice │ 2001-03-22 │
9293
└────┴───────┴────────────┘
9394
```
95+
96+
Execute a query and output the result to a file:
97+
98+
```console
99+
$ adbcli --driver duckdb --query "SELECT 42 AS the_answer" --output result.json
100+
$ adbcli --driver duckdb --query "SELECT 42 AS the_answer" --output result.csv
101+
$ adbcli --driver duckdb --query "SELECT 42 AS the_answer" --output result.arrow
102+
```

docs/reference.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,22 @@ Read and execute file and exit
9090
adbcli --driver duckdb --file select_example.sql
9191
```
9292

93+
## --output
94+
95+
Write result to file
96+
97+
```sh
98+
adbcli --driver duckdb --query "SELECT 42 AS the_answer" --output result.json
99+
```
100+
101+
The output format is inferred from the file extension:
102+
103+
| Extension | Format |
104+
|-----------------|-----------|
105+
| `.json` | JSON |
106+
| `.csv` | CSV |
107+
| `.arrow`, `.ipc`| Arrow IPC |
108+
93109
## --help
94110

95111
Print the help message

0 commit comments

Comments
 (0)