Skip to content

feat(query): read SQL from @file or stdin (@-) - #163

Merged
utay merged 2 commits into
mainfrom
yu/query-file-input
Oct 20, 2026
Merged

utay merged 2 commits into
mainfrom
yu/query-file-input

Conversation

@utay

@utay utay commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

altertable query now accepts the @file convention already used by append and api -F:

altertable query @report.sql
cat report.sql | altertable query @-
  • @path reads the statement from a file; @- reads stdin. The positional statement stays required.
  • A missing file fails with File not found: <path>. An empty file or empty stdin is rejected.
  • The file contents are sent unchanged. There is no trimming or statement splitting.

Notes

  • @path / @- handling moves into a shared readFileArgument helper used by query, append, and api -F, so append now also accepts @-.
  • README.md, COMMANDS.md, and cli-reference.json are updated to match.

@utay utay self-assigned this Oct 20, 2026
@francoischalifour

Copy link
Copy Markdown
Member

@utay Should we reuse the @file convention we already support in append and api -F?

altertable query @report.sql
cat report.sql | altertable query @-

This would keep file input consistent across commands, preserve the required positional argument, and avoid introducing --file plus mutually exclusive argument validation.

@utay

utay commented Oct 20, 2026

Copy link
Copy Markdown
Member Author

@utay Should we reuse the @file convention we already support in append and api -F?

altertable query @report.sql
cat report.sql | altertable query @-

This would keep file input consistent across commands, preserve the required positional argument, and avoid introducing --file plus mutually exclusive argument validation.

Yes good idea, here Cursor spotted the altertable app --file ... commands but the append command is closer to query

Replace --file with the @file convention shared with append and api -F.
Move @path/@- handling into a shared readFileArgument helper, which also
lets append read from stdin with @-.

Co-authored-by: Cursor <cursoragent@cursor.com>
@utay utay changed the title feat(query): read SQL from a file or stdin with --file feat(query): read SQL from @file or stdin (@-) Oct 20, 2026
@utay
utay enabled auto-merge (squash) October 20, 2026 14:17
@utay
utay merged commit 1b0a5e9 into main Oct 20, 2026
16 checks passed
@utay
utay deleted the yu/query-file-input branch October 20, 2026 14:19
utay pushed a commit that referenced this pull request Oct 20, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.13.0](v1.12.0...v1.13.0)
(2026-10-20)


### Features

* **app:** adopt split data-app packages
([#160](#160))
([7725d45](7725d45))
* **apps:** preview single-file data apps with app dev --file
([#141](#141))
([7dbc130](7dbc130))
* **query:** read SQL from [@file](https://github.com/file) or stdin
(@-)
([#163](#163))
([1b0a5e9](1b0a5e9))


### Bug Fixes

* **config:** keep credential storage independent of working directories
([#158](#158))
([4902463](4902463))
* **query:** surface engine errors and preserve stream failures
([#159](#159))
([f892be8](f892be8))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants