

# Salesforce Commerce Cloud エンティティからの読み取り
<a name="salesforce-commerce-cloud-reading-from-entities"></a>

 **前提条件** 
+  読み取り元の Salesforce Commerce Cloud オブジェクト。使用可能なエンティティを確認するには、以下のサポートされているエンティティの表を参照してください。

 **サポートされているエンティティ** 


| エンティティ | フィルタリング可能 | 制限をサポートする | Order By をサポートする | Select \$1 をサポートする | パーティショニングをサポートする | 
| --- | --- | --- | --- | --- | --- | 
| 割り当て | はい | あり | あり | あり | あり | 
| キャンペーン | はい | あり | あり | あり | あり | 
| カタログ | はい | あり | あり | あり | あり | 
| カテゴリ | はい | あり | あり | あり | あり | 
| Coupons | はい | あり | あり | あり | あり | 
| ギフト券 | はい | あり | あり | あり | あり | 
| 製品 | はい | あり | あり | あり | あり | 
| プロモーション | はい | あり | あり | あり | あり | 
| ソースコードグループ | はい | あり | あり | あり | あり | 

 **例** 

```
salesforce_commerce_cloud_read = glueContext.create_dynamic_frame.from_options(
     connection_type="SalesforceCommerceCloud",
     connection_options={
         "connectionName": "connectionName",
         "ENTITY_NAME": "campaign",
         "API_VERSION": "v1"      
     }
)
```

 **Salesforce Commerce Cloud エンティティとフィールドの詳細** 

 エンティティリスト: 
+  割り当て:[ https://developer.salesforce.com/docs/commerce/commerce-api/references/assignments ]( https://developer.salesforce.com/docs/commerce/commerce-api/references/assignments) 
+  キャンペーン:[ https://developer.salesforce.com/docs/commerce/commerce-api/references/campaigns ](https://developer.salesforce.com/docs/commerce/commerce-api/references/campaigns) 
+  カタログ:[ https://developer.salesforce.com/docs/commerce/commerce-api/references/catalogs ](https://developer.salesforce.com/docs/commerce/commerce-api/references/catalogs) 
+  カテゴリ:[ https://developer.salesforce.com/docs/commerce/commerce-api/references/catalogs?meta=searchCategories ](https://developer.salesforce.com/docs/commerce/commerce-api/references/catalogs?meta=searchCategories) 
+  ギフト券:[ https://developer.salesforce.com/docs/commerce/commerce-api/references/gift-certificates ](https://developer.salesforce.com/docs/commerce/commerce-api/references/gift-certificates) 
+  製品:[ https://developer.salesforce.com/docs/commerce/commerce-api/references/products ](https://developer.salesforce.com/docs/commerce/commerce-api/references/products) 
+  プロモーション:[ https://developer.salesforce.com/docs/commerce/commerce-api/references/promotions ](https://developer.salesforce.com/docs/commerce/commerce-api/references/promotions) 
+  ソースコードグループ:[ https://developer.salesforce.com/docs/commerce/commerce-api/references/source-code-groups ](https://developer.salesforce.com/docs/commerce/commerce-api/references/source-code-groups) 

 **パーティショニングクエリ** 

 Spark で同時実行を使用する場合は、追加の Spark オプション `PARTITION_FIELD`、`LOWER_BOUND`、`UPPER_BOUND`、および `NUM_PARTITIONS` を指定できます。これらのパラメータを使用すると、元のクエリは Spark タスクで同時に実行できるサブクエリの `NUM_PARTITIONS` の数に分割されます。
+  `PARTITION_FIELD`: クエリのパーティション化に使用するフィールドの名前。
+  `LOWER_BOUND`: 選択したパーティションフィールドの包括的な下限値。

   日付については、Spark SQL クエリで使用される Spark の日付形式を受け入れます。有効な値の例: `"2024-02-06"`。
+  `UPPER_BOUND`: 選択したパーティションフィールドの排他的上限値。
+  `NUM_PARTITIONS`: パーティション数。

 エンティティごとのパーティション分割フィールドのサポートの詳細は、以下の表にまとめられています。


| エンティティ | Partitioning Field | DataType | 
| --- | --- | --- | 
| キャンペーン | lastModified | DateTime | 
| キャンペーン | startDate | DateTime | 
| キャンペーン | endDate | DateTime | 
| カタログ | creationDate | DateTime | 
| カテゴリ | creationDate | DateTime | 
| ギフト券 | merchantId | 文字列 | 
| ギフト券 | creationDate | DateTime | 
| 製品 | creationDate | DateTime | 
| 製品 | lastModified | DateTime | 
| ソースコードグループ | creationDate | DateTime | 
| ソースコードグループ | startTime | DateTime | 
| ソースコードグループ | endTime | DateTime | 

 **例** 

```
 salesforceCommerceCloud_read = glueContext.create_dynamic_frame.from_options(
     connection_type="SalesforceCommerceCloud",
     connection_options={
         "connectionName": "connectionName",
         "ENTITY_NAME": "coupons",
         "API_VERSION": "v1",
         "PARTITION_FIELD": "creationDate",
         "LOWER_BOUND": "2020-05-01T20:55:02.000Z",
         "UPPER_BOUND": "2024-07-11T20:55:02.000Z",
         "NUM_PARTITIONS": "10"
     }
)
```