Skip to content

Commit cddb4d8

Browse files
Headers docs (#366)
1 parent b3628f2 commit cddb4d8

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

docs/cli.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,59 @@ dft flightsql get-xdbc-type-info
5151
dft flightsql get-xdbc-type-info --data-type 4 # Filter by specific SQL data type
5252
```
5353

54+
## Headers
55+
56+
Additional HTTP headers can be attached to FlightSQL connections using `--header` or `--headers-file`. These are useful for passing authentication tokens, tenant identifiers, or any other metadata required by the server.
57+
58+
### Single headers (`--header`)
59+
60+
Pass one or more `Name: Value` pairs directly on the command line. The flag can be repeated:
61+
62+
```sh
63+
dft -c "SELECT 1" --flightsql --header "x-api-key: secret"
64+
dft -c "SELECT 1" --flightsql --header "x-tenant: acme" --header "x-api-key: secret"
65+
```
66+
67+
### Headers file (`--headers-file`)
68+
69+
For many headers, or to avoid exposing secrets in shell history, store them in a file and point `--headers-file` at it:
70+
71+
```sh
72+
dft -c "SELECT 1" --flightsql --headers-file ~/.config/dft/headers.txt
73+
```
74+
75+
The file supports three formats (which can be mixed in the same file):
76+
77+
```
78+
# Simple format
79+
x-api-key: secret123
80+
x-tenant: acme
81+
82+
# Curl config format
83+
header = x-request-id: abc-123
84+
85+
# Curl -H flag format
86+
-H "authorization: Bearer mytoken"
87+
-H 'database: production'
88+
```
89+
90+
Lines beginning with `#` and blank lines are ignored.
91+
92+
The headers file path can also be set in the config so it is always picked up without needing the flag each time:
93+
94+
```toml
95+
[flightsql_client]
96+
headers_file = "/home/user/.config/dft/headers.txt"
97+
```
98+
99+
### Precedence
100+
101+
When headers are specified in multiple places they are merged in this order (later sources win):
102+
103+
1. Config file (`flightsql_client.headers`)
104+
2. Headers file (config `headers_file` or `--headers-file`)
105+
3. `--header` flags on the command line
106+
54107
## Auth
55108

56109
Basic Auth or Bearer Token can be set in your config, which is used by the client:

0 commit comments

Comments
 (0)