[FEAT] Add ability to output `show` results as a CSV
- Dominant language
- Rust
- Stars
- 13.8k
- Forks
- 2.6k
- Avg merge
- 21h 31m
- Merged PRs (30d)
- 56
Description
**Is your feature request related to a problem? Please describe.**
`dbt show` currently has two output modes: stdout and JSON.
The stdout mode is memory friendly, because it streams the results to stdout. However, that data is not in a very portable or machine-friendly format.
In JSON mode, the data is structured, portable, and machine-readable. However, the entire result set is encoded into a single [`ShowNode`](https://github.com/dbt-labs/proto-python-public/blob/8700d1fd813ab7f38c4dff4c1ca46cdf3f6aba93/dbtlabs/proto/public/v1/fields/core_types_pb2.pyi#L6816) message. This can cause OOM kills on memory-constrained cloud containers.
**Is your feature request related to a particular component of the dbt Fusion Engine**
- [x] CLI Features
- [ ] Adapter or Database Driver Features
- [ ] SQL Understanding Features
- [ ] VS Code extension
**Describe the solution you'd like**
I would like a solution that is both memory efficent and produces a structured, machine-readable result set.
To me, this would be the ability to specify an output CSV file via an additional flag.
Note: I do not want to _lose_ other stdout or JSON logs when running this way. Those can still be useful to end users and dbt Platform users. However, I want the result set itself to not be written to stdout or JSON and instead only have the result set written to a CSV when running this way.
**Describe alternatives you've considered**
- Output file could be other formats, such as parquet. However, for most end-users, CSV is more friendly and useful. And our use-cases for Canvas and IDE are for delivering CSVs to end users.
- Do nothing. Today we rely on JSON logs and getting the result out of the ShowNode message. However, this is slow and memory intensive when parsing a large result set.
**Additional context**
Cross-linking to [internal Slack thread](https://dbt-labs.slack.com/archives/C08PYQS8B7Z/p1750100737984399) and [internal GitHub issue](https://github.com/dbt-labs/fs/issues/4002).
Contributor guide
Assessment
This issue has not been assessed yet.