# Google BigQuery on boxd

> Google BigQuery is a fully managed data warehouse for large-scale data analytics, offering fast SQL queries and machine learning capabilities on massive datasets.

- Page: https://boxd.sh/integrations/googlebigquery/
- CLI: `run googlebigquery` (63 commands, 26 marked common)
- SDK: `import { googlebigquery } from "@boxd/run"`; every parameter and response type is at `@boxd/run/googlebigquery`
- Triggers: none
- Connect: `run auth googlebigquery` (Sign in with Google BigQuery), or https://app.boxd.sh/integrations/detail/googlebigquery
- All integrations: https://boxd.sh/integrations/ (Markdown: https://boxd.sh/integrations/index.md)

## From the shell

```sh
run auth googlebigquery      # once: prints a link to connect your account
run googlebigquery           # list its commands
run googlebigquery list-projects
```

Parameters are flags (`--flag value`); object and array parameters take a JSON string. Output is YAML, or JSON with `--json`. Calls use your own connection; `--scope <name>` uses a connection shared with your team.

## From a script

```ts
import { every, googlebigquery } from "@boxd/run";

every("1 hour", async () => {
  const result = await googlebigquery.listProjects({});
  console.log(result);
});
```

Run it with `run googlebigquery.run.ts`. Google BigQuery has no triggers; `every()` polls on a schedule, keeps the script running as a job, and wakes the machine when it is due.

## Commands

Required flags are listed; `run googlebigquery <command> --help` lists the optional ones. "common" marks what `run googlebigquery` shows without `--all`.

| Command | SDK method | Required flags | Optional | Description |
|---|---|---|---|---|
| `cancel-job` | `googlebigquery.cancelJob()` | `--job-id` `--project-id` | 1 | Cancel a running BigQuery job |
| `create-capacity-commitment` | `googlebigquery.createCapacityCommitment()` | `--parent` `--plan` `--slotCount` | 5 | Create a new capacity commitment resource in BigQuery Reservation |
| `create-connection` | `googlebigquery.createConnection()` | `--parent` | 11 | Create a new BigQuery connection to external data sources using the BigQuery Connection API |
| `create-data-exchange` | `googlebigquery.createDataExchange()` | `--dataExchangeId` `--displayName` `--parent` | 5 | Create a new Analytics Hub data exchange for sharing BigQuery datasets |
| `create-dataexchanges-listings` ·common | `googlebigquery.createDataexchangesListings()` | `--bigqueryDataset` `--displayName` `--listingId` `--parent` | 7 | Create a new listing in a BigQuery Analytics Hub data exchange |
| `create-dataset` ·common | `googlebigquery.createDataset()` | `--dataset-id` `--location` `--project-id` | 6 | Create a new BigQuery dataset with explicit location, labels, and description using the BigQuery Datasets API |
| `create-listing` | `googlebigquery.createListing()` | `--bigqueryDataset` `--displayName` `--parent` | 21 | Create a new listing in a data exchange using Analytics Hub API |
| `create-locations-datapolicies` | `googlebigquery.createLocationsDatapolicies()` | `--dataPolicy` `--dataPolicyId` `--parent` | 0 | Create a new data policy under a project with specified location using the v2beta1 BigQuery Data Policy API |
| `create-query-template` | `googlebigquery.createQueryTemplate()` | `--displayName` `--parent` `--queryTemplateId` `--routine` | 1 | Create a new query template in a BigQuery Analytics Hub Data Clean Room (DCR) data exchange |
| `create-reservation` | `googlebigquery.createReservation()` | `--parent` `--slotCapacity` | 6 | Create a new BigQuery reservation resource to guarantee compute capacity (slots) for query and pipeline jobs |
| `create-reservation-assignment` | `googlebigquery.createReservationAssignment()` | `--assignee` `--jobType` `--parent` | 1 | Create a BigQuery reservation assignment that allows a project, folder, or organization to submit jobs using slots from a specified reservation |
| `create-routine` ·common | `googlebigquery.createRoutine()` | `--dataset-id` `--definitionBody` `--project-id` `--routineReference` `--routineType` | 12 | Create a new user-defined routine (function or procedure) in a BigQuery dataset |
| `create-table` ·common | `googlebigquery.createTable()` | `--dataset-id` `--project-id` `--tableReference` | 14 | Create a new, empty table in a BigQuery dataset |
| `delete-dataset` ·common | `googlebigquery.deleteDataset()` | `--dataset-id` `--project-id` | 1 | Delete a BigQuery dataset specified by datasetId via the datasets.delete API |
| `delete-job-metadata` | `googlebigquery.deleteJobMetadata()` | `--job-id` `--project-id` | 1 | Delete the metadata of a BigQuery job |
| `delete-model` ·common | `googlebigquery.deleteModel()` | `--dataset-id` `--model-id` `--project-id` | 0 | Delete a BigQuery ML model from a dataset |
| `delete-routine` | `googlebigquery.deleteRoutine()` | `--dataset-id` `--project-id` `--routine-id` | 0 | Delete a BigQuery routine by its ID |
| `delete-table` ·common | `googlebigquery.deleteTable()` | `--dataset-id` `--project-id` `--table-id` | 0 | Delete a BigQuery table from a dataset |
| `get-bigquery-model` | `googlebigquery.getBigqueryModel()` | `--dataset-id` `--model-id` `--project-id` | 0 | Retrieve a specific BigQuery ML model resource by model ID |
| `get-connection-iam-policy` | `googlebigquery.getConnectionIamPolicy()` | `--resource` | 1 | Get the IAM access control policy for a BigQuery connection resource |
| `get-dataset` ·common | `googlebigquery.getDataset()` | `--dataset-id` `--project-id` | 2 | Retrieve BigQuery dataset metadata including location via the datasets.get API |
| `get-job` ·common | `googlebigquery.getJob()` | `--job-id` `--project-id` | 1 | Retrieve information about a specific BigQuery job |
| `get-query-results` ·common | `googlebigquery.getQueryResults()` | `--jobId` `--projectId` | 17 | Get the results of a BigQuery query job via RPC |
| `get-routine` | `googlebigquery.getRoutine()` | `--dataset-id` `--project-id` `--routine-id` | 1 | Retrieve a BigQuery routine (user-defined function or stored procedure) by its ID |
| `get-routine-iam-policy` | `googlebigquery.getRoutineIamPolicy()` | `--dataset-id` `--project-id` `--routine-id` | 1 | Retrieve the IAM access control policy for a BigQuery routine resource |
| `get-service-account` | `googlebigquery.getServiceAccount()` | `--project-id` | 11 | Get the service account for a project used for interactions with Google Cloud KMS |
| `get-table-iam-policy` | `googlebigquery.getTableIamPolicy()` | `--resource` | 1 | Retrieve the IAM access control policy for a BigQuery table resource |
| `get-table-schema` ·common | `googlebigquery.getTableSchema()` | `--dataset-id` `--project-id` `--table-id` | 1 | Fetch a BigQuery table's schema and metadata without querying row data |
| `insert-all` ·common | `googlebigquery.insertAll()` | `--dataset-id` `--project-id` `--rows` `--table-id` | 4 | Stream data into BigQuery one record at a time without running a load job |
| `insert-job` ·common | `googlebigquery.insertJob()` | `--configuration` `--project-id` | 1 | Start a new asynchronous BigQuery job (query, load, extract, or copy) |
| `insert-job-with-upload` ·common | `googlebigquery.insertJobWithUpload()` | `--configuration` `--file-to-upload` `--project-id` | 1 | Start a new BigQuery load job with file upload |
| `list-analytics-hub-listings` | `googlebigquery.listAnalyticsHubListings()` | `--parent` | 13 | List all listings in a given Analytics Hub data exchange |
| `list-big-query-connections` | `googlebigquery.listBigQueryConnections()` | `--parent` | 2 | List BigQuery connections in a given project and location |
| `list-capacity-commitments` | `googlebigquery.listCapacityCommitments()` | `--parent` | 2 | List all capacity commitments for the admin project |
| `list-dataexchanges-listings` | `googlebigquery.listDataexchangesListings()` | `--parent` | 13 | List all listings in a given Analytics Hub data exchange using the v1beta1 API |
| `list-datasets` ·common | `googlebigquery.listDatasets()` | `--project-id` | 4 | List datasets in a specific BigQuery project, including dataset locations |
| `list-jobs` ·common | `googlebigquery.listJobs()` | `--project-id` | 8 | List all jobs that you started in a BigQuery project |
| `list-locations` | `googlebigquery.listLocations()` | `--name` | 3 | List information about supported locations for BigQuery Data Transfer Service |
| `list-locations-connections` | `googlebigquery.listLocationsConnections()` | `--maxResults` `--parent` | 1 | List BigQuery connections in a given project and location using the v1beta1 API |
| `list-locations-datapolicies` | `googlebigquery.listLocationsDatapolicies()` | `--parent` | 3 | List all data policies in a specified parent project and location using the v2beta1 API |
| `list-models` ·common | `googlebigquery.listModels()` | `--dataset-id` `--project-id` | 2 | List all BigQuery ML models in a specified dataset |
| `list-organization-data-exchanges` | `googlebigquery.listOrganizationDataExchanges()` | `--organization` | 13 | List all data exchanges from projects in a given organization and location using Analytics Hub API |
| `list-projects` ·common | `googlebigquery.listProjects()` | — | 2 | List BigQuery projects to which the user has been granted any project role |
| `list-query-templates` | `googlebigquery.listQueryTemplates()` | `--parent` | 2 | List all query templates in a given Analytics Hub data exchange |
| `list-reservation-assignments` | `googlebigquery.listReservationAssignments()` | `--parent` | 2 | List BigQuery reservation assignments |
| `list-reservation-groups` | `googlebigquery.listReservationGroups()` | `--parent` | 2 | List all BigQuery reservation groups for a project in a specified location |
| `list-reservations` | `googlebigquery.listReservations()` | `--parent` | 13 | List all BigQuery reservations for a project in a specified location |
| `list-routines` | `googlebigquery.listRoutines()` | `--dataset-id` `--project-id` | 4 | List all routines (user-defined functions and stored procedures) in a BigQuery dataset |
| `list-row-access-policies` | `googlebigquery.listRowAccessPolicies()` | `--dataset-id` `--project-id` `--table-id` | 2 | List all row access policies on a specified BigQuery table |
| `list-table-data` ·common | `googlebigquery.listTableData()` | `--dataset-id` `--project-id` `--table-id` | 5 | List the content of a BigQuery table in rows via the REST API |
| `list-tables` ·common | `googlebigquery.listTables()` | `--dataset-id` `--project-id` | 2 | List tables in a BigQuery dataset via the REST API |
| `patch-dataset` ·common | `googlebigquery.patchDataset()` | `--dataset-id` `--project-id` | 16 | Update an existing BigQuery dataset using RFC5789 PATCH semantics |
| `patch-model` ·common | `googlebigquery.patchModel()` | `--dataset-id` `--model-id` `--project-id` | 5 | Update specific fields in an existing BigQuery ML model using PATCH semantics |
| `patch-table` ·common | `googlebigquery.patchTable()` | `--dataset-id` `--project-id` `--table-id` | 6 | Update specific fields in an existing BigQuery table using RFC5789 PATCH semantics |
| `query` | `googlebigquery.query()` | `--project-id` `--query` | 4 | Query Tool runs a SQL query in BigQuery using the REST API |
| `search-all-assignments` | `googlebigquery.searchAllAssignments()` | `--parent` | 14 | Search all BigQuery reservation assignments for a specified resource in a particular region |
| `set-routine-iam-policy` | `googlebigquery.setRoutineIamPolicy()` | `--dataset-id` `--policy` `--project-id` `--routine-id` | 1 | Set the IAM access control policy for a BigQuery routine resource |
| `test-routine-iam-permissions` | `googlebigquery.testRoutineIamPermissions()` | `--dataset-id` `--permissions` `--project-id` `--routine-id` | 0 | Test which IAM permissions the caller has on a BigQuery routine |
| `undelete-dataset` ·common | `googlebigquery.undeleteDataset()` | `--dataset-id` `--project-id` | 1 | Undelete a BigQuery dataset within the time travel window |
| `update-connection` | `googlebigquery.updateConnection()` | `--name` `--updateMask` | 10 | Update a specified BigQuery connection using the BigQuery Connection API |
| `update-dataset` ·common | `googlebigquery.updateDataset()` | `--datasetReference` `--dataset-id` `--location` `--project-id` | 14 | Update information in an existing BigQuery dataset using the PUT method |
| `update-routine` | `googlebigquery.updateRoutine()` | `--dataset-id` `--definitionBody` `--project-id` `--routineReference` `--routineType` `--routine-id` | 12 | Update an existing BigQuery routine (function or stored procedure) |
| `update-table` ·common | `googlebigquery.updateTable()` | `--dataset-id` `--project-id` `--tableReference` `--table-id` | 13 | Update an existing BigQuery table |

## Docs

- [run CLI](https://docs.boxd.sh/cli/run): Call connected integrations from the shell, connect new ones, and run automations.
- [Quickstart](https://docs.boxd.sh/guides/integrations/quickstart): Connect an integration, call it from the shell, and turn a script into an automation.
- [Connections](https://docs.boxd.sh/guides/integrations/connections): Connect an account once, for yourself or for your whole organization.
- [Scripts](https://docs.boxd.sh/guides/automations/scripts): Typed integrations, triggers, schedules and state in a .run.ts file.
- [Jobs](https://docs.boxd.sh/guides/automations/jobs): How a script becomes a background job: states, retries, sleep and wake.
- [Beyond the catalog](https://docs.boxd.sh/guides/automations/beyond-the-catalog): Reach your own APIs, databases and cloud accounts from a script.
