View a markdown version of this page

Scheduling data in the Connect Customer analytics data lake - Amazon Connect Customer

Scheduling data in the Connect Customer analytics data lake

This topic details the content in the Connect Customer data lake scheduling tables. The tables list the column, type, and description of the content.

There are two ways to access the analytics data lake and configure data to be shared:

If you are unable to access the scheduling tables by using Option 1, try using Option 2.

Staff scheduling profile

Table name: staff_scheduling_profile

Description: Contains agent scheduling configuration including staffing group assignment, shift profile or rotation pattern assignment, and scheduling validity window.

Primary key: instance_id, agent_arn, staff_scheduling_profile_version

Join keys:

  • instance_id — Joins to all tables

  • agent_arn — Joins to Agent Event, Contact Record, staff_shifts, staff_timeoffs, users (as user_arn)

  • staffing_group_arn — Joins to staffing_groups, staffing_group_forecast_groups, staffing_group_supervisors

  • shift_profile_arn — Joins to shift_profiles

  • shift_rotation_pattern_arn — Joins to shift_rotation_patterns

Column Type Description
instance_id string No The ID of the Connect Customer instance.
agent_arn string No The ARN of the Agent.
staff_scheduling_profile_version bigint No The Staff Scheduling Profile Version.
instance_arn string Yes The ARN of the Connect Customer instance.
staffing_group_arn string Yes The ARN of the Staffing Group to which the Agent is assigned.
start_timestamp Timestamp Yes StartTimestamp for the Agent configured in Staff Rules (schedules are generated only after this Timestamp).
end_timestamp Timestamp Yes EndTimestamp for the Agent configured in Staff Rules (schedules are not generated beyond this Timestamp).
shift_profile_arn string Yes The ARN of the Shift Profile assigned to the Agent in Staff Rules. Mutually exclusive with Shift Rotation Pattern.
shift_rotation_pattern_arn string Yes The ARN of the Shift Rotation Pattern assigned to the Agent in Staff Rules. Mutually exclusive with Shift Profile.
shift_rotation_start_step_id bigint Yes The step ID where the Agent begins in the assigned Shift Rotation Pattern.
timezone string Yes Timezone configured for the Agent.
is_deleted Boolean Yes Set to True if the Agent is deleted. Else set to False.
last_updated_timestamp Timestamp Yes Timestamp when the Staff Scheduling Profile was created/updated/deleted.
data_lake_last_processed_timestamp Timestamp Yes Timestamp, which shows the last time the record was touched by the data lake. This can include transformation and backfill. This field cannot reliably be used to determine data freshness.

Shift activities

Table name: shift_activities

Description: Defines the types of activities that can be assigned within shifts, including activity type (productive, non-productive, leave), adherence tracking, and paid status.

Primary key: instance_id, shift_activity_arn, shift_activity_version

Join keys:

  • instance_id — Joins to all tables

  • shift_activity_arn — Joins to staff_shift_activities, staff_timeoff_balance_changes, staff_timeoffs

Column Type Description
instance_id string No The ID of the Connect Customer instance.
shift_activity_arn string No The ARN of the Shift Activity.
shift_activity_version bigint No The Shift Activity Version.
instance_arn string Yes The ARN of the Connect Customer instance.
shift_activity_name string Yes Name of the Shift Activity.
type string Yes Type of the Shift Activity. The possible values are: PRODUCTIVE, NON_PRODUCTIVE, and LEAVE.
sub_type string Yes The sub-type of the Shift Activity. This is only valid for NON_PRODUCTIVE type activities. The possible values are: BREAK_OR_MEAL and NONE.
is_adherence_tracked Boolean Yes Set to True if the Shift Activity is configured for Adherence tracking. Else set to False.
is_paid Boolean Yes Set to True if the Shift Activity is configured as Paid. Else set to False.
is_deleted Boolean Yes Set to True if the Shift Activity is deleted. Else set to False.
last_updated_timestamp Timestamp Yes The Timestamp when the Shift Activity was created/updated/deleted.
data_lake_last_processed_timestamp Timestamp Yes The Timestamp, which shows the last time the record was touched by the data lake. This can include transformation and backfill. This field cannot be used to determine reliably data freshness.

Shift profiles

Table name: shift_profiles

Description: Defines shift profile templates that can be assigned to agents, specifying the shift pattern for schedule generation.

Primary key: instance_id, shift_profile_arn, shift_profile_version

Join keys:

  • instance_id — Joins to all tables

  • shift_profile_arn — Joins to staff_scheduling_profile, shift_rotation_steps

Column Type Description
instance_id string No The ID of the Connect Customer instance.
shift_profile_arn string No The ARN of the Shift Profile.
shift_profile_version bigint No The Shift Profile Version.
instance_arn string Yes The ARN of the Connect Customer instance.
shift_profile_name string Yes The name of the Shift Profile.
is_deleted Boolean Yes Set to True if the Shift Profile is deleted. Else set to False.
last_updated_timestamp Timestamp Yes The Timestamp when the Shift Profile was created/updated/deleted.
data_lake_last_processed_timestamp Timestamp Yes The Timestamp, which shows the last time the record was touched by the data lake. This can include transformation and backfill. This field cannot be used to determine reliably data freshness.

Staffing groups

Table name: staffing_groups

Description: Defines staffing groups that organize agents for scheduling purposes, serving as the primary organizational unit for workforce management.

Primary key: instance_id, staffing_group_arn, staffing_group_version

Join keys:

  • instance_id — Joins to all tables

  • staffing_group_arn — Joins to staff_scheduling_profile, staffing_group_forecast_groups, staffing_group_supervisors, staffing_group_demand_group

Column Type Description
instance_id string No The ID of the Connect Customer instance.
staffing_group_arn string No The ARN of the Staffing Group.
staffing_group_version bigint No The Staffing Group Version.
instance_arn string Yes The ARN of the Connect Customer instance.
staffing_group_name string Yes The name of the Staffing Group.
is_deleted Boolean Yes Set to True if the Staffing Group is deleted. Else set to False.
last_updated_timestamp Timestamp Yes The Timestamp when the Staffing Group was created/updated/deleted.
data_lake_last_processed_timestamp Timestamp Yes The Timestamp, which shows the last time the record was touched by the data lake. This can include transformation and backfill. This field cannot be used to determine reliably data freshness.

Staffing groups - Forecast groups

Table name: staffing_group_forecast_groups

Description: Maps the association between staffing groups and forecast groups, linking workforce capacity to demand forecasting.

Primary key: instance_id, staffing_group_arn, staffing_group_version, forecast_group_arn

Join keys:

  • instance_id — Joins to all tables

  • staffing_group_arn, staffing_group_version — Joins to staffing_groups

  • forecast_group_arn — Joins to schedule_metrics, schedule_goals, staff_shift_activity_allocations

Column Type Description
instance_id string No The ID of the Connect Customer instance.
staffing_group_arn string No The ARN of the Staffing Group.
staffing_group_version bigint No The Staffing Group Version.
forecast_group_arn string No The ARN of the Forecast Group associated to the Staffing Group.
instance_arn string Yes The ARN of the Connect Customer instance.
is_deleted Boolean Yes Set to False when the StaffingGroup-ForecastGroup association is valid.
last_updated_timestamp Timestamp Yes The Timestamp when the Staffing Group was created/updated.
data_lake_last_processed_timestamp Timestamp Yes The Timestamp, which shows the last time the record was touched by the data lake. This can include transformation and backfill. This field cannot be used to determine reliably data freshness.

Staffing groups - Supervisors

Table name: staffing_group_supervisors

Description: Maps supervisor associations to staffing groups, tracking which supervisors are responsible for each staffing group.

Primary key: instance_id, staffing_group_arn, staffing_group_version, supervisor_arn

Join keys:

  • instance_id — Joins to all tables

  • staffing_group_arn, staffing_group_version — Joins to staffing_groups

  • supervisor_arn — Joins to Agent Event (as agent_arn), Contact Record (as agent_arn)

Column Type Description
instance_id string No The ID of the Connect Customer instance.
staffing_group_arn string No The ARN of the Staffing Group.
staffing_group_version bigint No The Staffing Group Version.
supervisor_arn string No The Agent ARN of the Supervisor associated to the Staffing Group.
instance_arn string Yes The ARN of the Connect Customer instance.
is_deleted Boolean Yes Set to False when the StaffingGroup-ForecastGroup association is valid.
last_updated_timestamp Timestamp Yes The Timestamp when the Staffing Group was created/updated.
data_lake_last_processed_timestamp Timestamp Yes The Timestamp, which shows the last time the record was touched by the data lake. This can include transformation and backfill. This field cannot be used to determine reliably data freshness.

Staff shifts

Table name: staff_shifts

Description: Contains individual shift instances assigned to agents, including shift start and end times and creation metadata.

Primary key: instance_id, shift_id, shift_version

Join keys:

  • instance_id — Joins to all tables

  • shift_id, shift_version — Joins to staff_shift_activities, staff_shift_activity_allocations

  • agent_arn — Joins to staff_scheduling_profile, Agent Event, Contact Record, users (as user_arn)

Column Type Description
instance_id string No The ID of the Connect Customer instance.
shift_id string No The ID of the Shift.
shift_version bigint No The Shift Version.
instance_arn string Yes The ARN of the Connect Customer instance.
agent_arn string Yes The ARN of the Agent.
shift_start_timestamp Timestamp Yes The Timestamp when the Shift Starts.
shift_end_timestamp Timestamp Yes The Timestamp when the Shift Ends.
created_timestamp Timestamp Yes The Timestamp when the Shift was Created.
is_deleted Boolean Yes Set to True if the Shift is deleted. Else set to False.
last_updated_timestamp Timestamp Yes The Timestamp when the Shift was created/updated/deleted.
data_lake_last_processed_timestamp Timestamp Yes The Timestamp, which shows the last time the record was touched by the data lake. This can include transformation and backfill. This field cannot be used to determine reliably data freshness.

Staff shift activities

Table name: staff_shift_activities

Description: Contains individual activity blocks within a shift, including activity start and end times, overtime flags, and activity status.

Primary key: instance_id, shift_id, shift_version, activity_id

Join keys:

  • instance_id — Joins to all tables

  • shift_id, shift_version — Joins to staff_shifts

  • activity_id — Joins to staff_shift_activity_allocations

  • shift_activity_arn — Joins to shift_activities

Column Type Description
instance_id string No The ID of the Connect Customer instance.
shift_id string No The ID of the Shift.
shift_version bigint No The Shift Version.
activity_id string No The ID of the Activity.
instance_arn string Yes The ARN of the Connect Customer instance.
activity_start_timestamp Timestamp Yes The Timestamp when the activity starts.
activity_end_timestamp Timestamp Yes The Timestamp when the activity ends.
shift_activity_arn string Yes The ARN of the Shift Activity. If the shift_activity_arn is null, then it indicates 'Work' activity.
activity_status string Yes Status of the Activity. This is set to INACTIVE if the activity overlaps with a timeoff.
is_overtime Boolean Yes Set to True if the Activity is part of Overtime. Else set to False.
is_deleted Boolean Yes Set to False when the Shift Activities are valid.
last_updated_timestamp Timestamp Yes The Timestamp when the Shift was created/updated.
data_lake_last_processed_timestamp Timestamp Yes The Timestamp, which shows the last time the record was touched by the data lake. This can include transformation and backfill. This field cannot be used to determine reliably data freshness.

Staff timeoff balance changes

Table name: staff_timeoff_balance_changes

Description: Tracks time-off balance changes for agents, recording credits and deductions from various sources including uploads, requests, and schedule publishing.

Primary key: instance_id, agent_arn, shift_activity_arn, timeoff_balance_version

Partition key: last_created_timestamp (daily)

Join keys:

  • instance_id — Joins to all tables

  • agent_arn — Joins to staff_scheduling_profile, staff_shifts, Agent Event, Contact Record

  • shift_activity_arn — Joins to shift_activities

  • timeoff_id — Joins to staff_timeoffs

Column Type Description
instance_arn string Yes The ARN of the Connect Customer instance.
instance_id string No The ID of the Connect Customer instance.
account_id string Yes The ID of the AWS account.
agent_arn string No The ARN of the agent.
shift_activity_arn string No The ARN of the Shift Activity this balance is allocated to.
timeoff_balance_version bigint No The Time Off balance version, an incrementing number to denote order of changes.
balance_update_source string Yes Source of the balance update. The possible values are TIME_OFF_BALANCE_UPLOAD, CONNECT_TIME_OFF_REQUEST, SCHEDULE_PUBLISH, CSV_TIME_OFF_BALANCE_DELETION, TIME_OFF_BALANCE_BACKFILL, SYSTEM_UPDATE
timeoff_id string Yes The ID of the Time Off that caused this balance change, if one exists.
last_updated_by string Yes The ARN of the agent who caused this balance change, if one exists.
balance_change_in_hours double Yes Amount of Time Off balance updated through this change in hours. If this value is positive, this change is crediting Time Off balance. If this value is negative, this change is deducting Time Off balance. This value is undefined for any balance upload and deletion events.
remaining_balance_in_hours double Yes Remaining Time Off balance hours after this change event. This value is undefined for any balance deletion event.
last_created_timestamp Timestamp Yes The Timestamp when the Time Off balance change record was created.
data_lake_last_processed_timestamp Timestamp Yes The Timestamp, which shows the last time the record was touched by the data lake. This can include transformation and backfill. This field cannot be used to determine reliably data freshness.

Staff timeoffs

Table name: staff_timeoffs

Description: Records time-off requests and approvals for agents, including status tracking through the approval workflow and effective hours.

Primary key: instance_id, timeoff_id, agent_arn, timeoff_version

Join keys:

  • instance_id — Joins to all tables

  • timeoff_id, timeoff_version — Joins to staff_timeoff_intervals

  • agent_arn — Joins to staff_scheduling_profile, staff_shifts, Agent Event, Contact Record

  • shift_activity_arn — Joins to shift_activities

Column Type Description
instance_id string No The ID of the Connect Customer instance.
timeoff_id string No The ID of the Time Off.
agent_arn string No The ARN of the Agent.
timeoff_version bigint No The Time Off Version.
instance_arn string Yes The ARN of the Connect Customer instance.
timeoff_type string Yes Type of Time Off. The possible values are: TIME_OFF and VOLUNTARY_TIME_OFF.
timeoff_start_timestamp Timestamp Yes Timestamp when the Time Off starts.
timeoff_end_timestamp Timestamp Yes Timestamp when the Time Off ends.
timeoff_status string Yes Status of the Time Off. The possible values are: PENDING_CREATE, PENDING_UPDATE, PENDING_CANCEL, PENDING_ACCEPT, PENDING_APPROVE, PENDING_DECLINE, APPROVED, ACCEPTED, REJECTED, CANCELLED, WAITING_ACCEPT, and WAITING_APPROVE. The WAITING statuses indicate timeoff is waiting on User action. PENDING statuses indicate timeoff is waiting for system processing of a user action.
shift_activity_arn string Yes The ARN of the Shift Activity used for the Timeoff.
effective_timeoff_hours double Yes Total effective Time Off hours. Effective timeoff hours are calculated based on timeoff deduction logic. This is only set for TIME_OFF type.
last_updated_timestamp Timestamp Yes Timestamp when the Time Off was created/updated/deleted.
data_lake_last_processed_timestamp Timestamp Yes Timestamp, which shows the last time the record was touched by the data lake. This can include transformation and backfill. This field cannot reliably be used to determine data freshness.

Staff timeoff intervals

Table name: staff_timeoff_intervals

Description: Contains the individual time intervals within a time-off request, breaking multi-day or multi-period time-off into discrete intervals with effective hours per interval.

Primary key: instance_id, timeoff_id, timeoff_version, interval_id

Join keys:

  • instance_id — Joins to all tables

  • timeoff_id, timeoff_version — Joins to staff_timeoffs

Column Type Description
instance_id string No The ID of the Connect Customer instance.
timeoff_id string No The ID of the Time Off.
timeoff_version bigint No The Time Off Version.
interval_id string No The ID of the Time Off Interval.
instance_arn string Yes The ARN of the Connect Customer instance.
timeoff_interval_start_timestamp Timestamp Yes Timestamp when the specific interval of Time Off starts.
timeoff_interval_end_timestamp Timestamp Yes Timestamp when the specific interval of Time Off ends.
interval_effective_timeoff_hours double Yes Effective Time Off hours for this specific interval of Time Off. Effective timeoff hours are calculated based on timeoff deduction logic.
last_updated_timestamp Timestamp Yes Timestamp when the Time Off was created/updated/deleted.
data_lake_last_processed_timestamp Timestamp Yes Timestamp, which shows the last time the record was touched by the data lake. This can include transformation and backfill. This field cannot reliably be used to determine data freshness.

Staff demand group

Table name: staff_demand_group

Description: Maps agents to demand groups with priority assignments, supporting both staffing group-level defaults and agent-level overrides for demand allocation.

Primary key: instance_id, agent_arn, demand_group_arn, staff_demand_group_version

Join keys:

  • instance_id — Joins to all tables

  • agent_arn — Joins to staff_scheduling_profile, staff_shifts, Agent Event, Contact Record

  • demand_group_arn — Joins to staffing_group_demand_group, staff_shift_activity_allocations

Column Type Description
instance_id string No The ID of the Connect Customer instance.
agent_arn string No The ARN of the agent.
demand_group_arn string No The ARN of the demand group.
staff_demand_group_version Long No Version for this agent to demand group association
priority string Yes Priority of the demand group for this agent. Can be LOW, MEDIUM or HIGH
instance_arn string Yes The ARN of the Connect Customer instance.
is_override Boolean Yes Set to 'true' if this is Agent to Demand Group association is Agent level override.
is_deleted Boolean Yes Set to true if agent to demand group association is deleted.
last_updated_timestamp Timestamp Yes The Timestamp when the agent to demand group association was created/updated.
data_lake_last_processed_timestamp Timestamp Yes The Timestamp, which shows the last time the record was touched by the data lake. This can include transformation and backfill. This field cannot be used to determine reliably data freshness.

Staffing groups demand group

Table name: staffing_group_demand_group

Description: Maps the association between staffing groups and demand groups with priority, linking organizational units to demand allocation targets.

Primary key: instance_id, staffing_group_arn, demand_group_arn, staffing_group_demand_group_version

Join keys:

  • instance_id — Joins to all tables

  • staffing_group_arn — Joins to staffing_groups, staff_scheduling_profile

  • demand_group_arn — Joins to staff_demand_group, staff_shift_activity_allocations

Column Type Description
instance_id string No The ID of the Connect Customer instance.
staffing_group_arn string No The ARN of the Staffing Group.
demand_group_arn string No The ARN of the demand group.
staffing_group_demand_group_version Long No Version for this Staffing Group to Demand Group association
priority string Yes Priority of the Demand Group for this Staffing Group. Can be LOW, MEDIUM or HIGH
instance_arn string Yes The ARN of the Connect Customer instance.
is_deleted Boolean Yes Set to true if the staffing group to demand group association is deleted.
last_updated_timestamp Timestamp Yes Timestamp when the staffing group to demand group association was created/updated/deleted.
data_lake_last_processed_timestamp Timestamp Yes The Timestamp, which shows the last time the record was touched by the data lake. This can include transformation and backfill. This field cannot be used to determine reliably data freshness.

Staff shift activity allocation

Table name: staff_shift_activity_allocations

Description: Records the percentage allocation of shift activities to demand groups, enabling proportional assignment of agent capacity across multiple demand groups within a single activity.

Primary key: instance_id, shift_id, shift_version, activity_id, demand_group_arn

Join keys:

  • instance_id — Joins to all tables

  • shift_id, shift_version — Joins to staff_shifts, staff_shift_activities

  • activity_id — Joins to staff_shift_activities

  • demand_group_arn — Joins to staff_demand_group, staffing_group_demand_group

  • foecast_group_arn — Joins to staffing_group_forecast_groups (as forecast_group_arn)

Column Type Description
instance_id string No The ID of the Connect Customer instance.
shift_id string No The ID of the shift.
shift_version Long The Shift Version.
activity_id string No The ID of the activity.
demand_group_arn string No The ARN of the demand group.
foecast_group_arn string Yes The ARN of the forecast group.
allocation_percentage double Yes Percentage allocation of the Activity to the Demand Group.
is_deleted Boolean Yes Set to False when the StaffingGroup-ForecastGroupassociation is valid.
last_updated_timestamp Timestamp Yes The Timestamp when the Staffing Group was created/updated.
data_lake_last_processed_timestamp Timestamp Yes The Timestamp, which shows the last time the record was touched by the data lake. This can include transformation and backfill. This field cannot be used to determine reliably data freshness.

Schedule metrics

Table name: schedule_metrics

Description: Contains schedule performance metrics by interval, including required versus scheduled agent counts, occupancy, service level percentage, and average speed of answer.

Primary key: instance_id, metric_id, interval_start_timestamp

Join keys:

  • instance_id — Joins to all tables

  • entity_arn — Joins to staffing_group_forecast_groups (as forecast_group_arn), staff_demand_group (as demand_group_arn)

Column Type Description
instance_id string No The ARN of the Amazon Connect instance.
instance_arn string Yes The ID of the Amazon Connect instance.
metric_id string No Unique identifier for the metric value
aws_account_id string Yes The ID of the AWS account.
entity_type string Yes Denotes whether the metric is for a forecast group or demand group.
entity_arn string Yes Arn of the forecast group or demand group
channel string Yes Denotes the media channel like Voice, chat. If the row contains metrics that are not channel level, then it's populated as ALL
interval_start_timestamp timestamp No Timestamp denoting the start of the interval
required_agent_count float Yes Denotes the forecasted agents count
scheduled_agent_count float Yes Denotes the schedule agents count
scheduled_occupancy float Yes Denotes the occupancy percentage
scheduled_service_level_percentage float Yes Denotes the schedule service level percentage
service_level_seconds integer Yes Denotes the service level seconds
scheduled_average_speed_of_answer float Yes Denotes the average speed of answer
is_deleted boolean Yes Denotes whether the metric is deleted
last_updated_timestamp timestamp Yes The Timestamp when the metric record was created.
data_lake_last_processed_timestamp timestamp Yes Timestamp, which shows the last time the data lake processed the record. This can include transformation and backfill. This field cannot reliably be used to determine data freshness.

Schedule goals

Table name: schedule_goals

Description: Stores service level goals for scheduling, including target service level percentage, service level seconds, and average speed of answer for forecast or demand groups.

Primary key: instance_id, goal_id

Join keys:

  • instance_id — Joins to all tables

  • entity_arn — Joins to staffing_group_forecast_groups (as forecast_group_arn), staff_demand_group (as demand_group_arn)

Column Type Description
instance_id string No The ARN of the Amazon Connect instance.
instance_arn string Yes The ID of the Amazon Connect instance.
goal_id string No Unique identifier for the goal value
aws_account_id string Yes The ID of the AWS account.
entity_type string Yes Denotes whether the goal is for a forecast group or demand group.
entity_arn string Yes Arn of the forecast group or demand group
channel string Yes Denotes the media channel like Voice, chat.
start_date_timestamp timestamp Yes Timestamp denoting start of the goal
end_date_timestamp timestamp Yes Timestamp denoting end of the goal
goal_service_level_percentage float Yes Denotes the goal service level percentage
goal_service_level_seconds integer Yes Denotes the service level seconds
goal_average_speed_of_answer float Yes Denotes the average speed of answer
is_deleted boolean Yes Denotes whether the goal is deleted
last_updated_timestamp timestamp Yes The Timestamp when the goals record was created.
data_lake_last_processed_timestamp timestamp Yes Timestamp, which shows the last time the data lake processed the record. This can include transformation and backfill. This field cannot reliably be used to determine data freshness.

Shift rotation patterns

Table name: shift_rotation_patterns

Description: Defines shift rotation pattern configurations that cycle agents through different shift profiles over time, with a configurable start date.

Primary key: instance_id, shift_rotation_pattern_arn, shift_rotation_pattern_version

Join keys:

  • instance_id — Joins to all tables

  • shift_rotation_pattern_arn, shift_rotation_pattern_version — Joins to shift_rotation_steps

  • shift_rotation_pattern_arn — Joins to staff_scheduling_profile

Column Type Description
instance_id string No The ID of the Connect Customer instance.
shift_rotation_pattern_arn string No The ARN of the Shift Rotation Pattern.
shift_rotation_pattern_version bigint No The Shift Rotation Pattern Version.
instance_arn string Yes The ARN of the Connect Customer instance.
shift_rotation_pattern_name string Yes The name of the Shift Rotation Pattern.
start_date string Yes The start date of the Shift Rotation Pattern in yyyy-mm-dd format.
is_deleted Boolean Yes Set to True if the Shift Rotation Pattern is deleted. Else set to False.
last_updated_by string Yes The ARN of the user who created/updated/deleted the Shift Rotation Pattern.
last_updated_timestamp Timestamp Yes The Timestamp when the Shift Rotation Pattern was created/updated/deleted.
data_lake_last_processed_timestamp Timestamp Yes The Timestamp, which shows the last time the record was touched by the data lake. This can include transformation and backfill. This field cannot reliably be used to determine data freshness.

Shift rotation steps

Table name: shift_rotation_steps

Description: Defines the individual steps within a shift rotation pattern, each associating a shift profile with a duration in weeks (up to 52 steps per rotation).

Primary key: instance_id, shift_rotation_pattern_arn, shift_rotation_pattern_version, step_id

Join keys:

  • instance_id — Joins to all tables

  • shift_rotation_pattern_arn, shift_rotation_pattern_version — Joins to shift_rotation_patterns

  • shift_profile_arn — Joins to shift_profiles

Column Type Description
instance_id string No The ID of the Connect Customer instance.
shift_rotation_pattern_arn string No The ARN of the Shift Rotation Pattern.
shift_rotation_pattern_version bigint No The Shift Rotation Pattern Version.
step_id bigint No The ID of the step within the Shift Rotation Pattern. Steps are numbered sequentially (1, 2, 3, ... up to 52).
instance_arn string Yes The ARN of the Connect Customer instance.
shift_profile_arn string Yes The ARN of the Shift Profile associated with the rotation step.
duration bigint Yes The duration of the rotation step in weeks.
is_deleted Boolean Yes Set to False when the Shift Rotation Step is valid.
last_updated_by string Yes The ARN of the user who created/updated the Shift Rotation Pattern.
last_updated_timestamp Timestamp Yes The Timestamp when the Shift Rotation Pattern was created/updated.
data_lake_last_processed_timestamp Timestamp Yes The Timestamp, which shows the last time the record was touched by the data lake. This can include transformation and backfill. This field cannot reliably be used to determine data freshness.

Data schema

Following is an entity relationship diagram that shows the structure and relationships between scheduling tables in the Connect Customer data lake.

Each table displays its primary keys and attributes with their data types. The diagram illustrates how these tables relate to each other through foreign key relationships, providing a comprehensive view of the scheduling data model.

An entity relationship diagram that shows the structure and relationships between scheduling tables.

Sample queries

1. Query to get all the Scheduled Shift Activities of the Agents working on a specific Forecast Group

SELECT * FROM agent_scheduled_shift_activities_view where forecast_group_name = 'AnyDepartmentForecastGroup'

Complete the following steps to create agent_scheduled_shift_activities_view mentioned above.

Step 1: Create a view to get supervisor names

CREATE OR REPLACE VIEW "latest_supervisor_names_view" AS SELECT   staffing_group_arn , array_agg(supervisor_name ORDER BY supervisor_name ASC) supervisor_names FROM   (    SELECT      s.staffing_group_arn    , CONCAT(u.first_name, ' ', u.last_name) supervisor_name    FROM      ((       SELECT         staffing_group_arn       , supervisor_arn       FROM         (          SELECT            *          , RANK() OVER (PARTITION BY staffing_group_arn ORDER BY staffing_group_version DESC) recency          FROM            staffing_group_supervisors          WHERE (instance_id = 'YourAmazonConnectInstanceId')       )  t       WHERE (recency = 1)    )  s    INNER JOIN USERS u ON (s.supervisor_arn = u.user_arn)) ) GROUP BY staffing_group_arn

Step 2: Create a view to get the staffing group and forecast group associated with an agent

CREATE OR REPLACE VIEW "latest_agent_staffing_group_forecast_group_view" AS WITH   latest_staff_scheduling_profile AS (    SELECT      agent_arn    , staffing_group_arn    , last_updated_timestamp    FROM      (       SELECT         *       , RANK() OVER (PARTITION BY agent_arn ORDER BY staff_scheduling_profile_version DESC) recency       FROM         staff_scheduling_profile       WHERE ((instance_id = 'YourAmazonConnectInstanceId') AND (is_deleted = false))    )  t    WHERE (recency = 1) ) , latest_staffing_groups AS (    SELECT      staffing_group_name    , staffing_group_arn    FROM      (       SELECT         *       , RANK() OVER (PARTITION BY staffing_group_arn ORDER BY staffing_group_version DESC) recency       FROM         staffing_groups       WHERE (instance_id = 'YourAmazonConnectInstanceId')    )  t    WHERE (recency = 1) ) , latest_forecast_groups AS (    SELECT      forecast_group_arn    , forecast_group_name    FROM      (       SELECT         *       , RANK() OVER (PARTITION BY forecast_group_arn ORDER BY forecast_group_version DESC) recency       FROM         forecast_groups       WHERE (instance_id = 'YourAmazonConnectInstanceId')    )  t    WHERE (recency = 1) ) , latest_staffing_group_forecast_groups AS (    SELECT      staffing_group_arn    , forecast_group_arn    FROM      (       SELECT         *       , RANK() OVER (PARTITION BY staffing_group_arn ORDER BY staffing_group_version DESC) recency       FROM         staffing_group_forecast_groups       WHERE (instance_id = 'YourAmazonConnectInstanceId')    )  t    WHERE (recency = 1) ) SELECT   ssp.agent_arn , U.agent_username AS username , U.agent_routing_profile_id AS routing_profile_id , CONCAT(u.first_name, ' ', u.last_name) agent_name , fg.forecast_group_arn , fg.forecast_group_name , sg.staffing_group_arn , sg.staffing_group_name FROM  latest_staff_scheduling_profile ssp INNER JOIN latest_staffing_groups sg ON ssp.staffing_group_arn = sg.staffing_group_arn INNER JOIN latest_staffing_group_forecast_groups sgfg ON ssp.staffing_group_arn = sgfg.staffing_group_arn INNER JOIN latest_forecast_groups fg ON fg.forecast_group_arn = sgfg.forecast_group_arn INNER JOIN USERS u ON ssp.agent_arn = u.user_arn

Step 3: Get the latest Shift activities 

CREATE OR REPLACE VIEW "latest_shift_activities_view" AS SELECT   shift_activity_arn , shift_activity_name , shift_activity_version , type , sub_type , is_adherence_tracked , is_paid , last_updated_timestamp FROM   (    SELECT      *    , RANK() OVER (PARTITION BY shift_activity_arn ORDER BY shift_activity_version DESC) recency    FROM      shift_activities    WHERE (instance_id = 'YourAmazonConnectInstanceId') )  t WHERE (recency = 1)

Step 4: Create a view to get the agent scheduled shift activities

CREATE OR REPLACE VIEW "agent_scheduled_shift_activities_view" AS WITH   latest_staff_shifts AS (    SELECT      agent_arn    , shift_id    , shift_version    , shift_start_timestamp    , shift_end_timestamp    , created_timestamp    , last_updated_timestamp    , data_lake_last_processed_timestamp    , recency    FROM      (       SELECT         RANK() OVER (PARTITION BY shift_id ORDER BY shift_version DESC) recency       , *       FROM         staff_shifts sa       WHERE (instance_id = 'YourAmazonConnectInstanceId')    )  t    WHERE ((recency = 1) AND (is_deleted = false)) ) SELECT   asgfg.forecast_group_name , array_join(sn.supervisor_names, ',') supervisor_names , s.agent_arn , u.first_name , u.last_name , asgfg.staffing_group_name , ssa.activity_id , (CASE WHEN (ssa.shift_activity_arn IS NULL) THEN COALESCE(sa.shift_activity_name, 'Work') ELSE sa.shift_activity_name END) shift_activity_name , s.shift_start_timestamp , s.shift_end_timestamp , (CASE WHEN (ssa.shift_activity_arn IS NULL) THEN COALESCE(sa.type, 'PRODUCTIVE') ELSE sa.type END) type , (CASE WHEN (ssa.shift_activity_arn IS NULL) THEN COALESCE(sa.is_paid, true) ELSE sa.is_paid END) is_paid , ssa.activity_start_timestamp , ssa.activity_end_timestamp , ssa.last_updated_timestamp , ssa.data_lake_last_processed_timestamp , u.agent_username as username , u.agent_routing_profile_id as routing_profile_id FROM   staff_shift_activities ssa INNER JOIN latest_staff_shifts s ON s.shift_id = ssa.shift_id AND s.shift_version = ssa.shift_version INNER JOIN USERS u ON s.agent_arn = u.user_arn INNER JOIN latest_agent_staffing_group_forecast_group_view asgfg ON s.agent_arn = asgfg.agent_arn LEFT JOIN latest_shift_activities_view sa ON sa.shift_activity_arn = ssa.shift_activity_arn INNER JOIN latest_supervisor_names_view sn ON sn.staffing_group_arn = asgfg.staffing_group_arn WHERE (ssa.is_deleted = false) AND (COALESCE(ssa.activity_status, ' ') <> 'INACTIVE') AND (ssa.instance_id = 'YourAmazonConnectInstanceId')

2. Query to get all the time off requests of the Agents in a specific Forecast Group

SELECT * FROM agent_timeoff_report_view where forecast_group_name = 'AnyDepartmentForecastGroup'

Use the following query to create agent_timeoff_report_view mentioned above.

CREATE OR REPLACE VIEW "agent_timeoff_report_view" AS WITH latest_staff_timeoffs AS (         SELECT t1.*,             CAST((t1.effective_timeoff_hours * 60) AS INT) total_effective_timeoff_minutes         FROM (                 SELECT RANK() OVER (                         PARTITION BY timeoff_id                         ORDER BY timeoff_version DESC                     ) recency,                     agent_arn,                     timeoff_id,                     shift_activity_arn,                     timeoff_status,                     timeoff_version,                     effective_timeoff_hours,                     timeoff_start_timestamp,                     timeoff_end_timestamp,                     last_updated_timestamp,                     data_lake_last_processed_timestamp                 FROM staff_timeoffs                 WHERE (                         instance_id = 'YourAmazonConnectInstanceId'                     )             ) t1         WHERE (recency = 1)     ) SELECT asgfg.forecast_group_name,     to.agent_arn,     asgfg.agent_name,     asgfg.staffing_group_name,     asgfg.username,     sa.shift_activity_name,     to.timeoff_start_timestamp,     to.timeoff_end_timestamp,     to.timeoff_status,     array_join(sn.supervisor_names, ',') AS supervisor_names,     sa.is_paid,     to.last_updated_timestamp,     to.data_lake_last_processed_timestamp,     u.agent_routing_profile_id AS routing_profile_id,     to.timeoff_id,     to.shift_activity_arn,     to.total_effective_timeoff_minutes FROM latest_staff_timeoffs to     INNER JOIN latest_agent_staffing_group_forecast_group_view asgfg ON asgfg.agent_arn = to.agent_arn     INNER JOIN latest_shift_activities_view sa ON sa.shift_activity_arn = to.shift_activity_arn     INNER JOIN latest_supervisor_names_view sn ON sn.staffing_group_arn = asgfg.staffing_group_arn     INNER JOIN users u ON u.user_arn = to.agent_arn