Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #2305 - Enable Notebook Agent Jobs to succeed on named instances #2306

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ $JobId = "$(ESCAPE_SQUOTE(JOBID))"
$StartTime = "$(ESCAPE_SQUOTE(STRTTM))"
$StartDate = "$(ESCAPE_SQUOTE(STRTDT))"
$JSONTable = "select * from notebooks.nb_template where job_id = $JobId"
# so that we can use Invoke-Sqlcmd with named instances lets set a variable to the host\instancename
$SqlInstance = '{0}\{1}' -f "$(ESCAPE_SQUOTE(MACH))", "$(ESCAPE_SQUOTE(INST))"
# so that every time we call Invoke-Sqlcmd we don't have to specify the server instance
$PSDefaultParameterValues = @{
"Invoke-SqlCmd:ServerInstance" = $SqlInstance
}
$sqlResult = Invoke-Sqlcmd -Query $JSONTable -Database $TargetDatabase -MaxCharLength 2147483647
$FirstNotebookError = ""
function ParseTableToNotebookOutput {
Expand Down Expand Up @@ -59,7 +65,7 @@ function ParseQueryErrorToNotebookOutput {
", State " + $QueryError.Exception.InnerException.State +
", Line " + $QueryError.Exception.InnerException.LineNumber +
"`r`n" + $QueryError.Exception.Message

$ErrorOutput = @{ }
$ErrorOutput["output_type"] = "error"
$ErrorOutput["traceback"] = @()
Expand Down