Database Reference
In-Depth Information
fields to update. Alice could patch the ACL while Bob is patching the friendly
name, and both updates will complete successfully and produce the wanted
outcome.
Here is a
curl
session showing a patch operation on the dataset to set the
friendly name to “Bob's Dataset.” Notice that you don't even have to specify
the dataset reference fields:
$
curl -H "$(python auth.py)" \
-
H "Content-Type: application/json" \
-
X PATCH \
--
data-binary "{'friendlyName': 'Bob\'s
dataset'}" \
"${DATASET_URL}"
{
…
"datasetReference": {
"datasetId": "scratch",
"projectId": "bigquery-e2e"
},
"friendlyName": "Bob's dataset",
"access": [ … ],
"creationTime": "1376367421192",
"lastModifiedTime": "1376370888255"
}
Datasets.delete()
The final operation on a dataset (pun intended) is the
Datasets.delete()
method. To delete a dataset, you must be an owner
of the dataset, and the dataset must be empty (i.e. there are no tables in
the dataset). If you really want to delete the tables too, you can specify
the
deleteContents
flag. It should go without saying that you should be
careful when using this operation because there is no undelete operation
available for datasets.
One thing that can be surprising is that delete operations do not return the
standard HTTP
200
response on success; they return
204
instead. The
204
response code is defined as
No Content
. Because the delete operation
doesn't return any content, you get a
204
instead of a
200
. Because this is