Skip to main content

capacity_commitments

Creates, updates, deletes, gets or lists a capacity_commitments resource.

Overview

Namecapacity_commitments
TypeResource
Idgoogle.bigqueryreservation.capacity_commitments

Fields

NameDatatypeDescription
namestringOutput only. The resource name of the capacity commitment, e.g., projects/myproject/locations/US/capacityCommitments/123 The commitment_id must only contain lower case alphanumeric characters or dashes. It must start with a letter and must not end with a dash. Its maximum length is 64 characters.
commitmentEndTimestringOutput only. The end of the current commitment period. It is applicable only for ACTIVE capacity commitments.
commitmentStartTimestringOutput only. The start of the current commitment period. It is applicable only for ACTIVE capacity commitments.
editionstringEdition of the capacity commitment.
failureStatusobjectThe Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC. Each Status message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the API Design Guide.
isFlatRatebooleanOutput only. If true, the commitment is a flat-rate commitment, otherwise, it's an edition commitment.
multiRegionAuxiliarybooleanApplicable only for commitments located within one of the BigQuery multi-regions (US or EU). If set to true, this commitment is placed in the organization's secondary region which is designated for disaster recovery purposes. If false, this commitment is placed in the organization's default region. NOTE: this is a preview feature. Project must be allow-listed in order to set this field.
planstringCapacity commitment commitment plan.
renewalPlanstringThe plan this capacity commitment is converted to after commitment_end_time passes. Once the plan is changed, committed period is extended according to commitment plan. Only applicable for ANNUAL and TRIAL commitments.
slotCountstringNumber of slots in this commitment.
statestringOutput only. State of the commitment.

Methods

NameAccessible byRequired ParamsDescription
getSELECTcapacityCommitmentsId, locationsId, projectsIdReturns information about the capacity commitment.
listSELECTlocationsId, projectsIdLists all the capacity commitments for the admin project.
createINSERTlocationsId, projectsIdCreates a new capacity commitment resource.
deleteDELETEcapacityCommitmentsId, locationsId, projectsIdDeletes a capacity commitment. Attempting to delete capacity commitment before its commitment_end_time will fail with the error code google.rpc.Code.FAILED_PRECONDITION.
patchUPDATEcapacityCommitmentsId, locationsId, projectsIdUpdates an existing capacity commitment. Only plan and renewal_plan fields can be updated. Plan can only be changed to a plan of a longer commitment period. Attempting to change to a plan with shorter commitment period will fail with the error code google.rpc.Code.FAILED_PRECONDITION.
mergeEXEClocationsId, projectsIdMerges capacity commitments of the same plan into a single commitment. The resulting capacity commitment has the greater commitment_end_time out of the to-be-merged capacity commitments. Attempting to merge capacity commitments of different plan will fail with the error code google.rpc.Code.FAILED_PRECONDITION.
splitEXECcapacityCommitmentsId, locationsId, projectsIdSplits capacity commitment to two commitments of the same plan and commitment_end_time. A common use case is to enable downgrading commitments. For example, in order to downgrade from 10000 slots to 8000, you might split a 10000 capacity commitment into commitments of 2000 and 8000. Then, you delete the first one after the commitment end time passes.

SELECT examples

Lists all the capacity commitments for the admin project.

SELECT
name,
commitmentEndTime,
commitmentStartTime,
edition,
failureStatus,
isFlatRate,
multiRegionAuxiliary,
plan,
renewalPlan,
slotCount,
state
FROM google.bigqueryreservation.capacity_commitments
WHERE locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';

INSERT example

Use the following StackQL query and manifest file to create a new capacity_commitments resource.

/*+ create */
INSERT INTO google.bigqueryreservation.capacity_commitments (
locationsId,
projectsId,
slotCount,
plan,
renewalPlan,
multiRegionAuxiliary,
edition
)
SELECT
'{{ locationsId }}',
'{{ projectsId }}',
'{{ slotCount }}',
'{{ plan }}',
'{{ renewalPlan }}',
{{ multiRegionAuxiliary }},
'{{ edition }}'
;

UPDATE example

Updates a capacity_commitments resource.

/*+ update */
UPDATE google.bigqueryreservation.capacity_commitments
SET
slotCount = '{{ slotCount }}',
plan = '{{ plan }}',
renewalPlan = '{{ renewalPlan }}',
multiRegionAuxiliary = true|false,
edition = '{{ edition }}'
WHERE
capacityCommitmentsId = '{{ capacityCommitmentsId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';

DELETE example

Deletes the specified capacity_commitments resource.

/*+ delete */
DELETE FROM google.bigqueryreservation.capacity_commitments
WHERE capacityCommitmentsId = '{{ capacityCommitmentsId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';