

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

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

**必要條件**

您要從中讀取的 QuickBooks 物件。

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


| 實體 | 可以篩選 | 支援限制 | 支援排序依據 | 支援選取 \$1 | 支援分區 | 
| --- | --- | --- | --- | --- | --- | 
| 帳戶 | 是 | 是 | 是 | 是 | 是 | 
| 帳單 | 是 | 是 | 是 | 是 | 是 | 
| 公司資訊 | 否 | 否 | 否 | 是 | 否 | 
| 客戶 | 是 | 是 | 是 | 是 | 是 | 
| 員工 | 是 | 是 | 是 | 是 | 是 | 
| 預估 | 是 | 是 | 是 | 是 | 是 | 
| 發票 | 是 | 是 | 是 | 是 | 是 | 
| 項目 | 是 | 是 | 是 | 是 | 是 | 
| 付款 | 是 | 是 | 是 | 是 | 是 | 
| Preferences (偏好設定) | 否 | 否 | 否 | 是 | 否 | 
| 損益 | 是 | 否 | 否 | 是 | 否 | 
| 稅務局 | 是 | 是 | 是 | 是 | 是 | 
| 廠商 | 是 | 是 | 是 | 是 | 是 | 

**範例**：

```
QuickBooks_read = glueContext.create_dynamic_frame.from_options(
    connection_type="quickbooks",
    connection_options={
        "connectionName": "connectionName",
        "ENTITY_NAME": "Account",
        "API_VERSION": "v3"
    }
```

**QuickBooks 實體和欄位詳細資訊**：

如需實體和欄位詳細資訊的更多資訊，請參閱：
+ [帳戶](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/most-commonly-used/account)
+ [帳單](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/most-commonly-used/bill)
+ [公司資訊](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/most-commonly-used/companyinfo)
+ [客戶](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/most-commonly-used/customer)
+ [員工](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/most-commonly-used/employee)
+ [預估](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/most-commonly-used/estimate)
+ [發票](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/most-commonly-used/invoice)
+ [Item (項目)](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/most-commonly-used/item)
+ [付款](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/most-commonly-used/payment)
+ [Preferences (偏好設定)](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/most-commonly-used/preferences)
+ [損益](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/most-commonly-used/profitandloss)
+ [稅務局](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/most-commonly-used/taxagency)
+ [廠商](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/most-commonly-used/vendor)

## 分區查詢
<a name="quickbooks-reading-partitioning-queries"></a>

**欄位型分區**：

在 QuickBooks 中，Integer 和 DateTime 資料類型欄位支援欄位型分區。

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

  對於 Datetime 欄位，我們接受 Spark SQL 查詢中使用的 Spark 時間戳記格式。

  有效值的範例：

  ```
  "2024-05-07T02:03:00.00Z"
  ```
+ `UPPER_BOUND`：所選分區欄位的**唯一**上限值。
+ `NUM_PARTITIONS`：分區數目。

範例：

```
QuickBooks_read = glueContext.create_dynamic_frame.from_options(
    connection_type="quickbooks",
    connection_options={
        "connectionName": "connectionName",
        "REALMID": "12345678690123456789",
        "ENTITY_NAME": "Account",
        "API_VERSION": "v3",
        "PARTITION_FIELD": "MetaData_CreateTime"
        "LOWER_BOUND": "2023-09-07T02:03:00.000Z"
        "UPPER_BOUND": "2024-05-07T02:03:00.000Z"
        "NUM_PARTITIONS": "10"
    }
```

**記錄型分區**：

原始查詢會分區為 Spark 任務可同時執行的子查詢的 `NUM_PARTITIONS` 數目：
+ `NUM_PARTITIONS`：分區數目。

範例：

```
QuickBooks_read = glueContext.create_dynamic_frame.from_options(
    connection_type="quickbooks",
    connection_options={
        "connectionName": "connectionName",
        "REALMID": "1234567890123456789",
        "ENTITY_NAME": "Bill",
        "API_VERSION": "v3",
        "NUM_PARTITIONS": "10"
    }
```