更新数据集
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
如需更新数据集的相关信息,请向 patch dataset 端点发送 HTTP PATCH
请求,该请求还包含数据集的 ID:
https://mapsplatformdatasets.googleapis.com/v1/projects/PROJECT_NUMBER_OR_ID/datasets/DATASET_ID
您可以更新数据集的 displayName
和/或 description
属性。
例如:
curl -X PATCH -d '{
"displayName": "My Updated Dataset",
"description": "This is an updated description"
}' \
-H 'X-Goog-User-Project: PROJECT_NUMBER_OR_ID' \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
"https://mapsplatformdatasets.googleapis.com/v1/projects/PROJECT_NUMBER_OR_ID/datasets/f57074a0-a8b6-403e-9df1-e8a9e4f9fc46"
该请求会返回有关更新后数据集的信息:
{
"name": "projects/PROJECT_NUMBER_OR_ID/datasets/f57074a0-a8b6-403e-9df1-e8a9e4f9fc46",
"displayName": "My Updated Dataset",
"description": "This is an updated description",
"versionId": "5fb3b84e-1405-4ecd-8f81-9183631f1c07",
"usage": [
"USAGE_DATA_DRIVEN_STYLING"
],
"gcsSource": {
"inputUri": "gs://mybucket/my.csv",
"fileFormat": "FILE_FORMAT_CSV"
},
"createTime": "2023-03-24T14:47:37.308977Z",
"updateTime": "2023-03-28T15:17:17.919351Z",
"versionCreateTime": "2023-03-24T14:48:05.053114Z",
"status": {
"state": "STATE_COMPLETED"
}
}
指定字段掩码
默认情况下,更新会修改请求正文中指定的所有受支持的字段,即 displayName
和 description
。不过,您也可以在请求中添加 updateMask
查询参数,以明确指定要更新的请求正文中的字段。
使用 updateMask
可指定以英文逗号分隔的完全限定字段名称列表,以进行更新。例如,如需仅更新 displayName
字段,请执行以下操作:
curl -X PATCH -d '{
"displayName": "My Updated Dataset",
"description": "This is an updated description"
}' \
-H 'X-Goog-User-Project: PROJECT_NUMBER_OR_ID' \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
"https://mapsplatformdatasets.googleapis.com/v1/projects/PROJECT_NUMBER_OR_ID/datasets/f57074a0-a8b6-403e-9df1-e8a9e4f9fc46?updateMask=displayName"
updateMask
查询参数的默认值为 *
,表示更新请求正文中指定的所有受支持的字段。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):2025-08-31。"],[[["\u003cp\u003eUpdate dataset metadata, such as \u003ccode\u003edisplayName\u003c/code\u003e and \u003ccode\u003edescription\u003c/code\u003e, using an HTTP \u003ccode\u003ePATCH\u003c/code\u003e request to the specified endpoint with the dataset ID.\u003c/p\u003e\n"],["\u003cp\u003eTo update the actual data within the dataset, a separate procedure outlined in the "Upload new data to the dataset" documentation should be followed.\u003c/p\u003e\n"],["\u003cp\u003eBy default, a \u003ccode\u003ePATCH\u003c/code\u003e request updates all provided fields (\u003ccode\u003edisplayName\u003c/code\u003e, \u003ccode\u003edescription\u003c/code\u003e), but you can selectively update fields using the \u003ccode\u003eupdateMask\u003c/code\u003e query parameter.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eupdateMask\u003c/code\u003e parameter accepts a comma-separated list of field names, allowing for granular control over which dataset attributes are modified.\u003c/p\u003e\n"]]],["To update dataset information, send a `PATCH` request to the specified endpoint, including the dataset ID. Modify the `displayName` and/or `description` properties in the request body. To control which fields are updated, utilize the `updateMask` query parameter with a comma-separated list of field names. Without `updateMask`, both fields are updated if present. The request returns details of the modified dataset. Note that updating data within the dataset uses a separate process.\n"],null,["# Update a dataset\n\nUpdate information about a dataset by sending an HTTP `PATCH` request to the\n[patch dataset](/maps/documentation/datasets/reference/rest/v1/projects.datasets/patch) endpoint that\nalso includes the ID of the dataset: \n\n```html\nhttps://mapsplatformdatasets.googleapis.com/v1/projects/PROJECT_NUMBER_OR_ID/datasets/DATASET_ID\n```\n\nYou can update either or both of the `displayName` and `description` properties\nof the dataset.\n| **Note:** To update the data for the dataset, use the procedure described in [Upload new data to the dataset](/maps/documentation/datasets/create#new-version).\n\nFor example: \n\n```\ncurl -X PATCH -d '{\n \"displayName\": \"My Updated Dataset\",\n \"description\": \"This is an updated description\"\n }' \\\n -H 'X-Goog-User-Project: PROJECT_NUMBER_OR_ID' \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $TOKEN\" \\\n \"https://mapsplatformdatasets.googleapis.com/v1/projects/PROJECT_NUMBER_OR_ID/datasets/f57074a0-a8b6-403e-9df1-e8a9e4f9fc46\"\n```\n\nThe request returns information about the updated dataset: \n\n```\n{\n \"name\": \"projects/PROJECT_NUMBER_OR_ID/datasets/f57074a0-a8b6-403e-9df1-e8a9e4f9fc46\",\n \"displayName\": \"My Updated Dataset\",\n \"description\": \"This is an updated description\",\n \"versionId\": \"5fb3b84e-1405-4ecd-8f81-9183631f1c07\",\n \"usage\": [\n \"USAGE_DATA_DRIVEN_STYLING\"\n ],\n \"gcsSource\": {\n \"inputUri\": \"gs://mybucket/my.csv\",\n \"fileFormat\": \"FILE_FORMAT_CSV\"\n },\n \"createTime\": \"2023-03-24T14:47:37.308977Z\",\n \"updateTime\": \"2023-03-28T15:17:17.919351Z\",\n \"versionCreateTime\": \"2023-03-24T14:48:05.053114Z\",\n \"status\": {\n \"state\": \"STATE_COMPLETED\"\n }\n}\n```\n\nSpecify a field mask\n--------------------\n\nBy default, the update modifies all the supported fields specified in the body\nof the request, meaning both `displayName` and `description`. However, you can\nalso include the\n[`updateMask`](/maps/documentation/datasets/reference/rest/v1/projects.datasets/patch#query-parameters)\nquery parameter in the request to explicitly specify the fields in the\nrequest body to update.\n\nUse `updateMask` to specify a comma-separated list of fully qualified names of\nfields to update. For example, to update only the `displayName` field: \n\n```\ncurl -X PATCH -d '{\n \"displayName\": \"My Updated Dataset\",\n \"description\": \"This is an updated description\"\n }' \\\n -H 'X-Goog-User-Project: PROJECT_NUMBER_OR_ID' \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $TOKEN\" \\\n \"https://mapsplatformdatasets.googleapis.com/v1/projects/PROJECT_NUMBER_OR_ID/datasets/f57074a0-a8b6-403e-9df1-e8a9e4f9fc46?updateMask=displayName\"\n```\n\nThe default value of the `updateMask` query parameter is `*` meaning\nupdate all supported fields specified in the request body."]]