---
title: "PATCH /projects/{+projectId}/datasets/{+datasetId}"
method: PATCH
path: "/projects/{+projectId}/datasets/{+datasetId}"
tags: ["datasets"]
---

# PATCH /projects/{+projectId}/datasets/{+datasetId}

`PATCH /projects/{+projectId}/datasets/{+datasetId}`

Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource. This method supports RFC5789 patch semantics. # IAM Permissions Requires the following IAM permission(s) to use this method: - `bigquery.datasets.update` on the dataset. - `bigquery.datasets.get` on the dataset.

## Path parameters

- `projectId` string, required
- `datasetId` string, required

## Query parameters

- `accessPolicyVersion` integer
- `updateMode` 'UPDATE_MODE_UNSPECIFIED' | 'UPDATE_METADATA' | 'UPDATE_ACL' | 'UPDATE_FULL'

## Request body

- Dataset — Represents a BigQuery dataset.
  - `externalCatalogDatasetOptions` ExternalCatalogDatasetOptions — Options defining open source compatible datasets living in the BigQuery catalog. Contains metadata of open source database, schema, or namespace represented by the current dataset.
    - `defaultStorageLocationUri` string — Optional. The storage location URI for all tables in the dataset. Equivalent to hive metastore's database locationUri. Maximum length of 1024 characters.
    - `parameters` object — Optional. A map of key value pairs defining the parameters and properties of the open source schema. Maximum size of 2MiB.
  - `linkedDatasetMetadata` LinkedDatasetMetadata — Metadata about the Linked Dataset.
    - `linkState` 'LINK_STATE_UNSPECIFIED' | 'LINKED' | 'UNLINKED' — Output only. Specifies whether Linked Dataset is currently in a linked state or not.
  - `restrictions` RestrictionConfig
    - `type` 'RESTRICTION_TYPE_UNSPECIFIED' | 'RESTRICTED_DATA_EGRESS' — Output only. Specifies the type of dataset/table restriction.
  - `defaultCollation` string — Optional. Defines the default collation specification of future tables created in the dataset. If a table is created in this dataset without table-level default collation, then the table inherits the dataset default collation, which is applied to the string fields that do not have explicit collation specified. A change to this field affects only tables created afterwards, and does not alter the existing tables. The following values are supported: * 'und:ci': undetermined locale, case insensitive. * '': empty string. Default to case-sensitive behavior.
  - `defaultTableExpirationMs` string, int64 — Optional. The default lifetime of all tables in the dataset, in milliseconds. The minimum lifetime value is 3600000 milliseconds (one hour). To clear an existing default expiration with a PATCH request, set to 0. Once this property is set, all newly-created tables in the dataset will have an expirationTime property set to the creation time plus the value in this property, and changing the value will only affect new tables, not existing ones. When the expirationTime for a given table is reached, that table will be deleted automatically. If a table's expirationTime is modified or removed before the table expires, or if you provide an explicit expirationTime when creating a table, that value takes precedence over the default expiration time indicated by this property.
  - `labels` object — The labels associated with this dataset. You can use these to organize and group your datasets. You can set this property when inserting or updating a dataset. See [Creating and Updating Dataset Labels](https://cloud.google.com/bigquery/docs/creating-managing-labels#creating_and_updating_dataset_labels) for more information.
  - `location` string — The geographic location where the dataset should reside. See https://cloud.google.com/bigquery/docs/locations for supported locations.
  - `datasetReference` DatasetReference — Identifier for a dataset.
    - `datasetId` string — Required. A unique ID for this dataset, without the project name. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
    - `projectId` string — Optional. The ID of the project containing this dataset.
  - `id` string — Output only. The fully-qualified unique name of the dataset in the format projectId:datasetId. The dataset name without the project name is given in the datasetId field. When creating a new dataset, leave this field blank, and instead specify the datasetId field.
  - `access` object[] — Optional. An array of objects that define dataset access for one or more entities. You can set this property when inserting or updating a dataset in order to control who is allowed to access the data. If unspecified at dataset creation time, BigQuery adds default dataset access for the following entities: access.specialGroup: projectReaders; access.role: READER; access.specialGroup: projectWriters; access.role: WRITER; access.specialGroup: projectOwners; access.role: OWNER; access.userByEmail: [dataset creator email]; access.role: OWNER; If you patch a dataset, then this field is overwritten by the patched dataset's access field. To add entities, you must supply the entire existing access array in addition to any new entities that you want to add.
    - `iamMember` string — [Pick one] Some other type of member that appears in the IAM Policy but isn't a user, group, domain, or special group.
    - `domain` string — [Pick one] A domain to grant access to. Any users signed in with the domain specified will be granted the specified access. Example: "example.com". Maps to IAM policy member "domain:DOMAIN".
    - `dataset` DatasetAccessEntry — Grants all resources of particular types in a particular dataset read access to the current dataset. Similar to how individually authorized views work, updates to any resource granted through its dataset (including creation of new resources) requires read permission to referenced resources, plus write permission to the authorizing dataset.
      - `dataset` DatasetReference — Identifier for a dataset.
        - `datasetId` string — Required. A unique ID for this dataset, without the project name. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
        - `projectId` string — Optional. The ID of the project containing this dataset.
      - `targetTypes` string[] — Which resources in the dataset this entry applies to. Currently, only views are supported, but additional target types may be added in the future.
    - `role` string — An IAM role ID that should be granted to the user, group, or domain specified in this access entry. The following legacy mappings will be applied: * `OWNER`: `roles/bigquery.dataOwner` * `WRITER`: `roles/bigquery.dataEditor` * `READER`: `roles/bigquery.dataViewer` This field will accept any of the above formats, but will return only the legacy format. For example, if you set this field to "roles/bigquery.dataOwner", it will be returned back as "OWNER".
    - `view` TableReference
      - `datasetId` string — Required. The ID of the dataset containing this table.
      - `projectId` string — Required. The ID of the project containing this table.
      - `tableId` string — Required. The ID of the table. The ID can contain Unicode characters in category L (letter), M (mark), N (number), Pc (connector, including underscore), Pd (dash), and Zs (space). For more information, see [General Category](https://wikipedia.org/wiki/Unicode_character_property#General_Category). The maximum length is 1,024 characters. Certain operations allow suffixing of the table ID with a partition decorator, such as `sample_table$20190123`.
    - `routine` RoutineReference — Id path of a routine.
      - `datasetId` string — Required. The ID of the dataset containing this routine.
      - `routineId` string — Required. The ID of the routine. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 256 characters.
      - `projectId` string — Required. The ID of the project containing this routine.
    - `specialGroup` string — [Pick one] A special group to grant access to. Possible values include: * projectOwners: Owners of the enclosing project. * projectReaders: Readers of the enclosing project. * projectWriters: Writers of the enclosing project. * allAuthenticatedUsers: All authenticated BigQuery users. Maps to similarly-named IAM members.
    - `userByEmail` string — [Pick one] An email address of a user to grant access to. For example: fred@example.com. Maps to IAM policy member "user:EMAIL" or "serviceAccount:EMAIL".
    - `groupByEmail` string — [Pick one] An email address of a Google Group to grant access to. Maps to IAM policy member "group:GROUP".
    - `condition` Expr — Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information.
      - `expression` string — Textual representation of an expression in Common Expression Language syntax.
      - `location` string — Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
      - `title` string — Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression.
      - `description` string — Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
  - `tags` object[] — Output only. Tags for the dataset. To provide tags as inputs, use the `resourceTags` field.
    - `tagKey` string — Required. The namespaced friendly name of the tag key, e.g. "12345/environment" where 12345 is org id.
    - `tagValue` string — Required. The friendly short name of the tag value, e.g. "production".
  - `satisfiesPzs` boolean — Output only. Reserved for future use.
  - `description` string — Optional. A user-friendly description of the dataset.
  - `storageBillingModel` 'STORAGE_BILLING_MODEL_UNSPECIFIED' | 'LOGICAL' | 'PHYSICAL' — Optional. Updates storage_billing_model for the dataset.
  - `etag` string — Output only. A hash of the resource.
  - `defaultEncryptionConfiguration` EncryptionConfiguration — Configuration for Cloud KMS encryption settings.
    - `kmsKeyName` string — Optional. Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table. The BigQuery Service Account associated with your project requires access to this encryption key.
  - `kind` string — Output only. The resource type.
  - `lastModifiedTime` string, int64 — Output only. The date when this dataset was last modified, in milliseconds since the epoch.
  - `creationTime` string, int64 — Output only. The time when this dataset was created, in milliseconds since the epoch.
  - `type` string — Output only. Same as `type` in `ListFormatDataset`. The type of the dataset, one of: * DEFAULT - only accessible by owner and authorized accounts, * PUBLIC - accessible by everyone, * LINKED - linked dataset, * EXTERNAL - dataset with definition in external metadata catalog, * BIGLAKE_ICEBERG - a Biglake dataset accessible through the Iceberg API, * BIGLAKE_HIVE - a Biglake dataset accessible through the Hive API.
  - `defaultPartitionExpirationMs` string, int64 — This default partition expiration, expressed in milliseconds. When new time-partitioned tables are created in a dataset where this property is set, the table will inherit this value, propagated as the `TimePartitioning.expirationMs` property on the new table. If you set `TimePartitioning.expirationMs` explicitly when creating a table, the `defaultPartitionExpirationMs` of the containing dataset is ignored. When creating a partitioned table, if `defaultPartitionExpirationMs` is set, the `defaultTableExpirationMs` value is ignored and the table will not be inherit a table expiration deadline.
  - `satisfiesPzi` boolean — Output only. Reserved for future use.
  - `selfLink` string — Output only. A URL that can be used to access the resource again. You can use this URL in Get or Update requests to the resource.
  - `catalogSource` string — Output only. The origin of the dataset, one of: * (Unset) - Native BigQuery Dataset * BIGLAKE - Dataset is backed by a namespace stored natively in Biglake
  - `defaultRoundingMode` 'ROUNDING_MODE_UNSPECIFIED' | 'ROUND_HALF_AWAY_FROM_ZERO' | 'ROUND_HALF_EVEN' — Optional. Defines the default rounding mode specification of new tables created within this dataset. During table creation, if this field is specified, the table within this dataset will inherit the default rounding mode of the dataset. Setting the default rounding mode on a table overrides this option. Existing tables in the dataset are unaffected. If columns are defined during that table creation, they will immediately inherit the table's default rounding mode, unless otherwise specified.
  - `isCaseInsensitive` boolean — Optional. TRUE if the dataset and its table names are case-insensitive, otherwise FALSE. By default, this is FALSE, which means the dataset and its table names are case-sensitive. This field does not affect routine references.
  - `friendlyName` string — Optional. A descriptive name for the dataset.
  - `linkedDatasetSource` LinkedDatasetSource — A dataset source type which refers to another BigQuery dataset.
    - `sourceDataset` DatasetReference — Identifier for a dataset.
      - `datasetId` string — Required. A unique ID for this dataset, without the project name. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
      - `projectId` string — Optional. The ID of the project containing this dataset.
  - `resourceTags` object — Optional. The [tags](https://cloud.google.com/bigquery/docs/tags) attached to this dataset. Tag keys are globally unique. Tag key is expected to be in the namespaced format, for example "123456789012/environment" where 123456789012 is the ID of the parent organization or project resource for this tag key. Tag value is expected to be the short name, for example "Production". See [Tag definitions](https://cloud.google.com/iam/docs/tags-access-control#definitions) for more details.
  - `maxTimeTravelHours` string, int64 — Optional. Defines the time travel window in hours. The value can be from 48 to 168 hours (2 to 7 days). The default value is 168 hours if this is not set.
  - `externalDatasetReference` ExternalDatasetReference — Configures the access a dataset defined in an external metadata storage.
    - `externalSource` string — Required. External source that backs this dataset.
    - `connection` string — Required. The connection id that is used to access the external_source. Format: projects/{project_id}/locations/{location_id}/connections/{connection_id}

## Response `200`

Successful response

---

[API](https://skmtc.dev/google/apis/bigquery.md) · [All operations](https://skmtc.dev/google/apis/bigquery/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/google/bigquery/revisions/98f33ea9c8c9/schema)
