View a markdown version of this page

sessions - AWS Glue

sessions

The sessions system table contains one row for each AWS Glue interactive session in your account and Region, for sessions running AWS Glue version 6.1 or later.

AWS Glue writes a row when a session reaches a terminal state. AWS Glue does not write data while a session is in progress.

Table location

You query system tables like any other Amazon S3 Tables. The following SQL query returns 10 sample rows from the sessions table:

SELECT * FROM "s3tablescatalog/aws-glue"."metadata"."sessions" LIMIT 10

Columns

The following table describes the columns in the sessions system table.

Column

Type

Description

session_id

string

The identifier that AWS Glue assigned to this interactive session.

account_id

string

The AWS account that owns the session.

region_name

string

The AWS Region where the session ran.

platform_enum

string

The platform that ran the session. Always glue.

session_type_enum

string

The kind of session. Valid values are LIVY and SPARK_CONNECT.

engine_enum

string

The processing engine that ran the session. Valid values are SPARK and RAY.

release_label

string

The AWS Glue version the session used, for example glue-6.1.

idle_timeout_minutes

long

How long the session can stay idle before AWS Glue stops it, in minutes.

session_config_json

string

The session's default arguments as JSON, with secrets redacted.

worker_count

int

The number of workers allocated to the session. Null for capacity-based sessions.

worker_type_enum

string

The worker type the session used, for example G.1X.

dpu_seconds

double

The Data Processing Unit (DPU)-seconds the session consumed over its lifetime.

submitter_arn

string

The Amazon Resource Name (ARN) of the IAM principal that called CreateSession.

execution_role_arn

string

The ARN of the IAM role the session used.

on_behalf_of_subject

string

The identifier of the end user the session acted for under trusted identity propagation, as propagated by the identity provider (for example, an email address). Null when trusted identity propagation is off.

on_behalf_of_issuer

string

The identity provider that issued the end user's identity. Null when not propagated.

final_state_enum

string

The session's final state, as AWS Glue reports it in the console and API.

error_message

string

The error message for a session that failed. Null otherwise.

start_time

timestamp with time zone

When the session started.

end_time

timestamp with time zone

When the session reached its final state. This is a partition column (by day).

schema_version

string

The version identifier for this row's field set.

ingest_time

timestamp with time zone

When this row was written to the table.

Example queries

The following examples show common queries against the sessions table.

Sessions by type and final state in the past 7 days

The following SQL query shows sessions by type and final state in the past 7 days:

SELECT session_type_enum, final_state_enum, COUNT(*) AS sessions, SUM(dpu_seconds) / 3600.0 AS dpu_hours FROM "s3tablescatalog/aws-glue"."metadata"."sessions" WHERE end_time >= CURRENT_TIMESTAMP - INTERVAL '7' DAY GROUP BY session_type_enum, final_state_enum

Who uses the most session DPU

The following SQL query shows who uses the most session DPU-seconds in the past 30 days:

SELECT submitter_arn, COUNT(*) AS sessions, SUM(dpu_seconds) / 3600.0 AS dpu_hours FROM "s3tablescatalog/aws-glue"."metadata"."sessions" WHERE end_time >= CURRENT_TIMESTAMP - INTERVAL '30' DAY GROUP BY submitter_arn ORDER BY dpu_hours DESC

Sessions that timed out, and their idle timeout

The following SQL query shows sessions that timed out and their idle timeout in the past 7 days:

SELECT session_id, submitter_arn, idle_timeout_minutes, start_time, end_time FROM "s3tablescatalog/aws-glue"."metadata"."sessions" WHERE end_time >= CURRENT_TIMESTAMP - INTERVAL '7' DAY AND final_state_enum = 'TIMEOUT'