Use line magics - Amazon Athena
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Use line magics

Magics that are on a single line are preceded by a percent sign (%) and are called line magic functions or line magics.

%help

Displays descriptions of the available magic commands.

Using %help.

%list_sessions

Lists the sessions associated with the notebook. The information for each session includes the session ID, session status, and the date and time that the session started and ended.

Using %list_sessions.

%session_id

Retrieves the current session ID.

Using session_id.

%set_log_level

Sets or resets the logger to use the specified log level. Possible values are DEBUG, ERROR, FATAL,INFO, and WARN or WARNING. Values must be uppercase and must not be enclosed in single or double quotes.

Using %set_log_level.

%status

Describes the current session. The output includes the session ID, session state, workgroup name, PySpark engine version, and session start time. This magic command requires an active session to retrieve session details.

Following are the possible values for status:

CREATING – The session is being started, including acquiring resources.

CREATED – The session has been started.

IDLE – The session is able to accept a calculation.

BUSY – The session is processing another task and is unable to accept a calculation.

TERMINATING – The session is in the process of shutting down.

TERMINATED – The session and its resources are no longer running.

DEGRADED – The session has no healthy coordinators.

FAILED – Due to a failure, the session and its resources are no longer running.

Using %status.