SparkSessionOperations Class

SparkSessionOperations async operations.

You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute.

Inheritance
builtins.object
SparkSessionOperations

Constructor

SparkSessionOperations(client, config, serializer, deserializer)

Parameters

Name Description
client
Required

Client for service requests.

config
Required

Configuration of service client.

serializer
Required

An object model serializer.

deserializer
Required

An object model deserializer.

Variables

Name Description
models

Alias to model classes used in this operation group.

Methods

cancel_spark_session

Cancels a running spark session.

cancel_spark_statement

Kill a statement within a session.

create_spark_session

Create new spark session.

create_spark_statement

Create statement within a spark session.

get_spark_session

Gets a single spark session.

get_spark_sessions

List all spark sessions which are running under a particular spark pool.

get_spark_statement

Gets a single statement within a spark session.

get_spark_statements

Gets a list of statements within a spark session.

reset_spark_session_timeout

Sends a keep alive call to the current session to reset the session timeout.

cancel_spark_session

Cancels a running spark session.

async cancel_spark_session(session_id: int, **kwargs: Any) -> None

Parameters

Name Description
session_id
Required
int

Identifier for the session.

Keyword-Only Parameters

Name Description
cls

A custom type or function that will be passed the direct response

Returns

Type Description

None, or the result of cls(response)

Exceptions

Type Description

cancel_spark_statement

Kill a statement within a session.

async cancel_spark_statement(session_id: int, statement_id: int, **kwargs: Any) -> SparkStatementCancellationResult

Parameters

Name Description
session_id
Required
int

Identifier for the session.

statement_id
Required
int

Identifier for the statement.

Keyword-Only Parameters

Name Description
cls

A custom type or function that will be passed the direct response

Returns

Type Description

SparkStatementCancellationResult, or the result of cls(response)

Exceptions

Type Description

create_spark_session

Create new spark session.

async create_spark_session(spark_session_options: SparkSessionOptions, detailed: bool | None = None, **kwargs: Any) -> SparkSession

Parameters

Name Description
spark_session_options
Required

Livy compatible batch job request payload.

detailed

Optional query param specifying whether detailed response is returned beyond plain livy.

default value: None

Keyword-Only Parameters

Name Description
cls

A custom type or function that will be passed the direct response

Returns

Type Description

SparkSession, or the result of cls(response)

Exceptions

Type Description

create_spark_statement

Create statement within a spark session.

async create_spark_statement(session_id: int, spark_statement_options: SparkStatementOptions, **kwargs: Any) -> SparkStatement

Parameters

Name Description
session_id
Required
int

Identifier for the session.

spark_statement_options
Required

Livy compatible batch job request payload.

Keyword-Only Parameters

Name Description
cls

A custom type or function that will be passed the direct response

Returns

Type Description

SparkStatement, or the result of cls(response)

Exceptions

Type Description

get_spark_session

Gets a single spark session.

async get_spark_session(session_id: int, detailed: bool | None = None, **kwargs: Any) -> SparkSession

Parameters

Name Description
session_id
Required
int

Identifier for the session.

detailed

Optional query param specifying whether detailed response is returned beyond plain livy.

default value: None

Keyword-Only Parameters

Name Description
cls

A custom type or function that will be passed the direct response

Returns

Type Description

SparkSession, or the result of cls(response)

Exceptions

Type Description

get_spark_sessions

List all spark sessions which are running under a particular spark pool.

async get_spark_sessions(from_parameter: int | None = None, size: int | None = None, detailed: bool | None = None, **kwargs: Any) -> SparkSessionCollection

Parameters

Name Description
from_parameter
int

Optional param specifying which index the list should begin from.

default value: None
size
int

Optional param specifying the size of the returned list. By default it is 20 and that is the maximum.

default value: None
detailed

Optional query param specifying whether detailed response is returned beyond plain livy.

default value: None

Keyword-Only Parameters

Name Description
cls

A custom type or function that will be passed the direct response

Returns

Type Description

SparkSessionCollection, or the result of cls(response)

Exceptions

Type Description

get_spark_statement

Gets a single statement within a spark session.

async get_spark_statement(session_id: int, statement_id: int, **kwargs: Any) -> SparkStatement

Parameters

Name Description
session_id
Required
int

Identifier for the session.

statement_id
Required
int

Identifier for the statement.

Keyword-Only Parameters

Name Description
cls

A custom type or function that will be passed the direct response

Returns

Type Description

SparkStatement, or the result of cls(response)

Exceptions

Type Description

get_spark_statements

Gets a list of statements within a spark session.

async get_spark_statements(session_id: int, **kwargs: Any) -> SparkStatementCollection

Parameters

Name Description
session_id
Required
int

Identifier for the session.

Keyword-Only Parameters

Name Description
cls

A custom type or function that will be passed the direct response

Returns

Type Description

SparkStatementCollection, or the result of cls(response)

Exceptions

Type Description

reset_spark_session_timeout

Sends a keep alive call to the current session to reset the session timeout.

async reset_spark_session_timeout(session_id: int, **kwargs: Any) -> None

Parameters

Name Description
session_id
Required
int

Identifier for the session.

Keyword-Only Parameters

Name Description
cls

A custom type or function that will be passed the direct response

Returns

Type Description

None, or the result of cls(response)

Exceptions

Type Description

Attributes

models

models = <module 'azure.synapse.spark.models' from 'C:\\hostedtoolcache\\windows\\Python\\3.11.9\\x64\\Lib\\site-packages\\azure\\synapse\\spark\\models\\__init__.py'>