# Export query results to a client file

Use native `--query` mode to write query results to a file on the client machine. It writes only result bytes to stdout, including binary formats. The filename is interpreted by the shell, so it need not be accessible to the server.

```sh
./coordinator client --database data \
  --query 'SELECT id, name FROM people ORDER BY id FORMAT csv_with_names' \
  > people-export.csv
```

## Select a format deliberately

CSV with names is useful for tools that need column headers. `json_each_row` writes one named object per row. Parquet preserves a schema and native value mappings suitable for compatible consumers. Use explicit selected columns so the exported contract does not change merely because another column was added.

Check the client's exit status before publishing or replacing an artifact. Redirect to a new temporary filename first, validate its row count or read it back, then move it into the intended location. Do not mistake an error-created empty file for a successful export.

## Know the limits

Result rows and encoded response bytes still have request limits. For large exports, choose explicit ordered key ranges and verify every range. Server-side `file()` is an input source and cannot write an export file.

See [native client](https://coordinatordb.com/docs/concepts/features/interfaces/client), [formats](https://coordinatordb.com/docs/reference/formats) and [request limits](https://coordinatordb.com/docs/concepts/features/configuration/settings/query-complexity).
