assignments
Creates, updates, deletes, gets or lists an assignments resource.
Overview
| Name | assignments |
| Type | Resource |
| Id | google.bigqueryreservation.assignments |
Fields
The following fields are returned by SELECT queries:
- list
| Name | Datatype | Description |
|---|---|---|
name | string | Output only. Name of the resource. E.g.: projects/myproject/locations/US/reservations/team1-prod/assignments/123. The assignment_id must only contain lower case alphanumeric characters or dashes and the max length is 64 characters. |
assignee | string | Optional. The resource which will use the reservation. E.g. projects/myproject, folders/123, or organizations/456. |
enableGeminiInBigquery | boolean | Optional. Deprecated: "Gemini in BigQuery" is now available by default for all BigQuery editions and should not be explicitly set. Controls if "Gemini in BigQuery" (https://cloud.google.com/gemini/docs/bigquery/overview) features should be enabled for this reservation assignment. |
jobType | string | Optional. Which type of jobs will use the reservation. (JOB_TYPE_UNSPECIFIED, PIPELINE, QUERY, ML_EXTERNAL, BACKGROUND, CONTINUOUS, BACKGROUND_CHANGE_DATA_CAPTURE, BACKGROUND_COLUMN_METADATA_INDEX, BACKGROUND_SEARCH_INDEX_REFRESH) |
principal | string | Optional. Represents the principal for this assignment. If not empty, jobs run by this principal will utilize the associated reservation. Otherwise, jobs will fall back to using the reservation assigned to the project, folder, or organization (in that order). If no reservation is assigned at any of these levels, on-demand capacity will be used. The supported formats are: * principal://goog/subject/USER_EMAIL_ADDRESS for users, * principal://iam.googleapis.com/projects/-/serviceAccounts/SA_EMAIL_ADDRESS for service accounts, * principal://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID/subject/SUBJECT_ID for workload identity pool identities. * The special value unknown_or_deleted_user represents principals which cannot be read from the user info service, for example deleted users. |
schedulingPolicy | object | Optional. The scheduling policy to use for jobs and queries of this assignee when running under the associated reservation. The scheduling policy controls how the reservation's resources are distributed. This overrides the default scheduling policy specified on the reservation. This feature is not yet generally available. (id: SchedulingPolicy) |
state | string | Output only. State of the assignment. (STATE_UNSPECIFIED, PENDING, ACTIVE) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | projectsId, locationsId, reservationsId | pageSize, pageToken | Lists assignments. Only explicitly created assignments will be returned. Example: * Organization organizationA contains two projects, project1 and project2. * Reservation res1 exists and was created previously. * CreateAssignment was used previously to define the following associations between entities and reservations: and In this example, ListAssignments will just return the above two assignments for reservation res1, and no expansion/merge will happen. The wildcard "-" can be used for reservations in the request. In that case all assignments belongs to the specified project and location will be listed. Note "-" cannot be used for projects nor locations. |
create | insert | projectsId, locationsId, reservationsId | assignmentId | Creates an assignment object which allows the given project to submit jobs of a certain type using slots from the specified reservation. Currently a resource (project, folder, organization) can only have one assignment per each (job_type, location) combination, and that reservation will be used for all jobs of the matching type. Different assignments can be created on different levels of the projects, folders or organization hierarchy. During query execution, the assignment is looked up at the project, folder and organization levels in that order. The first assignment found is applied to the query. When creating assignments, it does not matter if other assignments exist at higher levels. Example: * The organization organizationA contains two projects, project1 and project2. * Assignments for all three entities (organizationA, project1, and project2) could all be created and mapped to the same or different reservations. "None" assignments represent an absence of the assignment. Projects assigned to None use on-demand pricing. To create a "None" assignment, use "none" as a reservation_id in the parent. Example parent: projects/myproject/locations/US/reservations/none. Returns google.rpc.Code.PERMISSION_DENIED if user does not have 'bigquery.admin' permissions on the project using the reservation and the project that owns this reservation. Returns google.rpc.Code.INVALID_ARGUMENT when location of the assignment does not match location of the reservation. |
patch | update | projectsId, locationsId, reservationsId, assignmentsId | updateMask | Updates an existing assignment. Only the priority field can be updated. |
delete | delete | projectsId, locationsId, reservationsId, assignmentsId | Deletes a assignment. No expansion will happen. Example: * Organization organizationA contains two projects, project1 and project2. * Reservation res1 exists and was created previously. * CreateAssignment was used previously to define the following associations between entities and reservations: and In this example, deletion of the assignment won't affect the other assignment. After said deletion, queries from project1 will still use res1 while queries from project2 will switch to use on-demand mode. | |
move | exec | projectsId, locationsId, reservationsId, assignmentsId | Moves an assignment under a new reservation. This differs from removing an existing assignment and recreating a new one by providing a transactional change that ensures an assignee always has an associated reservation. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
assignmentsId | string | |
locationsId | string | |
projectsId | string | |
reservationsId | string | |
assignmentId | string | |
pageSize | integer (int32) | |
pageToken | string | |
updateMask | string (google-fieldmask) |
SELECT examples
- list
Lists assignments. Only explicitly created assignments will be returned. Example: * Organization organizationA contains two projects, project1 and project2. * Reservation res1 exists and was created previously. * CreateAssignment was used previously to define the following associations between entities and reservations: and In this example, ListAssignments will just return the above two assignments for reservation res1, and no expansion/merge will happen. The wildcard "-" can be used for reservations in the request. In that case all assignments belongs to the specified project and location will be listed. Note "-" cannot be used for projects nor locations.
SELECT
name,
assignee,
enableGeminiInBigquery,
jobType,
principal,
schedulingPolicy,
state
FROM google.bigqueryreservation.assignments
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND reservationsId = '{{ reservationsId }}' -- required
AND pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}'
;
INSERT examples
- create
- Manifest
Creates an assignment object which allows the given project to submit jobs of a certain type using slots from the specified reservation. Currently a resource (project, folder, organization) can only have one assignment per each (job_type, location) combination, and that reservation will be used for all jobs of the matching type. Different assignments can be created on different levels of the projects, folders or organization hierarchy. During query execution, the assignment is looked up at the project, folder and organization levels in that order. The first assignment found is applied to the query. When creating assignments, it does not matter if other assignments exist at higher levels. Example: * The organization organizationA contains two projects, project1 and project2. * Assignments for all three entities (organizationA, project1, and project2) could all be created and mapped to the same or different reservations. "None" assignments represent an absence of the assignment. Projects assigned to None use on-demand pricing. To create a "None" assignment, use "none" as a reservation_id in the parent. Example parent: projects/myproject/locations/US/reservations/none. Returns google.rpc.Code.PERMISSION_DENIED if user does not have 'bigquery.admin' permissions on the project using the reservation and the project that owns this reservation. Returns google.rpc.Code.INVALID_ARGUMENT when location of the assignment does not match location of the reservation.
INSERT INTO google.bigqueryreservation.assignments (
data__enableGeminiInBigquery,
data__schedulingPolicy,
data__assignee,
data__principal,
data__jobType,
projectsId,
locationsId,
reservationsId,
assignmentId
)
SELECT
{{ enableGeminiInBigquery }},
'{{ schedulingPolicy }}',
'{{ assignee }}',
'{{ principal }}',
'{{ jobType }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ reservationsId }}',
'{{ assignmentId }}'
RETURNING
name,
assignee,
enableGeminiInBigquery,
jobType,
principal,
schedulingPolicy,
state
;
# Description fields are for documentation purposes
- name: assignments
props:
- name: projectsId
value: "{{ projectsId }}"
description: Required parameter for the assignments resource.
- name: locationsId
value: "{{ locationsId }}"
description: Required parameter for the assignments resource.
- name: reservationsId
value: "{{ reservationsId }}"
description: Required parameter for the assignments resource.
- name: enableGeminiInBigquery
value: {{ enableGeminiInBigquery }}
description: |
Optional. Deprecated: "Gemini in BigQuery" is now available by default for all BigQuery editions and should not be explicitly set. Controls if "Gemini in BigQuery" (https://cloud.google.com/gemini/docs/bigquery/overview) features should be enabled for this reservation assignment.
- name: schedulingPolicy
description: |
Optional. The scheduling policy to use for jobs and queries of this assignee when running under the associated reservation. The scheduling policy controls how the reservation's resources are distributed. This overrides the default scheduling policy specified on the reservation. This feature is not yet generally available.
value:
concurrency: "{{ concurrency }}"
maxSlots: "{{ maxSlots }}"
- name: assignee
value: "{{ assignee }}"
description: |
Optional. The resource which will use the reservation. E.g. `projects/myproject`, `folders/123`, or `organizations/456`.
- name: principal
value: "{{ principal }}"
description: |
Optional. Represents the principal for this assignment. If not empty, jobs run by this principal will utilize the associated reservation. Otherwise, jobs will fall back to using the reservation assigned to the project, folder, or organization (in that order). If no reservation is assigned at any of these levels, on-demand capacity will be used. The supported formats are: * `principal://goog/subject/USER_EMAIL_ADDRESS` for users, * `principal://iam.googleapis.com/projects/-/serviceAccounts/SA_EMAIL_ADDRESS` for service accounts, * `principal://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/POOL_ID/subject/SUBJECT_ID` for workload identity pool identities. * The special value `unknown_or_deleted_user` represents principals which cannot be read from the user info service, for example deleted users.
- name: jobType
value: "{{ jobType }}"
description: |
Optional. Which type of jobs will use the reservation.
valid_values: ['JOB_TYPE_UNSPECIFIED', 'PIPELINE', 'QUERY', 'ML_EXTERNAL', 'BACKGROUND', 'CONTINUOUS', 'BACKGROUND_CHANGE_DATA_CAPTURE', 'BACKGROUND_COLUMN_METADATA_INDEX', 'BACKGROUND_SEARCH_INDEX_REFRESH']
- name: assignmentId
value: "{{ assignmentId }}"
UPDATE examples
- patch
Updates an existing assignment. Only the priority field can be updated.
UPDATE google.bigqueryreservation.assignments
SET
data__enableGeminiInBigquery = {{ enableGeminiInBigquery }},
data__schedulingPolicy = '{{ schedulingPolicy }}',
data__assignee = '{{ assignee }}',
data__principal = '{{ principal }}',
data__jobType = '{{ jobType }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND reservationsId = '{{ reservationsId }}' --required
AND assignmentsId = '{{ assignmentsId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
assignee,
enableGeminiInBigquery,
jobType,
principal,
schedulingPolicy,
state;
DELETE examples
- delete
Deletes a assignment. No expansion will happen. Example: * Organization organizationA contains two projects, project1 and project2. * Reservation res1 exists and was created previously. * CreateAssignment was used previously to define the following associations between entities and reservations: and In this example, deletion of the assignment won't affect the other assignment. After said deletion, queries from project1 will still use res1 while queries from project2 will switch to use on-demand mode.
DELETE FROM google.bigqueryreservation.assignments
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND reservationsId = '{{ reservationsId }}' --required
AND assignmentsId = '{{ assignmentsId }}' --required
;
Lifecycle Methods
- move
Moves an assignment under a new reservation. This differs from removing an existing assignment and recreating a new one by providing a transactional change that ensures an assignee always has an associated reservation.
EXEC google.bigqueryreservation.assignments.move
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@reservationsId='{{ reservationsId }}' --required,
@assignmentsId='{{ assignmentsId }}' --required
@@json=
'{
"destinationId": "{{ destinationId }}",
"assignmentId": "{{ assignmentId }}"
}'
;