Skip to content

GCP.BigQueryReservation reference

Source: packages/gcp/src/BigQueryReservation/Assignment.ts

A BigQuery reservation assignment — grants a project, folder, or organization slots from a Reservation for one job type.

Assignments have no labels. Alchemy stamps ownership into assignmentId so list / pnpm nuke:gcp can find them. Changing reservation, assignee, jobType, location, or assignmentId replaces the assignment. principal and schedulingPolicy update in place.

Assign QUERY jobs in this project

const slots = yield* GCP.BigQueryReservation.Reservation("Slots", {});
const assignment = yield* GCP.BigQueryReservation.Assignment("Query", {
reservation: slots.name,
jobType: "QUERY",
});

None assignment (on-demand)

const none = yield* GCP.BigQueryReservation.Assignment("OnDemand", {
reservation: "none",
location: "US",
jobType: "QUERY",
});

Assignment: Looking up an existing assignment

Section titled “Assignment: Looking up an existing assignment”

Assignment.lookup references an assignment Alchemy doesn’t manage (created in the console or by another stack). It is read during plan/deploy, never created, updated or deleted, and binds like a declared assignment.

const assignment = GCP.BigQueryReservation.Assignment.lookup({
assignmentId: "my-assignment",
reservation: "my-reservation",
});

Source: packages/gcp/src/BigQueryReservation/CapacityCommitment.ts

A BigQuery capacity commitment — purchased slot capacity with a committed period of usage.

Commitments have no labels, so Alchemy stamps ownership into the commitment id (alch---…) so list / pnpm nuke:gcp can find them. Changing capacityCommitmentId, location, slotCount, edition, or multiRegionAuxiliary replaces the commitment. plan and renewalPlan update in place (plan can only lengthen).

FLEX commitments can be deleted about 60 seconds after they become ACTIVE. Annual and three-year commitments cannot be deleted until they expire.

CapacityCommitment: Creating a Capacity Commitment

Section titled “CapacityCommitment: Creating a Capacity Commitment”

Flex Enterprise slots

const commit = yield* GCP.BigQueryReservation.CapacityCommitment("Flex", {
location: "US",
slotCount: "50",
plan: "FLEX_FLAT_RATE",
edition: "ENTERPRISE",
});

Annual commitment with flex renewal

const commit = yield* GCP.BigQueryReservation.CapacityCommitment("Year", {
location: "US",
slotCount: "100",
plan: "ANNUAL",
renewalPlan: "FLEX",
edition: "ENTERPRISE",
});

CapacityCommitment: Looking up an existing capacity commitment

Section titled “CapacityCommitment: Looking up an existing capacity commitment”

CapacityCommitment.lookup references a capacity commitment Alchemy doesn’t manage (created in the console or by another stack). It is read during plan/deploy, never created, updated or deleted, and binds like a declared capacity commitment.

const capacityCommitment = GCP.BigQueryReservation.CapacityCommitment.lookup({
capacityCommitmentId: "my-capacity-commitment",
});

Source: packages/gcp/src/BigQueryReservation/Reservation.ts

A BigQuery slot reservation — a named pool of slots that assignments can consume.

Changing reservationId, location, edition, or multiRegionAuxiliary replaces the reservation. Baseline capacity, idle-slot behavior, labels, autoscale, and failover location are updated in place.

Generated name, zero-slot ENTERPRISE

const slots = yield* GCP.BigQueryReservation.Reservation("Slots", {});

Explicit id, labels, and idle-slot isolation

const slots = yield* GCP.BigQueryReservation.Reservation("Slots", {
reservationId: "analytics-prod",
location: "us-central1",
edition: "ENTERPRISE",
slotCapacity: "0",
ignoreIdleSlots: false,
labels: { env: "prod" },
});

STANDARD with autoscale

const slots = yield* GCP.BigQueryReservation.Reservation("Slots", {
location: "US",
edition: "STANDARD",
ignoreIdleSlots: true,
autoscale: { maxSlots: "50" },
});

Reservation: Looking up an existing reservation

Section titled “Reservation: Looking up an existing reservation”

Reservation.lookup references a reservation Alchemy doesn’t manage (created in the console or by another stack). It is read during plan/deploy, never created, updated or deleted, and binds like a declared reservation.

const reservation = GCP.BigQueryReservation.Reservation.lookup({
reservationId: "my-reservation",
});

Source: packages/gcp/src/BigQueryReservation/ReservationGroup.ts

A BigQuery reservation group — a named container for reservations.

Groups have no labels or description, so Alchemy stamps ownership into the group id (alch---…) so list / pnpm nuke:gcp can find them. There is no update API; reservationGroupId and location are identity and changing them replaces the group.

ReservationGroup: Creating a Reservation Group

Section titled “ReservationGroup: Creating a Reservation Group”

Generated id

const group = yield* GCP.BigQueryReservation.ReservationGroup("Team", {});

Explicit id and multi-region location

const group = yield* GCP.BigQueryReservation.ReservationGroup("Team", {
reservationGroupId: "analytics-prod",
location: "US",
});

ReservationGroup: Looking up an existing reservation group

Section titled “ReservationGroup: Looking up an existing reservation group”

ReservationGroup.lookup references a reservation group Alchemy doesn’t manage (created in the console or by another stack). It is read during plan/deploy, never created, updated or deleted, and binds like a declared reservation group.

const reservationGroup = GCP.BigQueryReservation.ReservationGroup.lookup({
reservationGroupId: "my-reservation-group",
});