

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# Amazon DataZone 中的資料品質
<a name="datazone-data-quality"></a>

Amazon DataZone 中的資料品質指標可協助您了解不同的品質指標，例如資料來源的完整性、及時性和準確性。Amazon DataZone 與 AWS Glue Data Quality 整合，並提供 APIs 來整合第三方資料品質解決方案的資料品質指標。資料使用者可以查看其訂閱資產的資料品質指標如何隨時間變化。若要撰寫和執行資料品質規則，您可以使用您選擇的資料品質工具，例如 Glue AWS 資料品質。透過 Amazon DataZone 中的資料品質指標，資料消費者可以視覺化資產和資料欄的資料品質分數，協助建立對決策所用資料的信任。

**先決條件和 IAM 角色變更**

如果您使用的是 Amazon DataZone 的 AWS 受管政策，則沒有額外的組態步驟，而且這些受管政策會自動更新以支援資料品質。如果您將自己的政策用於授予 Amazon DataZone 必要許可的角色，以與支援的 服務互通，則必須更新連接到這些角色的政策，以啟用 中讀取 AWS Glue 資料品質資訊的支援，[AWS 受管政策： AmazonDataZoneGlueManageAccessRolePolicy](security-iam-awsmanpol-AmazonDataZoneGlueManageAccessRolePolicy.md)並啟用 [AWS 受管政策： AmazonDataZoneDomainExecutionRolePolicy](security-iam-awsmanpol-AmazonDataZoneDomainExecutionRolePolicy.md)和 中時間序列 APIs 的支援[AWS 受管政策：AmazonDataZoneFullUserAccess](security-iam-awsmanpol-AmazonDataZoneFullUserAccess.md)。

## 啟用 Glue AWS 資產的資料品質
<a name="datazone-data-quality-glue"></a>

Amazon DataZone 會從 Glue AWS 提取資料品質指標，以便在某個時間點提供內容，例如在商業資料目錄搜尋期間。資料使用者可以查看其訂閱資產的資料品質指標如何隨時間變化。資料生產者可以按排程擷取 AWS Glue 資料品質分數。Amazon DataZone 商業資料目錄也可以透過資料品質 APIs 顯示第三方系統的資料品質指標。如需詳細資訊，請參閱 [AWS Data Catalog 的 Glue Data Quality](https://docs.aws.amazon.com/glue/latest/dg/glue-data-quality.html) [AWS 和 Glue Data Quality 入門](https://docs.aws.amazon.com/glue/latest/dg/data-quality-getting-started.html)。

您可以透過下列方式啟用 Amazon DataZone 資產的資料品質指標：
+ 使用資料入口網站或 Amazon DataZone APIs，在建立新的或編輯現有的 AWS Glue 資料來源時，透過 Amazon DataZone 資料入口網站啟用 Glue AWS 資料來源的資料品質。

  如需透過 入口網站啟用資料來源資料品質的詳細資訊，請參閱 [建立並執行 的 Amazon DataZone 資料來源 AWS Glue Data Catalog](create-glue-data-source.md)。
**注意**  
您可以使用資料入口網站，僅針對 AWS Glue 庫存資產啟用資料品質。在此版本的 Amazon DataZone 中，不支援透過資料入口網站啟用 Amazon Redshift 或自訂類型資產的資料品質。

  您也可以使用 APIs 來啟用新資料來源或現有資料來源的資料品質。您可以透過叫用 [CreateDataSource](https://docs.aws.amazon.com/datazone/datazone/latest/APIReference/API_CreateDataSource.htmlAPI) 或 [UpdateDataSource](https://docs.aws.amazon.com/datazone/datazone/latest/APIReference/API_UpdateDataSource.htmlAPI) 並將 `autoImportDataQualityResult` 參數設定為 'True' 來執行此操作。

  啟用資料品質後，您可以隨需或按排程執行資料來源。每次執行最多可以為每個資產引入 100 個指標。使用資料來源以取得資料品質時，不需要手動建立表單或新增指標。發佈資產時，對資料品質表單所做的更新 （每個歷史記錄規則最多 30 個資料點） 會反映在消費者的清單中。之後，資產的每個新增指標都會自動新增至清單中。您不需要重新發佈資產，即可為消費者提供最新的分數。

## 啟用自訂資產類型的資料品質
<a name="datazone-data-quality-third-party"></a>

您可以使用 Amazon DataZone APIs 來啟用任何自訂類型資產的資料品質。如需詳細資訊，請參閱下列內容：
+ [PostTimeSeriesDataPoints](https://docs.aws.amazon.com/datazone/latest/APIReference/API_PostTimeSeriesDataPoints.html)
+ [ListTimeSeriesDataPoints](https://docs.aws.amazon.com/datazone/latest/APIReference/API_ListTimeSeriesDataPoints.html)
+ [GetTimeSeriesDataPoint](https://docs.aws.amazon.com/datazone/latest/APIReference/API_GetTimeSeriesDataPoint.html)
+ [DeleteTimeSeriesDataPoints](https://docs.aws.amazon.com/datazone/latest/APIReference/API_DeleteTimeSeriesDataPoints.html)

下列步驟提供使用 APIs或 CLI 為 Amazon DataZone 中的資產匯入第三方指標的範例：

1. 呼叫 `PostTimeSeriesDataPoints` API，如下所示：

   ```
   aws datazone post-time-series-data-points  \
   --cli-input-json file://createTimeSeriesPayload.json \
   ```

   具有下列承載：

   ```
   "domainId": "dzd_5oo7xzoqltu8mf",
       "entityId": "4wyh64k2n8czaf",
       "entityType": "ASSET",
       "form": {
           "content": "{\n  \"evaluations\" : [ {\n    \"types\" : [ \"MaximumLength\" ],\n    \"description\" : \"ColumnLength \\\"ShippingCountry\\\" <= 6\",\n    \"details\" : { },\n    \"applicableFields\" : [ \"ShippingCountry\" ],\n    \"status\" : \"PASS\"\n  }, {\n    \"types\" : [ \"MaximumLength\" ],\n    \"description\" : \"ColumnLength \\\"ShippingState\\\" <= 2\",\n    \"details\" : { },\n    \"applicableFields\" : [ \"ShippingState\" ],\n    \"status\" : \"PASS\"\n  }, {\n    \"types\" : [ \"MaximumLength\" ],\n    \"description\" : \"ColumnLength \\\"ShippingCity\\\" <= 8\",\n    \"details\" : { },\n    \"applicableFields\" : [ \"ShippingCity\" ],\n    \"status\" : \"PASS\"\n  }, {\n    \"types\" : [ \"Completeness\" ],\n    \"description\" : \"Completeness \\\"ShippingStreet\\\" >= 0.59\",\n    \"details\" : { },\n    \"applicableFields\" : [ \"ShippingStreet\" ],\n    \"status\" : \"PASS\"\n  }, {\n    \"types\" : [ \"MaximumLength\" ],\n    \"description\" : \"ColumnLength \\\"ShippingStreet\\\" <= 101\",\n    \"details\" : { },\n    \"applicableFields\" : [ \"ShippingStreet\" ],\n    \"status\" : \"PASS\"\n  }, {\n    \"types\" : [ \"MaximumLength\" ],\n    \"description\" : \"ColumnLength \\\"BillingCountry\\\" <= 6\",\n    \"details\" : { },\n    \"applicableFields\" : [ \"BillingCountry\" ],\n    \"status\" : \"PASS\"\n  }, {\n    \"types\" : [ \"Completeness\" ],\n    \"description\" : \"Completeness \\\"biLlingcountry\\\" >= 0.5\",\n    \"details\" : {\n      \"EVALUATION_MESSAGE\" : \"Value: 0.26666666666666666 does not meet the constraint requirement!\"\n    },\n    \"applicableFields\" : [ \"biLlingcountry\" ],\n    \"status\" : \"FAIL\"\n  }, {\n    \"types\" : [ \"Completeness\" ],\n    \"description\" : \"Completeness \\\"Billingstreet\\\" >= 0.5\",\n    \"details\" : { },\n    \"applicableFields\" : [ \"Billingstreet\" ],\n    \"status\" : \"PASS\"\n  } ],\n  \"passingPercentage\" : 88.0,\n  \"evaluationsCount\" : 8\n}",
           "formName": "shortschemaruleset",
           "id": "athp9dyw75gzhj",
           "timestamp": 1.71700477757E9,
           "typeIdentifier": "amazon.datazone.DataQualityResultFormType",
           "typeRevision": "8"
       },
       "formName": "shortschemaruleset"
   }
   ```

   您可以透過叫用 `GetFormType`動作來取得此承載：

   ```
   aws datazone get-form-type --domain-identifier <your_domain_id> --form-type-identifier amazon.datazone.DataQualityResultFormType --region <domain_region> --output text --query 'model.smithy'
   ```

1. 呼叫 `DeleteTimeSeriesDataPoints` API，如下所示：

   ```
   aws datazone delete-time-series-data-points\
   --domain-identifier dzd_bqqlk3nz21zp2f \
   --entity-identifier dzd_bqqlk3nz21zp2f \
   --entity-type ASSET \
   --form-name rulesET1 \
   ```