Skip to content

Commit

Permalink
fix: Get Specific Environment Reference ID (#56)
Browse files Browse the repository at this point in the history
The environment reference ID was not filtering on the folder name, leading to
 situations where multiple rows might be returned.

When this occurs the result was non-deterministic and the SSIS job step would
 not be configured correctly.
  • Loading branch information
gvee-uk authored Sep 1, 2022
1 parent 6ff145f commit 044c3f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/sql/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def agent_create_job_step_ssis(
{
"project_name": project_name,
"environment_name": environment_name,
"folder_name": folder_name,
},
return_results=True,
)[0].environment_reference_id
Expand Down
10 changes: 7 additions & 3 deletions src/sql/ssis/get_environment_reference_id.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
SELECT reference_id AS environment_reference_id
FROM catalog.environment_references
SELECT reference_id AS environment_reference_id
FROM SSISDB.catalog.environment_references
INNER
JOIN catalog.projects
JOIN SSISDB.catalog.projects
ON projects.project_id = environment_references.project_id
INNER
JOIN SSISDB.catalog.folders
ON folders.folder_id = projects.folder_id
WHERE environment_references.environment_name = $environment_name
AND projects.name = $project_name
AND folders.name = $folder_name
;

0 comments on commit 044c3f6

Please sign in to comment.