BigQuery (Service Account) connector
Service AccountAnalyticsDatabasesConnect to Google BigQuery using a GCP service account for server-to-server authentication without user login.
BigQuery (Service Account) connector
-
Install the SDK
Section titled “Install the SDK”Terminal window npm install @scalekit-sdk/nodeTerminal window pip install scalekit -
Set your credentials
Section titled “Set your credentials”Add your Scalekit credentials to your
.envfile. Find values in app.scalekit.com > Developers > API Credentials..env SCALEKIT_ENVIRONMENT_URL=<your-environment-url>SCALEKIT_CLIENT_ID=<your-client-id>SCALEKIT_CLIENT_SECRET=<your-client-secret> -
Set up the connector
Section titled “Set up the connector”Register your BigQuery (Service Account) credentials with Scalekit so it handles the token lifecycle. You do this once per environment.
Dashboard setup steps
In Scalekit dashboard, go to AgentKit > Connections > Create Connection. Find BigQuery (Service Account) and click Create.
That’s it — no OAuth credentials or redirect URIs needed. BigQuery Service Account uses server-to-server authentication handled entirely through your GCP service account credentials.
What you can do
Section titled “What you can do”Connect this agent connector to let your agent:
- Permissions test table iam, test row access policy iam, test routine iam — Check which of a given set of IAM permissions the caller has on a BigQuery table or view
- List row access policies, projects, tables — List the row access policies defined on a BigQuery table
- Get table iam policy, service account, row access policy iam policy — Retrieve the IAM access control policy currently set on a BigQuery table or view
- Query insert — Submit an asynchronous BigQuery query job
- Job cancel — Request cancellation of a running BigQuery job
- Run dry, query — Validate a SQL query and estimate its cost without executing it
Common workflows
Section titled “Common workflows”Execute a tool
const result = await actions.executeTool({ connector: 'bigqueryserviceaccount', identifier: 'user_123', toolName: 'bigqueryserviceaccount_run_query', toolInput: { query: 'SELECT 1 AS test', },});console.log(result);result = actions.execute_tool( connection_name='bigqueryserviceaccount', identifier='user_123', tool_name='bigqueryserviceaccount_run_query', tool_input={ "query": "SELECT 1 AS test", },)print("Query result:", result.data)Proxy API call
const result = await actions.request({ connectionName: 'bigqueryserviceaccount', identifier: 'user_123', path: '/datasets', method: 'GET',});console.log(result);result = actions.request( connection_name='bigqueryserviceaccount', identifier='user_123', path="/datasets", method="GET",)print(result)Tool list
Section titled “Tool list”Use the exact tool names from the Tool list below when you call execute_tool. If you’re not sure which name to use, list the tools available for the current user first.
bigqueryserviceaccount_cancel_job#Request cancellation of a running BigQuery job. Returns the final job resource. Cancellation is best-effort and the job may complete before it can be cancelled.2 params
Request cancellation of a running BigQuery job. Returns the final job resource. Cancellation is best-effort and the job may complete before it can be cancelled.
job_idstringrequiredThe ID of the job to cancellocationstringoptionalGeographic location where the job was created, e.g. US or EUbigqueryserviceaccount_dry_run_query#Validate a SQL query and estimate its cost without executing it. Returns statistics.totalBytesProcessed so you can check byte usage before running the real job.3 params
Validate a SQL query and estimate its cost without executing it. Returns statistics.totalBytesProcessed so you can check byte usage before running the real job.
querystringrequiredSQL query to validate and estimatelocationstringoptionalGeographic location where the job should run, e.g. US or EUuse_legacy_sqlbooleanoptionalUse BigQuery legacy SQL syntax instead of standard SQLbigqueryserviceaccount_get_dataset#Retrieve metadata for a specific BigQuery dataset, including location, description, labels, access controls, and creation/modification times.1 param
Retrieve metadata for a specific BigQuery dataset, including location, description, labels, access controls, and creation/modification times.
dataset_idstringrequiredThe ID of the dataset to retrievebigqueryserviceaccount_get_job#Retrieve the status and configuration of a BigQuery job by its job ID. Use this to poll for completion of an async query job submitted via Insert Query Job.2 params
Retrieve the status and configuration of a BigQuery job by its job ID. Use this to poll for completion of an async query job submitted via Insert Query Job.
job_idstringrequiredThe ID of the job to retrievelocationstringoptionalGeographic location where the job was created, e.g. US or EUbigqueryserviceaccount_get_model#Retrieve metadata for a specific BigQuery ML model, including model type, feature columns, label columns, and training run details.2 params
Retrieve metadata for a specific BigQuery ML model, including model type, feature columns, label columns, and training run details.
dataset_idstringrequiredThe ID of the dataset containing the modelmodel_idstringrequiredThe ID of the model to retrievebigqueryserviceaccount_get_query_results#Retrieve the results of a completed BigQuery query job. Supports pagination via page tokens. Use after polling Get Job until status is DONE.5 params
Retrieve the results of a completed BigQuery query job. Supports pagination via page tokens. Use after polling Get Job until status is DONE.
job_idstringrequiredThe ID of the completed query joblocationstringoptionalGeographic location where the job was created, e.g. US or EUmax_resultsintegeroptionalMaximum number of rows to return per pagepage_tokenstringoptionalPage token from a previous response to retrieve the next page of resultstimeout_msintegeroptionalMaximum milliseconds to wait if the query has not yet completedbigqueryserviceaccount_get_routine#Retrieve the definition and metadata of a specific BigQuery routine (stored procedure or UDF), including its arguments, return type, and body.2 params
Retrieve the definition and metadata of a specific BigQuery routine (stored procedure or UDF), including its arguments, return type, and body.
dataset_idstringrequiredThe ID of the dataset containing the routineroutine_idstringrequiredThe ID of the routine to retrievebigqueryserviceaccount_get_routine_iam_policy#Retrieve the IAM access control policy currently set on a BigQuery routine (stored procedure or UDF).3 params
Retrieve the IAM access control policy currently set on a BigQuery routine (stored procedure or UDF).
dataset_idstringrequiredThe ID of the dataset containing the routineroutine_idstringrequiredThe ID of the routine to fetch the IAM policy forrequested_policy_versionintegeroptionalThe policy format version to be returnedbigqueryserviceaccount_get_row_access_policy#Retrieve the definition of a single row access policy on a BigQuery table.3 params
Retrieve the definition of a single row access policy on a BigQuery table.
dataset_idstringrequiredThe ID of the dataset containing the tablerow_access_policy_idstringrequiredThe ID of the row access policy to retrievetable_idstringrequiredThe ID of the table containing the row access policybigqueryserviceaccount_get_row_access_policy_iam_policy#Retrieve the IAM policy for a row access policy on a BigQuery table.4 params
Retrieve the IAM policy for a row access policy on a BigQuery table.
dataset_idstringrequiredThe ID of the dataset containing the tablerow_access_policy_idstringrequiredThe ID of the row access policy to get the IAM policy fortable_idstringrequiredThe ID of the table containing the row access policyrequested_policy_versionintegeroptionalThe IAM policy format version to be returnedbigqueryserviceaccount_get_service_account#Retrieve the email address of the BigQuery-managed service account for the project this connection is scoped to. Used, for example, to grant that service account access to a Cloud Storage bucket for load or export jobs.0 params
Retrieve the email address of the BigQuery-managed service account for the project this connection is scoped to. Used, for example, to grant that service account access to a Cloud Storage bucket for load or export jobs.
bigqueryserviceaccount_get_table#Retrieve metadata and schema for a specific BigQuery table or view, including column names, types, descriptions, and table properties.2 params
Retrieve metadata and schema for a specific BigQuery table or view, including column names, types, descriptions, and table properties.
dataset_idstringrequiredThe ID of the dataset containing the tabletable_idstringrequiredThe ID of the table or view to retrievebigqueryserviceaccount_get_table_iam_policy#Retrieve the IAM access control policy currently set on a BigQuery table or view.3 params
Retrieve the IAM access control policy currently set on a BigQuery table or view.
dataset_idstringrequiredThe ID of the dataset containing the tabletable_idstringrequiredThe ID of the table to fetch the IAM policy forrequested_policy_versionintegeroptionalThe policy format version to be returnedbigqueryserviceaccount_insert_query_job#Submit an asynchronous BigQuery query job. Returns a job ID that can be used with Get Job or Get Query Results to poll for completion and retrieve results.9 params
Submit an asynchronous BigQuery query job. Returns a job ID that can be used with Get Job or Get Query Results to poll for completion and retrieve results.
querystringrequiredSQL query to executecreate_dispositionstringoptionalSpecifies whether the destination table is created if it does not existdestination_dataset_idstringoptionalDataset ID to write query results intodestination_table_idstringoptionalTable ID to write query results intolocationstringoptionalGeographic location where the job should run, e.g. US or EUmaximum_bytes_billedstringoptionalMaximum bytes that can be billed for this query; query fails if limit is exceededprioritystringoptionalJob priority: INTERACTIVE (default) or BATCHuse_legacy_sqlbooleanoptionalUse BigQuery legacy SQL syntax instead of standard SQLwrite_dispositionstringoptionalSpecifies the action when the destination table already existsbigqueryserviceaccount_list_datasets#List all BigQuery datasets in the project. Supports filtering by label and pagination.4 params
List all BigQuery datasets in the project. Supports filtering by label and pagination.
allbooleanoptionalIf true, includes hidden datasets in the resultsfilterstringoptionalLabel filter expression to restrict results, e.g. labels.env:prodmax_resultsintegeroptionalMaximum number of datasets to return per pagepage_tokenstringoptionalPage token from a previous response to retrieve the next pagebigqueryserviceaccount_list_jobs#List BigQuery jobs in the project. Supports filtering by state and projection, and pagination.5 params
List BigQuery jobs in the project. Supports filtering by state and projection, and pagination.
all_usersbooleanoptionalIf true, returns jobs for all users in the project; otherwise returns only the current user's jobsmax_resultsintegeroptionalMaximum number of jobs to return per pagepage_tokenstringoptionalPage token from a previous response to retrieve the next pageprojectionstringoptionalControls the fields returned: minimal (default) or fullstate_filterstringoptionalFilter jobs by state: done, pending, or runningbigqueryserviceaccount_list_models#List all BigQuery ML models in a dataset, including their model type, training status, and creation time.3 params
List all BigQuery ML models in a dataset, including their model type, training status, and creation time.
dataset_idstringrequiredThe ID of the dataset to list models frommax_resultsintegeroptionalMaximum number of models to return per pagepage_tokenstringoptionalPage token from a previous response to retrieve the next pagebigqueryserviceaccount_list_projects#List Google Cloud projects with BigQuery enabled that the connected service account can access. Useful for confirming which project the service account key is scoped to.2 params
List Google Cloud projects with BigQuery enabled that the connected service account can access. Useful for confirming which project the service account key is scoped to.
max_resultsintegeroptionalMaximum number of projects to return per pagepage_tokenstringoptionalPage token from a previous response to retrieve the next pagebigqueryserviceaccount_list_routines#List all stored procedures and user-defined functions (UDFs) in a BigQuery dataset.4 params
List all stored procedures and user-defined functions (UDFs) in a BigQuery dataset.
dataset_idstringrequiredThe ID of the dataset to list routines fromfilterstringoptionalFilter expression to restrict results, e.g. routineType:SCALAR_FUNCTIONmax_resultsintegeroptionalMaximum number of routines to return per pagepage_tokenstringoptionalPage token from a previous response to retrieve the next pagebigqueryserviceaccount_list_row_access_policies#List the row access policies defined on a BigQuery table. Supports pagination.3 params
List the row access policies defined on a BigQuery table. Supports pagination.
dataset_idstringrequiredThe ID of the dataset containing the tabletable_idstringrequiredThe ID of the table to list row access policies forpage_tokenstringoptionalPage token from a previous response to retrieve the next pagebigqueryserviceaccount_list_table_data#Read rows directly from a BigQuery table without writing a SQL query. Supports pagination, row offset, and field selection.6 params
Read rows directly from a BigQuery table without writing a SQL query. Supports pagination, row offset, and field selection.
dataset_idstringrequiredThe ID of the dataset containing the tabletable_idstringrequiredThe ID of the table to read rows frommax_resultsintegeroptionalMaximum number of rows to return per pagepage_tokenstringoptionalPage token from a previous response to retrieve the next pageselected_fieldsstringoptionalComma-separated list of fields to return; if omitted all fields are returnedstart_indexintegeroptionalZero-based row index to start reading frombigqueryserviceaccount_list_tables#List all tables and views in a BigQuery dataset. Supports pagination.3 params
List all tables and views in a BigQuery dataset. Supports pagination.
dataset_idstringrequiredThe ID of the dataset to list tables frommax_resultsintegeroptionalMaximum number of tables to return per pagepage_tokenstringoptionalPage token from a previous response to retrieve the next pagebigqueryserviceaccount_run_query#Execute a SQL query synchronously against BigQuery and return results immediately. Best for short-running queries. For long-running queries use Insert Query Job instead.7 params
Execute a SQL query synchronously against BigQuery and return results immediately. Best for short-running queries. For long-running queries use Insert Query Job instead.
querystringrequiredSQL query to executecreate_sessionbooleanoptionalIf true, creates a new session and returns a session ID in the responsedry_runbooleanoptionalIf true, validates the query and returns estimated bytes processed without executinglocationstringoptionalGeographic location of the dataset, e.g. US or EUmax_resultsintegeroptionalMaximum number of rows to return in the responsetimeout_msintegeroptionalMaximum milliseconds to wait for query completion before returninguse_legacy_sqlbooleanoptionalUse BigQuery legacy SQL syntax instead of standard SQLbigqueryserviceaccount_test_routine_iam_permissions#Check which of a given set of IAM permissions the caller has on a BigQuery routine.3 params
Check which of a given set of IAM permissions the caller has on a BigQuery routine.
dataset_idstringrequiredThe ID of the dataset containing the routinepermissionsarrayrequiredThe set of IAM permissions to checkroutine_idstringrequiredThe ID of the routine to test permissions againstbigqueryserviceaccount_test_row_access_policy_iam_permissions#Check which of a given set of IAM permissions the caller has on a row access policy.4 params
Check which of a given set of IAM permissions the caller has on a row access policy.
dataset_idstringrequiredThe ID of the dataset containing the tablepermissionsarrayrequiredThe set of IAM permissions to checkrow_access_policy_idstringrequiredThe ID of the row access policy to test permissions againsttable_idstringrequiredThe ID of the table containing the row access policybigqueryserviceaccount_test_table_iam_permissions#Check which of a given set of IAM permissions the caller has on a BigQuery table or view. This is a read-only check despite being a POST request — no state is modified.3 params
Check which of a given set of IAM permissions the caller has on a BigQuery table or view. This is a read-only check despite being a POST request — no state is modified.
dataset_idstringrequiredThe ID of the dataset containing the tablepermissionsarrayrequiredThe set of IAM permissions to checktable_idstringrequiredThe ID of the table to test permissions against