Invoke-AzSynapseSparkStatement
Invokes a Synapse Analytics Spark statement.
Syntax
RunSparkStatementByCodePathParameterSet (Default)
Invoke-AzSynapseSparkStatement
-WorkspaceName <String>
-SparkPoolName <String>
-Language <String>
-SessionId <Int32>
-FilePath <String>
[-Response]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
RunSparkStatementByCodeParameterSet
Invoke-AzSynapseSparkStatement
-WorkspaceName <String>
-SparkPoolName <String>
-Language <String>
-SessionId <Int32>
-Code <String>
[-Response]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Invoke-AzSynapseSparkStatement
-Language <String>
-SessionObject <PSSynapseSparkSession>
-Code <String>
[-SessionId <Int32>]
[-Response]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Invoke-AzSynapseSparkStatement
-Language <String>
-SessionObject <PSSynapseSparkSession>
-FilePath <String>
[-SessionId <Int32>]
[-Response]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Invoke-AzSynapseSparkStatement cmdlet invokes a Synapse Analytics Spark statement.
Examples
Example 1
$session = Start-AzSynapseSparkSession -WorkspaceName ContosoWorkspace -SparkPoolName ContosoSparkPool -Name ContosoSessionName -ExecutorCount 3 -ExecutorSize Small
$session.Language = 'Spark'
$session | Invoke-AzSynapseSparkStatement -Code 'print("Hello world\n")'
These commands start a Spark session then invoke an inline Spark statement through pipeline.
Example 2
Invoke-AzSynapseSparkStatement -SessionId 324 -Language 'Spark' -Code 'print("Hello world\n")'
These commands start a Spark session then invoke an inline Spark statement.
Example 3
$session = Start-AzSynapseSparkSession -WorkspaceName ContosoWorkspace -SparkPoolName ContosoSparkPool -Name ContosoSessionName -ExecutorCount 3 -ExecutorSize Small
$session.Language = 'Spark'
$session | Invoke-AzSynapseSparkStatement -FilePath 'C:\path\to\code.sc'
These commands start a Spark session then invoke Spark statements in a file.
Parameters
-AsJob
Run cmdlet in the background
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Code
The execution code.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
RunSparkStatementByCodeParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
RunSparkStatementByCodeAndInputObjectParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Aliases: cf
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Parameter properties
Type: IAzureContextContainer
Default value: None
Supports wildcards: False
DontShow: False
Aliases: AzContext, AzureRmContext, AzureCredential
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-FilePath
Specifies a local file path that contains the execution code.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
RunSparkStatementByCodePathParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
RunSparkStatementByCodePathAndInputObjectParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Language
Language of the execution code.
Parameter properties
Type: String
Default value: None
Accepted values: Spark, Scala, PySpark, Python, SparkDotNet, CSharp, SQL
Supports wildcards: False
DontShow: False
Parameter sets
RunSparkStatementByCodePathParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
RunSparkStatementByCodeParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Response
Indicates full response should be return.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-SessionId
Identifier of Spark session.
Parameter properties
Type: Int32
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
RunSparkStatementByCodePathParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
RunSparkStatementByCodeParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-SessionObject
Spark session input object, usually passed through the pipeline.
Parameter properties
Parameter sets
RunSparkStatementByCodeAndInputObjectParameterSet
Position: Named
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: False
Value from remaining arguments: False
RunSparkStatementByCodePathAndInputObjectParameterSet
Position: Named
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: False
Value from remaining arguments: False
-SparkPoolName
Name of Synapse Spark pool.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
RunSparkStatementByCodePathParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
RunSparkStatementByCodeParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Aliases: wi
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-WorkspaceName
Name of Synapse workspace.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
RunSparkStatementByCodePathParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
RunSparkStatementByCodeParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters .
Outputs