bigquery-sql

A “bigquery-sql” tool executes a pre-defined SQL statement.

About

A bigquery-sql tool executes a pre-defined SQL statement. It’s compatible with the following sources:

GoogleSQL

BigQuery uses GoogleSQL for querying data. The integration with Toolbox supports this dialect. The specified SQL statement is executed, and parameters can be inserted into the query. BigQuery supports both named parameters (e.g., @name) and positional parameters (?), but they cannot be mixed in the same query.

Note: This tool uses parameterized queries to prevent SQL injections. Query parameters can be used as substitutes for arbitrary expressions. Parameters cannot be used as substitutes for identifiers, column names, table names, or other parts of the query.

Example

tools:
  # Example: Querying a user table in BigQuery
  search_users_bq:
    kind: bigquery-sql
    source: my-bigquery-source
    statement: |
      SELECT
        id,
        name,
        email
      FROM
        `my-project.my-dataset.users`
      WHERE
        id = @id OR email = @email;
    description: |
      Use this tool to get information for a specific user.
      Takes an id number or a name and returns info on the user.

      Example:
      {{
          "id": 123,
          "name": "Alice",
      }}
    parameters:
      - name: id
        type: integer
        description: User ID
      - name: email
        type: string
        description: Email address of the user

Reference

fieldtyperequireddescription
kindstringtrueMust be “bigquery-sql”.
sourcestringtrueName of the source the GoogleSQL should execute on.
descriptionstringtrueDescription of the tool that is passed to the LLM.
statementstringtrueThe GoogleSQL statement to execute.
parametersparametersfalseList of parameters that will be inserted into the SQL statement.