

# Reading from Facebook Page Insights entities


**Prerequisite**

A Facebook Page Insights object you would like to read from. You will need the object name.

**Supported entities for source**:


| Entity | Can be filtered | Supports limit | Supports Order by | Supports Select \$1 | Supports partitioning | 
| --- | --- | --- | --- | --- | --- | 
| Page Content | Yes | No | Yes | Yes | Yes | 
| Page CTA Clicks | Yes | No | No | Yes | Yes | 
| Page Engagement | Yes | No | No | Yes | Yes | 
| Page Impressions | Yes | No | No | Yes | Yes | 
| Page Posts | Yes | No | No | Yes | Yes | 
| Page Post Engagement | No | No | No | Yes | No | 
| Page Post Reactions | No | No | No | Yes | No | 
| Page Reactions | Yes | No | No | Yes | Yes | 
| Stories | Yes | No | No | Yes | Yes | 
| Page User Demographics | Yes | No | No | Yes | Yes | 
| Page Video Views | Yes | No | No | Yes | Yes | 
| Page Views | Yes | No | No | Yes | Yes | 
| Page Video Posts | Yes | No | No | Yes | Yes | 
| Pages | No | Yes | No | Yes | No | 
| Feeds | Yes | Yes | No | Yes | Yes | 

**Example**:

```
facebookPageInsights_read = glueContext.create_dynamic_frame. from options(
    connection_type="facebookpageinsights",
    connection_options={
        "connectionName": "connectionName",
        "ENTITY_NAME": "entityName",
        "API_VERSION": "v21"
   }
```

**Facebook Page Insights field details**:

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

## Partitioning queries


**Filter-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-09-30T01:01:01.000Z"
  ```
+ `UPPER_BOUND`: an **exclusive** upper bound value of the chosen partition field.
+ `NUM_PARTITIONS`: the number of partitions.

Example:

```
facebookPageInsights_read = glueContext.create_dynamic_frame.from_options(
     connection_type="facebookpageinsights",
     connection_options={
         "connectionName": "connectionName",
         "ENTITY_NAME": "entityName",
         "API_VERSION": "v21",
         "PARTITION_FIELD": "created_Time"
         "LOWER_BOUND": "2024-10-27T07:00:00+0000"
         "UPPER_BOUND": "2024-10-27T07:00:00+0000"
         "NUM_PARTITIONS": "10"
     }
```