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. This field controls if "Gemini in BigQuery" (https://cloud.google.com/gemini/docs/bigquery/overview) features should be enabled for this reservation assignment, which is not on by default. "Gemini in BigQuery" has a distinct compliance posture from BigQuery. If this field is set to true, the assignment job type is QUERY, and the parent reservation edition is ENTERPRISE_PLUS, then the assignment will give the grantee project/organization access to "Gemini in BigQuery" features. |
jobType | string | Optional. Which type of jobs will use the reservation. |
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. |
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,
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__jobType,
projectsId,
locationsId,
reservationsId,
assignmentId
)
SELECT
{{ enableGeminiInBigquery }},
'{{ schedulingPolicy }}',
'{{ assignee }}',
'{{ jobType }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ reservationsId }}',
'{{ assignmentId }}'
RETURNING
name,
assignee,
enableGeminiInBigquery,
jobType,
schedulingPolicy,
state
;
# Description fields are for documentation purposes
- name: assignments
props:
- name: projectsId
value: string
description: Required parameter for the assignments resource.
- name: locationsId
value: string
description: Required parameter for the assignments resource.
- name: reservationsId
value: string
description: Required parameter for the assignments resource.
- name: enableGeminiInBigquery
value: boolean
description: >
Optional. This field controls if "Gemini in BigQuery" (https://cloud.google.com/gemini/docs/bigquery/overview) features should be enabled for this reservation assignment, which is not on by default. "Gemini in BigQuery" has a distinct compliance posture from BigQuery. If this field is set to true, the assignment job type is QUERY, and the parent reservation edition is ENTERPRISE_PLUS, then the assignment will give the grantee project/organization access to "Gemini in BigQuery" features.
- name: schedulingPolicy
value: object
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.
- name: assignee
value: string
description: >
Optional. The resource which will use the reservation. E.g. `projects/myproject`, `folders/123`, or `organizations/456`.
- name: jobType
value: string
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: string
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__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,
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=
'{
"assignmentId": "{{ assignmentId }}",
"destinationId": "{{ destinationId }}"
}'
;