Skip to content

Commit 9501ebb

Browse files
Genesis929Yuan325
andauthored
feat(tool/bigquery-execute-sql)!: add allowed datasets support (googleapis#1443)
## Description This introduces a breaking change. The bigquery-execute-sql tool will now enforce the allowed datasets setting from its BigQuery source configuration. Previously, this setting had no effect on the tool. --- > Should include a concise description of the changes (bug or feature), it's > impact, along with a summary of the solution ## PR Checklist --- > Thank you for opening a Pull Request! Before submitting your PR, there are a > few things you can do to make sure it goes smoothly: - [ ] Make sure you reviewed [CONTRIBUTING.md](https://github.com/googleapis/genai-toolbox/blob/main/CONTRIBUTING.md) - [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/genai-toolbox/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) - [ ] Make sure to add `!` if this involve a breaking change 🛠️ Fixes googleapis#873 --------- Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com>
1 parent a3bd2e9 commit 9501ebb

5 files changed

Lines changed: 1138 additions & 21 deletions

File tree

docs/en/resources/tools/bigquery/bigquery-execute-sql.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,23 @@ It's compatible with the following sources:
1515

1616
- [bigquery](../../sources/bigquery.md)
1717

18-
`bigquery-execute-sql` takes a required `sql` input parameter and runs the SQL
19-
statement against the configured `source`. It also supports an optional `dry_run`
20-
parameter to validate a query without executing it.
18+
`bigquery-execute-sql` accepts the following parameters:
19+
- **`sql`** (required): The GoogleSQL statement to execute.
20+
- **`dry_run`** (optional): If set to `true`, the query is validated but not run,
21+
returning information about the execution instead. Defaults to `false`.
22+
23+
The tool's behavior is influenced by the `allowedDatasets` restriction on the
24+
`bigquery` source:
25+
- **Without `allowedDatasets` restriction:** The tool can execute any valid GoogleSQL
26+
query.
27+
- **With `allowedDatasets` restriction:** Before execution, the tool performs a dry run
28+
to analyze the query.
29+
It will reject the query if it attempts to access any table outside the
30+
allowed `datasets` list. To enforce this restriction, the following operations
31+
are also disallowed:
32+
- **Dataset-level operations** (e.g., `CREATE SCHEMA`, `ALTER SCHEMA`).
33+
- **Unanalyzable operations** where the accessed tables cannot be determined
34+
statically (e.g., `EXECUTE IMMEDIATE`, `CREATE PROCEDURE`, `CALL`).
2135

2236
## Example
2337

0 commit comments

Comments
 (0)