

# Reading from Twilio entities
<a name="twilio-reading-from-entities"></a>

**Prerequisite**

A Twilio object you would like to read from. You will need the object name such as `SMS-Message` or `SMS-CountryPricing`.

**Supported entities for source**:


| Entity | Interface | Can be filtered | Supports limit | Supports Order by | Supports Select \$1 | Supports partitioning | 
| --- | --- | --- | --- | --- | --- | --- | 
| SMS-Message | REST | Yes | Yes | No | Yes | Yes | 
| SMS-CountryPricing | REST | No | No | No | Yes | No | 
| Voice-Call | REST | Yes | Yes | No | Yes | No | 
| Voice-Application | REST | Yes | Yes | No | Yes | No | 
| Voice-OutgoingCallerID | REST | Yes | Yes | No | Yes | No | 
| Voice-Queue | REST | Yes | Yes | No | Yes | No | 
| Conversations-Conversation | REST | Yes | Yes | No | Yes | No | 
| Conversations-User | REST | No | Yes | No | Yes | No | 
| Conversations-Role | REST | No | Yes | No | Yes | No | 
| Conversations-Configuration | REST | No | No | No | Yes | No | 
| Conversations-AddressConfiguration | REST | Yes | Yes | No | Yes | No | 
| Conversations-WebhookConfiguration | REST | No | No | No | Yes | No | 
| Conversations-ParticipantConversation | REST | No | No | No | Yes | No | 
| Conversations-Credential | REST | No | Yes | No | Yes | No | 
| Conversations-ConversationService | REST | No | Yes | No | Yes | No | 

**Example**:

```
twilio_read = glueContext.create_dynamic_frame.from_options(
    connection_type="twilio",
    connection_options={
        "connectionName": "connectionName",
        "ENTITY_NAME": "sms-message",
        "API_VERSION": "2010-04-01",
        "Edge_Location": "sydney.us1"
    }
```

**Twilio entity and field details**:

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

## Partitioning queries
<a name="twilio-reading-partitioning-queries"></a>

**Fields supporting partitioning**:

In Twilio, the DateTime datatype fields support field-based partitioning.

You can provide the additional Spark options `PARTITION_FIELD`, `LOWER_BOUND`, `UPPER_BOUND`, and `NUM_PARTITIONS` if you want to utilize concurrency in Spark. With these parameters, the original query would be split into `NUM_PARTITIONS` number of sub-queries that can be executed by Spark tasks concurrently.
+ `PARTITION_FIELD`: the name of the field to be used to partition the query.
+ `LOWER_BOUND`: an **inclusive** lower bound value of the chosen partition field.

  For the Datetime field, we accept the Spark timestamp format used in Spark SQL queries.

  Examples of valid value:

  ```
  "2024-05-01T20:55:02.000Z"
  ```
+ `UPPER_BOUND`: an **exclusive** upper bound value of the chosen partition field.
+ `NUM_PARTITIONS`: the number of partitions.

Example:

```
twilio_read = glueContext.create_dynamic_frame.from_options(
    connection_type="twilio",
    connection_options={
        "connectionName": "connectionName",
        "ENTITY_NAME": "sms-message",
        "API_VERSION": "2010-04-01",
        "PARTITION_FIELD": "date_sent"
        "LOWER_BOUND": "2024-05-01T20:55:02.000Z"
        "UPPER_BOUND": "2024-06-01T20:55:02.000Z"
        "NUM_PARTITIONS": "10"
    }
```