

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

# 從 Domo 實體中讀取
<a name="domo-reading-from-entities"></a>

**必要條件**

您要從中讀取的 Domo 物件。您需要物件名稱，例如資料集或資料許可政策。下表顯示支援的實體。

**來源的支援實體**：


| 實體 | 可以篩選 | 支援限制 | 支援排序依據 | 支援選取 \$1 | 支援分區 | 
| --- | --- | --- | --- | --- | --- | 
| 資料集 | 是 | 是 | 是 | 是 | 是 | 
| 資料許可政策 | 否 | 否 | 否 | 是 | 否 | 

**範例**：

```
Domo_read = glueContext.create_dynamic_frame.from_options(
    connection_type="domo",
    connection_options={
        "connectionName": "connectionName",
        "ENTITY_NAME": "dataset",
        "API_VERSION": "v1"
    }
```

## Domo 實體和欄位詳細資訊
<a name="domo-reading-from-entities-field-details"></a>

具有靜態中繼資料的實體：

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/glue/latest/dg/domo-reading-from-entities.html)

對於下列實體，Domo 會提供端點來動態擷取中繼資料，以便在實體的資料類型層級擷取運算子支援。

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/glue/latest/dg/domo-reading-from-entities.html)

## 分區查詢
<a name="domo-reading-from-partitioning"></a>

**欄位型分區**

如果想要在 Spark 中使用並行，可以提供其他 Spark 選項 `PARTITION_FIELD`、`LOWER_BOUND`、`UPPER_BOUND` 和 `NUM_PARTITIONS`。使用這些參數，原始查詢會分區為可由 Spark 任務並行執行的子查詢的 `NUM_PARTITIONS` 數目。
+ `PARTITION_FIELD`：用來分區查詢的欄位名稱。
+ `LOWER_BOUND`：所選分區欄位的**包含**下限值。

  對於 DateTime 欄位，接受 ISO 格式的值。

  有效值範例：

  ```
  "2023-01-15T11:18:39.205Z"
  ```

  對於 Date 欄位，我們接受 ISO 格式的值。

  有效值範例：

  ```
  "2023-01-15"
  ```
+ `UPPER_BOUND`：所選分區欄位的**唯一**上限值。

  有效值範例：

  ```
  "2023-02-15T11:18:39.205Z"
  ```
+ `NUM_PARTITIONS`：分區數目。

實體分區欄位支援詳細資訊如下表所示：

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/glue/latest/dg/domo-reading-from-entities.html)

範例：

```
Domo_read = glueContext.create_dynamic_frame.from_options(
    connection_type="domo",
    connection_options={
        "connectionName": "connectionName",
        "ENTITY_NAME": "dataset",
        "API_VERSION": "v1",
        "PARTITION_FIELD": "permissionTime"
        "LOWER_BOUND": "2023-01-15T11:18:39.205Z"
        "UPPER_BOUND": "2023-02-15T11:18:39.205Z"
        "NUM_PARTITIONS": "2"
    }
```

**記錄型分區**

如果想要在 Spark 中使用並行，可以提供其他 Spark 選項 `NUM_PARTITIONS`。使用此參數，原始查詢會分區為可由 Spark 任務並行執行的子查詢的 `NUM_PARTITIONS` 數目。

在記錄型分區中，從 Domo 中查詢存在的記錄總數，然後除以提供的 `NUM_PARTITIONS` 數字。然後，每個子查詢都會同時擷取產生的記錄數目。

範例：

```
Domo_read = glueContext.create_dynamic_frame.from_options(
    connection_type="domo",
    connection_options={
        "connectionName": "connectionName",
        "ENTITY_NAME": "dataset",
        "API_VERSION": "v1",
        "NUM_PARTITIONS": "2"
    }
```