Skip to content

How get error from Send-RSDStatement? #258

Answered by dburtsev
dburtsev asked this question in Q&A
Discussion options

You must be logged in to vote

$QueryId = Send-RSDStatement ...
Start-Sleep -Seconds 1
[Amazon.RedshiftDataAPIService.Model.DescribeStatementResponse]$sqlResp = Get-RSDStatement -Id $QueryId ...
while ($sqlResp.Status.Value -notin ('ABORTED', 'FAILED', 'FINISHED'))
{
$sqlResp.Status.Value
Start-Sleep -Seconds 1
$sqlResp = Get-RSDStatement -Id $QueryId -AccessKey $Env:AWS_ACCESS_KEY_ID -SecretKey $Env:AWS_SECRET_ACCESS_KEY -SessionToken $Env:AWS_SESSION_TOKEN
}

if ($sqlResp.Status.Value -eq 'FINISHED') { "SQL execution OK" | Tee-Object -FilePath $logFile -Append }
else {( "SQL execution status is " + $sqlResp.Status.Value) | Tee-Object -FilePath $logFile -Append
$sqlResp.Error | Tee-Object -FilePath $logFile -Append
Wri…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by dburtsev
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
1 participant