Skip to main content

sessions

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

Overview

Namesessions
TypeResource
Idaws.athena.sessions

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
descriptionstringThe session description.
engine_configurationobjectThe engine configuration for the workgroup, which includes the minimum/maximum number of Data Processing Units (DPU) that queries should use when running in provisioned capacity. If not specified, Athena uses default values (Default value for min is 4 and for max is Minimum of 124 and allocated DPUs). To specify DPU values for PC queries the WG containing EngineConfiguration should have the following values: The name of the Classifications should be athena-query-engine-properties, with the only allowed properties as max-dpu-count and min-dpu-count.
engine_versionstringThe engine version used by the session (for example, PySpark engine version 3). You can get a list of engine versions by calling ListEngineVersions.
monitoring_configurationobjectContains the configuration settings for managed log persistence, delivering logs to Amazon S3 buckets, Amazon CloudWatch log groups etc.
notebook_versionstringThe notebook version.
session_configurationobjectContains the workgroup configuration information used by the session.
session_idstringThe session ID.
statisticsobjectContains the DPU execution time.
statusobjectContains information about the status of the session.
work_groupstringThe workgroup to which the session belongs. (pattern: <code>[a-zA-Z0-9._-]{1,128}</code>)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_sessionselectregionGets the full details of a previously created session, including the session status and configuration.
list_sessionsselectregionLists the sessions in a workgroup that are in an active state like CREATING, CREATED, IDLE, or BUSY. Newer sessions are listed first; older sessions are listed later.
create_presigned_notebook_urlinsertregion, SessionIdGets an authentication token and the URL at which the notebook can be accessed. During programmatic access, CreatePresignedNotebookUrl must be called every 10 minutes to refresh the authentication token. For information about granting programmatic access, see Grant programmatic access.
terminate_sessiondeleteregionTerminates an active session. A TerminateSession call on a session that is already inactive (for example, in a FAILED, TERMINATED or TERMINATING state) succeeds but has no effect. Calculations running in the session when TerminateSession is called are forcefully stopped, but may display as FAILED instead of STOPPED.

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

Gets the full details of a previously created session, including the session status and configuration.

SELECT
description,
engine_configuration,
engine_version,
monitoring_configuration,
notebook_version,
session_configuration,
session_id,
statistics,
status,
work_group
FROM aws.athena.sessions
WHERE region = '{{ region }}' -- required
;

INSERT examples

Gets an authentication token and the URL at which the notebook can be accessed. During programmatic access, CreatePresignedNotebookUrl must be called every 10 minutes to refresh the authentication token. For information about granting programmatic access, see Grant programmatic access.

INSERT INTO aws.athena.sessions (
SessionId,
region
)
SELECT
'{{ SessionId }}' /* required */,
'{{ region }}'
RETURNING
auth_token,
auth_token_expiration_time,
notebook_url
;

DELETE examples

Terminates an active session. A TerminateSession call on a session that is already inactive (for example, in a FAILED, TERMINATED or TERMINATING state) succeeds but has no effect. Calculations running in the session when TerminateSession is called are forcefully stopped, but may display as FAILED instead of STOPPED.

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