docs: add hybrid query usage instructions to CLAUDE.md
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ed43feb4e6
commit
872b06ffae
1 changed files with 16 additions and 0 deletions
16
CLAUDE.md
16
CLAUDE.md
|
|
@ -154,6 +154,22 @@ Before computing any business metric, look up the canonical definition:
|
|||
|
||||
Never invent metric calculations — always use the canonical definitions.
|
||||
|
||||
## Hybrid Queries (BigQuery + Local)
|
||||
|
||||
For tables too large to sync locally, use hybrid queries that JOIN local data with on-demand BigQuery results:
|
||||
|
||||
```bash
|
||||
da query --sql "SELECT o.*, t.views FROM orders o JOIN traffic t ON o.date = t.date" \
|
||||
--register-bq "traffic=SELECT date, SUM(views) as views FROM dataset.web WHERE date > '2026-01-01' GROUP BY 1"
|
||||
```
|
||||
|
||||
The `--register-bq` flag executes a BigQuery subquery, loads the result into memory, and makes it available as a DuckDB view for the final SQL. Multiple `--register-bq` flags can be used for multiple BQ sources.
|
||||
|
||||
For complex SQL, use stdin mode:
|
||||
```bash
|
||||
echo '{"register_bq": {"traffic": "SELECT ..."}, "sql": "SELECT ..."}' | da query --stdin
|
||||
```
|
||||
|
||||
## Extensibility
|
||||
|
||||
### Data Sources (extract.duckdb contract)
|
||||
|
|
|
|||
Loading…
Reference in a new issue