# BigQuery API . datasets

## Instance Methods

Deletes the dataset specified by datasetId value. Before you can delete a dataset, you must delete all its tables, either manually or by specifying deleteContents. Immediately after deletion, you can create another dataset with the same name.

Returns the dataset specified by datasetID.

Creates a new empty dataset.

Lists all the datasets in the specified project to which the caller has read access; however, a project owner can list (but not necessarily get) all datasets in his project.

Retrieves the next page of results.

Updates information in an existing dataset, specified by datasetId. Properties not included in the submitted resource will not be changed. If you include the access property without any values assigned, the request will fail as you must specify at least one owner for a dataset. This method supports patch semantics.

Updates information in an existing dataset, specified by datasetId. Properties not included in the submitted resource will not be changed. If you include the access property without any values assigned, the request will fail as you must specify at least one owner for a dataset.

### Method Details

`delete(projectId, datasetId, deleteContents=None)`

    Deletes the dataset specified by datasetId value. Before you can delete a dataset, you must delete all its tables, either manually or by specifying deleteContents. Immediately after deletion, you can create another dataset with the same name.

    Args:
      projectId: string, Project ID of the dataset being deleted (required)
      datasetId: string, Dataset ID of dataset being deleted (required)
      deleteContents: boolean, If True, delete all the tables in the dataset. If False and the dataset contains tables, the request will fail. Default is False

`get(projectId, datasetId)`

    Returns the dataset specified by datasetID.

    Args:
      projectId: string, Project ID of the requested dataset (required)
      datasetId: string, Dataset ID of the requested dataset (required)

    Returns:
      An object of the form:

        {
          "kind": "bigquery#dataset", # [Output-only] The resource type.
          "description": "A String", # [Optional] A user-friendly string description for the dataset. This might be shown in BigQuery UI for browsing the dataset.
          "datasetReference": { # [Required] Reference identifying dataset.
            "projectId": "A String", # [Optional] The ID of the container project.
            "datasetId": "A String", # [Required] A unique ID for this dataset, without the project name.
          },
          "creationTime": "A String", # [Output-only] The time when this dataset was created, in milliseconds since the epoch.
          "access": [ # [Optional] Describes users' rights on the dataset. You can assign the same role to multiple users, and assign multiple roles to the same user.
              # Default values assigned to a new dataset are as follows: OWNER - Project owners, dataset creator READER - Project readers WRITER - Project writers
              # See ACLs and Rights for a description of these rights. If you specify any of these roles when creating a dataset, the assigned roles will overwrite the defaults listed above.
              # To revoke rights to a dataset, call datasets.update() and omit the names of anyone whose rights you wish to revoke. However, every dataset must have at least one entity granted OWNER role.
              # Each access object can have only one of the following members: userByEmail, groupByEmail, domain, or allAuthenticatedUsers.
            {
              "specialGroup": "A String", # [Pick one] A special group to grant access to. The valid values are: projectOwners: Owners of the enclosing project. projectReaders: Readers of the enclosing project. projectWriters: Writers of the enclosing project. allAuthenticatedUsers: All authenticated BigQuery users.
              "domain": "A 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".
              "role": "A String", # [Required] Describes the rights granted to the user specified by the other member of the access object. The following string values are supported: READER - User can call any list() or get() method on any collection or resource. WRITER - User can call any method on any collection except for datasets, on which they can call list() and get(). OWNER - User can call any method. The dataset creator is granted this role by default.
              "groupByEmail": "A String", # [Pick one] A fully-qualified email address of a mailing list to grant access to. This must be either a Google Groups mailing list (ends in @googlegroups.com) or a group managed by an enterprise version of Google Groups.
              "userByEmail": "A String", # [Pick one] A fully qualified email address of a user to grant access to. For example: fred@example.com.
            },
          ],
          "etag": "A String", # [Output-only] A hash of this resource.
          "friendlyName": "A String", # [Optional] A descriptive name for this dataset, which might be shown in any BigQuery user interfaces for browsing the dataset. Use datasetId for making API calls.
          "lastModifiedTime": "A String", # [Output-only] The date when this dataset or any of its tables was last modified, in milliseconds since the epoch.
          "id": "A String", # [Output-only] The fully-qualified unique name of this 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.
          "selfLink": "A String", # [Output-only] An URL that can be used to access this resource again. You can use this URL in Get or Update requests to this resource.
        }

`insert(projectId, body)`

    Creates a new empty dataset.

    Args:
      projectId: string, Project ID of the new dataset (required)
      body: object, The request body. (required)
        The object takes the form of:

    {
        "kind": "bigquery#dataset", # [Output-only] The resource type.
        "description": "A String", # [Optional] A user-friendly string description for the dataset. This might be shown in BigQuery UI for browsing the dataset.
        "datasetReference": { # [Required] Reference identifying dataset.
          "projectId": "A String", # [Optional] The ID of the container project.
          "datasetId": "A String", # [Required] A unique ID for this dataset, without the project name.
        },
        "creationTime": "A String", # [Output-only] The time when this dataset was created, in milliseconds since the epoch.
        "access": [ # [Optional] Describes users' rights on the dataset. You can assign the same role to multiple users, and assign multiple roles to the same user.
            # Default values assigned to a new dataset are as follows: OWNER - Project owners, dataset creator READER - Project readers WRITER - Project writers
            # See ACLs and Rights for a description of these rights. If you specify any of these roles when creating a dataset, the assigned roles will overwrite the defaults listed above.
            # To revoke rights to a dataset, call datasets.update() and omit the names of anyone whose rights you wish to revoke. However, every dataset must have at least one entity granted OWNER role.
            # Each access object can have only one of the following members: userByEmail, groupByEmail, domain, or allAuthenticatedUsers.
          {
            "specialGroup": "A String", # [Pick one] A special group to grant access to. The valid values are: projectOwners: Owners of the enclosing project. projectReaders: Readers of the enclosing project. projectWriters: Writers of the enclosing project. allAuthenticatedUsers: All authenticated BigQuery users.
            "domain": "A 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".
            "role": "A String", # [Required] Describes the rights granted to the user specified by the other member of the access object. The following string values are supported: READER - User can call any list() or get() method on any collection or resource. WRITER - User can call any method on any collection except for datasets, on which they can call list() and get(). OWNER - User can call any method. The dataset creator is granted this role by default.
            "groupByEmail": "A String", # [Pick one] A fully-qualified email address of a mailing list to grant access to. This must be either a Google Groups mailing list (ends in @googlegroups.com) or a group managed by an enterprise version of Google Groups.
            "userByEmail": "A String", # [Pick one] A fully qualified email address of a user to grant access to. For example: fred@example.com.
          },
        ],
        "etag": "A String", # [Output-only] A hash of this resource.
        "friendlyName": "A String", # [Optional] A descriptive name for this dataset, which might be shown in any BigQuery user interfaces for browsing the dataset. Use datasetId for making API calls.
        "lastModifiedTime": "A String", # [Output-only] The date when this dataset or any of its tables was last modified, in milliseconds since the epoch.
        "id": "A String", # [Output-only] The fully-qualified unique name of this 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.
        "selfLink": "A String", # [Output-only] An URL that can be used to access this resource again. You can use this URL in Get or Update requests to this resource.
      }

    Returns:
      An object of the form:

        {
          "kind": "bigquery#dataset", # [Output-only] The resource type.
          "description": "A String", # [Optional] A user-friendly string description for the dataset. This might be shown in BigQuery UI for browsing the dataset.
          "datasetReference": { # [Required] Reference identifying dataset.
            "projectId": "A String", # [Optional] The ID of the container project.
            "datasetId": "A String", # [Required] A unique ID for this dataset, without the project name.
          },
          "creationTime": "A String", # [Output-only] The time when this dataset was created, in milliseconds since the epoch.
          "access": [ # [Optional] Describes users' rights on the dataset. You can assign the same role to multiple users, and assign multiple roles to the same user.
              # Default values assigned to a new dataset are as follows: OWNER - Project owners, dataset creator READER - Project readers WRITER - Project writers
              # See ACLs and Rights for a description of these rights. If you specify any of these roles when creating a dataset, the assigned roles will overwrite the defaults listed above.
              # To revoke rights to a dataset, call datasets.update() and omit the names of anyone whose rights you wish to revoke. However, every dataset must have at least one entity granted OWNER role.
              # Each access object can have only one of the following members: userByEmail, groupByEmail, domain, or allAuthenticatedUsers.
            {
              "specialGroup": "A String", # [Pick one] A special group to grant access to. The valid values are: projectOwners: Owners of the enclosing project. projectReaders: Readers of the enclosing project. projectWriters: Writers of the enclosing project. allAuthenticatedUsers: All authenticated BigQuery users.
              "domain": "A 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".
              "role": "A String", # [Required] Describes the rights granted to the user specified by the other member of the access object. The following string values are supported: READER - User can call any list() or get() method on any collection or resource. WRITER - User can call any method on any collection except for datasets, on which they can call list() and get(). OWNER - User can call any method. The dataset creator is granted this role by default.
              "groupByEmail": "A String", # [Pick one] A fully-qualified email address of a mailing list to grant access to. This must be either a Google Groups mailing list (ends in @googlegroups.com) or a group managed by an enterprise version of Google Groups.
              "userByEmail": "A String", # [Pick one] A fully qualified email address of a user to grant access to. For example: fred@example.com.
            },
          ],
          "etag": "A String", # [Output-only] A hash of this resource.
          "friendlyName": "A String", # [Optional] A descriptive name for this dataset, which might be shown in any BigQuery user interfaces for browsing the dataset. Use datasetId for making API calls.
          "lastModifiedTime": "A String", # [Output-only] The date when this dataset or any of its tables was last modified, in milliseconds since the epoch.
          "id": "A String", # [Output-only] The fully-qualified unique name of this 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.
          "selfLink": "A String", # [Output-only] An URL that can be used to access this resource again. You can use this URL in Get or Update requests to this resource.
        }

`list(projectId, pageToken=None, maxResults=None)`

    Lists all the datasets in the specified project to which the caller has read access; however, a project owner can list (but not necessarily get) all datasets in his project.

    Args:
      projectId: string, Project ID of the datasets to be listed (required)
      pageToken: string, Page token, returned by a previous call, to request the next page of results
      maxResults: integer, The maximum number of results to return

    Returns:
      An object of the form:

        {
        "nextPageToken": "A String", # A token that can be used to request the next results page. This property is omitted on the final results page.
        "kind": "bigquery#datasetList", # The list type. This property always returns the value "bigquery#datasetList".
        "datasets": [ # An array of the dataset resources in the project. Each resource contains basic information. For full information about a particular dataset resource, use the Datasets: get method. This property is omitted when there are no datasets in the project.
          {
            "friendlyName": "A String", # A descriptive name for the dataset, if one exists.
            "kind": "bigquery#dataset", # The resource type. This property always returns the value "bigquery#dataset".
            "id": "A String", # The fully-qualified, unique, opaque ID of the dataset.
            "datasetReference": { # The dataset reference. Use this property to access specific parts of the dataset's ID, such as project ID or dataset ID.
              "projectId": "A String", # [Optional] The ID of the container project.
              "datasetId": "A String", # [Required] A unique ID for this dataset, without the project name.
            },
          },
        ],
        "etag": "A String", # A hash value of the results page. You can use this property to determine if the page has changed since the last request.
      }

`list_next(previous_request, previous_response)`

    Retrieves the next page of results.

    Args:
      previous_request: The request for the previous page. (required)
      previous_response: The response from the request for the previous page. (required)

    Returns:
      A request object that you can call 'execute()' on to request the next
      page. Returns None if there are no more items in the collection.

`patch(projectId, datasetId, body)`

    Updates information in an existing dataset, specified by datasetId. Properties not included in the submitted resource will not be changed. If you include the access property without any values assigned, the request will fail as you must specify at least one owner for a dataset. This method supports patch semantics.

    Args:
      projectId: string, Project ID of the dataset being updated (required)
      datasetId: string, Dataset ID of the dataset being updated (required)
      body: object, The request body. (required)
        The object takes the form of:

    {
        "kind": "bigquery#dataset", # [Output-only] The resource type.
        "description": "A String", # [Optional] A user-friendly string description for the dataset. This might be shown in BigQuery UI for browsing the dataset.
        "datasetReference": { # [Required] Reference identifying dataset.
          "projectId": "A String", # [Optional] The ID of the container project.
          "datasetId": "A String", # [Required] A unique ID for this dataset, without the project name.
        },
        "creationTime": "A String", # [Output-only] The time when this dataset was created, in milliseconds since the epoch.
        "access": [ # [Optional] Describes users' rights on the dataset. You can assign the same role to multiple users, and assign multiple roles to the same user.
            # Default values assigned to a new dataset are as follows: OWNER - Project owners, dataset creator READER - Project readers WRITER - Project writers
            # See ACLs and Rights for a description of these rights. If you specify any of these roles when creating a dataset, the assigned roles will overwrite the defaults listed above.
            # To revoke rights to a dataset, call datasets.update() and omit the names of anyone whose rights you wish to revoke. However, every dataset must have at least one entity granted OWNER role.
            # Each access object can have only one of the following members: userByEmail, groupByEmail, domain, or allAuthenticatedUsers.
          {
            "specialGroup": "A String", # [Pick one] A special group to grant access to. The valid values are: projectOwners: Owners of the enclosing project. projectReaders: Readers of the enclosing project. projectWriters: Writers of the enclosing project. allAuthenticatedUsers: All authenticated BigQuery users.
            "domain": "A 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".
            "role": "A String", # [Required] Describes the rights granted to the user specified by the other member of the access object. The following string values are supported: READER - User can call any list() or get() method on any collection or resource. WRITER - User can call any method on any collection except for datasets, on which they can call list() and get(). OWNER - User can call any method. The dataset creator is granted this role by default.
            "groupByEmail": "A String", # [Pick one] A fully-qualified email address of a mailing list to grant access to. This must be either a Google Groups mailing list (ends in @googlegroups.com) or a group managed by an enterprise version of Google Groups.
            "userByEmail": "A String", # [Pick one] A fully qualified email address of a user to grant access to. For example: fred@example.com.
          },
        ],
        "etag": "A String", # [Output-only] A hash of this resource.
        "friendlyName": "A String", # [Optional] A descriptive name for this dataset, which might be shown in any BigQuery user interfaces for browsing the dataset. Use datasetId for making API calls.
        "lastModifiedTime": "A String", # [Output-only] The date when this dataset or any of its tables was last modified, in milliseconds since the epoch.
        "id": "A String", # [Output-only] The fully-qualified unique name of this 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.
        "selfLink": "A String", # [Output-only] An URL that can be used to access this resource again. You can use this URL in Get or Update requests to this resource.
      }

    Returns:
      An object of the form:

        {
          "kind": "bigquery#dataset", # [Output-only] The resource type.
          "description": "A String", # [Optional] A user-friendly string description for the dataset. This might be shown in BigQuery UI for browsing the dataset.
          "datasetReference": { # [Required] Reference identifying dataset.
            "projectId": "A String", # [Optional] The ID of the container project.
            "datasetId": "A String", # [Required] A unique ID for this dataset, without the project name.
          },
          "creationTime": "A String", # [Output-only] The time when this dataset was created, in milliseconds since the epoch.
          "access": [ # [Optional] Describes users' rights on the dataset. You can assign the same role to multiple users, and assign multiple roles to the same user.
              # Default values assigned to a new dataset are as follows: OWNER - Project owners, dataset creator READER - Project readers WRITER - Project writers
              # See ACLs and Rights for a description of these rights. If you specify any of these roles when creating a dataset, the assigned roles will overwrite the defaults listed above.
              # To revoke rights to a dataset, call datasets.update() and omit the names of anyone whose rights you wish to revoke. However, every dataset must have at least one entity granted OWNER role.
              # Each access object can have only one of the following members: userByEmail, groupByEmail, domain, or allAuthenticatedUsers.
            {
              "specialGroup": "A String", # [Pick one] A special group to grant access to. The valid values are: projectOwners: Owners of the enclosing project. projectReaders: Readers of the enclosing project. projectWriters: Writers of the enclosing project. allAuthenticatedUsers: All authenticated BigQuery users.
              "domain": "A 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".
              "role": "A String", # [Required] Describes the rights granted to the user specified by the other member of the access object. The following string values are supported: READER - User can call any list() or get() method on any collection or resource. WRITER - User can call any method on any collection except for datasets, on which they can call list() and get(). OWNER - User can call any method. The dataset creator is granted this role by default.
              "groupByEmail": "A String", # [Pick one] A fully-qualified email address of a mailing list to grant access to. This must be either a Google Groups mailing list (ends in @googlegroups.com) or a group managed by an enterprise version of Google Groups.
              "userByEmail": "A String", # [Pick one] A fully qualified email address of a user to grant access to. For example: fred@example.com.
            },
          ],
          "etag": "A String", # [Output-only] A hash of this resource.
          "friendlyName": "A String", # [Optional] A descriptive name for this dataset, which might be shown in any BigQuery user interfaces for browsing the dataset. Use datasetId for making API calls.
          "lastModifiedTime": "A String", # [Output-only] The date when this dataset or any of its tables was last modified, in milliseconds since the epoch.
          "id": "A String", # [Output-only] The fully-qualified unique name of this 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.
          "selfLink": "A String", # [Output-only] An URL that can be used to access this resource again. You can use this URL in Get or Update requests to this resource.
        }

`update(projectId, datasetId, body)`

    Updates information in an existing dataset, specified by datasetId. Properties not included in the submitted resource will not be changed. If you include the access property without any values assigned, the request will fail as you must specify at least one owner for a dataset.

    Args:
      projectId: string, Project ID of the dataset being updated (required)
      datasetId: string, Dataset ID of the dataset being updated (required)
      body: object, The request body. (required)
        The object takes the form of:

    {
        "kind": "bigquery#dataset", # [Output-only] The resource type.
        "description": "A String", # [Optional] A user-friendly string description for the dataset. This might be shown in BigQuery UI for browsing the dataset.
        "datasetReference": { # [Required] Reference identifying dataset.
          "projectId": "A String", # [Optional] The ID of the container project.
          "datasetId": "A String", # [Required] A unique ID for this dataset, without the project name.
        },
        "creationTime": "A String", # [Output-only] The time when this dataset was created, in milliseconds since the epoch.
        "access": [ # [Optional] Describes users' rights on the dataset. You can assign the same role to multiple users, and assign multiple roles to the same user.
            # Default values assigned to a new dataset are as follows: OWNER - Project owners, dataset creator READER - Project readers WRITER - Project writers
            # See ACLs and Rights for a description of these rights. If you specify any of these roles when creating a dataset, the assigned roles will overwrite the defaults listed above.
            # To revoke rights to a dataset, call datasets.update() and omit the names of anyone whose rights you wish to revoke. However, every dataset must have at least one entity granted OWNER role.
            # Each access object can have only one of the following members: userByEmail, groupByEmail, domain, or allAuthenticatedUsers.
          {
            "specialGroup": "A String", # [Pick one] A special group to grant access to. The valid values are: projectOwners: Owners of the enclosing project. projectReaders: Readers of the enclosing project. projectWriters: Writers of the enclosing project. allAuthenticatedUsers: All authenticated BigQuery users.
            "domain": "A 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".
            "role": "A String", # [Required] Describes the rights granted to the user specified by the other member of the access object. The following string values are supported: READER - User can call any list() or get() method on any collection or resource. WRITER - User can call any method on any collection except for datasets, on which they can call list() and get(). OWNER - User can call any method. The dataset creator is granted this role by default.
            "groupByEmail": "A String", # [Pick one] A fully-qualified email address of a mailing list to grant access to. This must be either a Google Groups mailing list (ends in @googlegroups.com) or a group managed by an enterprise version of Google Groups.
            "userByEmail": "A String", # [Pick one] A fully qualified email address of a user to grant access to. For example: fred@example.com.
          },
        ],
        "etag": "A String", # [Output-only] A hash of this resource.
        "friendlyName": "A String", # [Optional] A descriptive name for this dataset, which might be shown in any BigQuery user interfaces for browsing the dataset. Use datasetId for making API calls.
        "lastModifiedTime": "A String", # [Output-only] The date when this dataset or any of its tables was last modified, in milliseconds since the epoch.
        "id": "A String", # [Output-only] The fully-qualified unique name of this 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.
        "selfLink": "A String", # [Output-only] An URL that can be used to access this resource again. You can use this URL in Get or Update requests to this resource.
      }

    Returns:
      An object of the form:

        {
          "kind": "bigquery#dataset", # [Output-only] The resource type.
          "description": "A String", # [Optional] A user-friendly string description for the dataset. This might be shown in BigQuery UI for browsing the dataset.
          "datasetReference": { # [Required] Reference identifying dataset.
            "projectId": "A String", # [Optional] The ID of the container project.
            "datasetId": "A String", # [Required] A unique ID for this dataset, without the project name.
          },
          "creationTime": "A String", # [Output-only] The time when this dataset was created, in milliseconds since the epoch.
          "access": [ # [Optional] Describes users' rights on the dataset. You can assign the same role to multiple users, and assign multiple roles to the same user.
              # Default values assigned to a new dataset are as follows: OWNER - Project owners, dataset creator READER - Project readers WRITER - Project writers
              # See ACLs and Rights for a description of these rights. If you specify any of these roles when creating a dataset, the assigned roles will overwrite the defaults listed above.
              # To revoke rights to a dataset, call datasets.update() and omit the names of anyone whose rights you wish to revoke. However, every dataset must have at least one entity granted OWNER role.
              # Each access object can have only one of the following members: userByEmail, groupByEmail, domain, or allAuthenticatedUsers.
            {
              "specialGroup": "A String", # [Pick one] A special group to grant access to. The valid values are: projectOwners: Owners of the enclosing project. projectReaders: Readers of the enclosing project. projectWriters: Writers of the enclosing project. allAuthenticatedUsers: All authenticated BigQuery users.
              "domain": "A 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".
              "role": "A String", # [Required] Describes the rights granted to the user specified by the other member of the access object. The following string values are supported: READER - User can call any list() or get() method on any collection or resource. WRITER - User can call any method on any collection except for datasets, on which they can call list() and get(). OWNER - User can call any method. The dataset creator is granted this role by default.
              "groupByEmail": "A String", # [Pick one] A fully-qualified email address of a mailing list to grant access to. This must be either a Google Groups mailing list (ends in @googlegroups.com) or a group managed by an enterprise version of Google Groups.
              "userByEmail": "A String", # [Pick one] A fully qualified email address of a user to grant access to. For example: fred@example.com.
            },
          ],
          "etag": "A String", # [Output-only] A hash of this resource.
          "friendlyName": "A String", # [Optional] A descriptive name for this dataset, which might be shown in any BigQuery user interfaces for browsing the dataset. Use datasetId for making API calls.
          "lastModifiedTime": "A String", # [Output-only] The date when this dataset or any of its tables was last modified, in milliseconds since the epoch.
          "id": "A String", # [Output-only] The fully-qualified unique name of this 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.
          "selfLink": "A String", # [Output-only] An URL that can be used to access this resource again. You can use this URL in Get or Update requests to this resource.
        }