

# ServiceNow 엔터티에서 읽기
<a name="servicenow-reading-from-entities"></a>

**사전 조건**

읽으려는 ServiceNow Tables 객체. 객체 이름(예: pa\$1bucket 또는 incident)이 필요합니다.

**예시:**

```
servicenow_read = glueContext.create_dynamic_frame.from_options(
    connection_type="servicenow",
    connection_options={
        "connectionName": "connectionName",
        "ENTITY_NAME": "pa_buckets",
        "API_VERSION": "v2"
        "instanceUrl": "https://<instance-name>.service-now.com"
    }
)
```

**ServiceNow 엔터티 및 필드 세부 정보**:

다음 엔터티에 대해 ServiceNow에서는 메타데이터를 동적으로 가져오도록 엔드포인트를 제공하므로 운영자 지원은 각 엔터티의 데이터 유형 수준에서 캡처됩니다.

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

**참고**  
구조체 데이터 유형은 커넥터의 응답에서 문자열 데이터 유형으로 변환됩니다.

**참고**  
`DML_STATUS`는 CREATED/UPDATED 레코드를 추적하는 데 사용되는 추가 사용자 정의 속성입니다.

## 분할 쿼리
<a name="servicenow-reading-partitioning-queries"></a>

**필드 기반 분할**:

Spark에서 동시성을 활용하려는 경우 추가 Spark 옵션(`PARTITION_FIELD`, `LOWER_BOUND`, `UPPER_BOUND`, `NUM_PARTITIONS`)을 제공할 수 있습니다. 이러한 파라미터를 사용하면 Spark 작업에서 동시에 실행할 수 있는 `NUM_PARTITIONS`개의 하위 쿼리로 원래 쿼리가 분할됩니다.

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/glue/latest/dg/servicenow-reading-from-entities.html)
+ `PARTITION_FIELD`: 쿼리 분할에 사용할 필드의 이름입니다.
+ `LOWER_BOUND`: 선택한 파티션 필드의 하한 값(**경계 포함**).

  Datetime 필드의 경우 Spark SQL 쿼리에 사용된 Spark 타임스탬프 형식을 허용합니다.

  유효한 값의 예제:

  ```
  "2024-01-30T06:47:51.000Z"
  ```
+ `UPPER_BOUND`: 선택한 파티션 필드의 상한 값(**경계 제외**).
+ `NUM_PARTITIONS`: 파티션 수.

다음 표에서는 엔터티 분할 필드 지원 세부 정보를 설명합니다.

예시:

```
servicenow_read = glueContext.create_dynamic_frame.from_options(
    connection_type="servicenow",
    connection_options={
        "connectionName": "connectionName",
        "ENTITY_NAME": "pa_buckets",
        "API_VERSION": "v2",
        "instanceUrl": "https://<instance-name>.service-now.com"
        "PARTITION_FIELD": "sys_created_on"
        "LOWER_BOUND": "2024-01-30T06:47:51.000Z"
        "UPPER_BOUND": "2024-06-30T06:47:51.000Z"
        "NUM_PARTITIONS": "10"
    }
```

**레코드 기반 분할**:

Spark에서 동시성을 활용하려는 경우 추가 Spark 옵션(`NUM_PARTITIONS`)을 제공할 수 있습니다. 이 파라미터를 사용하면 Spark 태스크에서 동시에 실행할 수 있는 `NUM_PARTITIONS`개의 하위 쿼리로 원본 쿼리가 분할됩니다.

레코드 기반 분할에서는 존재하는 총 레코드 수를 ServiceNow API에서 쿼리하고 제공된 `NUM_PARTITIONS` 수로 나눕니다. 그런 다음, 결과 레코드 수를 각 하위 쿼리에서 동시에 가져옵니다.
+ `NUM_PARTITIONS`: 파티션 수.

예시:

```
servicenow_read = glueContext.create_dynamic_frame.from_options(
    connection_type="servicenow",
    connection_options={
        "connectionName": "connectionName",
        "ENTITY_NAME": "pa_buckets",
        "API_VERSION": "v2",
        "instanceUrl": "https://<instance-name>.service-now.com"
        "NUM_PARTITIONS": "2"
    }
```