Skip to main content

sessions

Creates, updates, deletes, gets or lists a sessions resource.

Overview

Namesessions
TypeResource
Idaws.glue.sessions

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
commandobjectThe command object.See SessionCommand.
completed_onstring (date-time)The date and time that this session is completed.
connectionsobjectThe number of connections used for the session.
created_onstring (date-time)The time and date when the session was created.
dpu_secondsnumber (double)The DPUs consumed by the session (formula: ExecutionTime * MaxCapacity).
default_argumentsobjectA map array of key-value pairs. Max is 75 pairs.
descriptionstringThe description of the session. (pattern: <code>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*</code>)
error_messagestringThe error message displayed during the session. (pattern: <code>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*</code>)
execution_timenumber (double)The total time the session ran for.
glue_versionstringThe Glue version determines the versions of Apache Spark and Python that Glue supports. The GlueVersion must be greater than 2.0. (pattern: <code>^(\w+.)+\w+$</code>)
idstringThe ID of the session. (pattern: <code>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\t]*</code>)
idle_timeoutintegerThe number of minutes when idle before the session times out.
max_capacitynumber (double)The number of Glue data processing units (DPUs) that can be allocated when the job runs. A DPU is a relative measure of processing power that consists of 4 vCPUs of compute capacity and 16 GB memory.
number_of_workersintegerThe number of workers of a defined WorkerType to use for the session.
profile_namestringThe name of an Glue usage profile associated with the session. (pattern: <code>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\t]*</code>)
progressnumber (double)The code execution progress of the session.
rolestringThe name or Amazon Resource Name (ARN) of the IAM role associated with the Session. (pattern: <code>arn:aws[^:]:iam::[0-9]:role/.+</code>)
security_configurationstringThe name of the SecurityConfiguration structure to be used with the session. (pattern: <code>[\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\t]*</code>)
session_typestringThe type of the session. (LIVY, SPARK_CONNECT)
statusstringThe session status. (PROVISIONING, READY, FAILED, TIMEOUT, STOPPING, STOPPED)
worker_typestringThe type of predefined worker that is allocated when a session runs. Accepts a value of G.1X, G.2X, G.4X, or G.8X for Spark sessions. Accepts the value Z.2X for Ray sessions. (Standard, G.1X, G.2X, G.025X, G.4X, G.8X, Z.2X)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_sessionselectregionRetrieves the session.
create_sessioninsertregion, Role, CommandCreates a new session.
delete_sessiondeleteregionDeletes the session.
cancel_statementexecregion, SessionIdCancels the statement.
list_sessionsexecregionRetrieve a list of sessions.
run_statementexecregion, SessionId, CodeExecutes the statement.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Retrieves the session.

SELECT
command,
completed_on,
connections,
created_on,
dpu_seconds,
default_arguments,
description,
error_message,
execution_time,
glue_version,
id,
idle_timeout,
max_capacity,
number_of_workers,
profile_name,
progress,
role,
security_configuration,
session_type,
status,
worker_type
FROM aws.glue.sessions
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates a new session.

INSERT INTO aws.glue.sessions (
Id,
Description,
Role,
Command,
Timeout,
IdleTimeout,
DefaultArguments,
Connections,
MaxCapacity,
NumberOfWorkers,
WorkerType,
SecurityConfiguration,
GlueVersion,
Tags,
RequestOrigin,
SessionType,
region
)
SELECT
'{{ Id }}',
'{{ Description }}',
'{{ Role }}' /* required */,
'{{ Command }}' /* required */,
{{ Timeout }},
{{ IdleTimeout }},
'{{ DefaultArguments }}',
'{{ Connections }}',
{{ MaxCapacity }},
{{ NumberOfWorkers }},
'{{ WorkerType }}',
'{{ SecurityConfiguration }}',
'{{ GlueVersion }}',
'{{ Tags }}',
'{{ RequestOrigin }}',
'{{ SessionType }}',
'{{ region }}'
RETURNING
session
;

DELETE examples

Deletes the session.

DELETE FROM aws.glue.sessions
WHERE region = '{{ region }}' --required
;

Lifecycle Methods

Cancels the statement.

EXEC aws.glue.sessions.cancel_statement
@region='{{ region }}' --required
@@json=
'{
"SessionId": "{{ SessionId }}",
"Id": {{ Id }},
"RequestOrigin": "{{ RequestOrigin }}"
}'
;