Skip to content

Commit d29a628

Browse files
Merge pull request #580 from ayobi/vocab_samples_issues
patch existing observations for project 118 and 160
2 parents 233e89c + 179fb53 commit d29a628

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
-- August 26, 2024
2+
-- Patching 0141 Sample Observation Project Association
3+
-- to add projects 118 and 160.
4+
5+
WITH all_observations AS (
6+
SELECT observation_id FROM barcodes.sample_observations
7+
),
8+
add_projects AS (
9+
SELECT project_id
10+
FROM (VALUES (118), (160)) AS np(project_id)
11+
WHERE EXISTS (
12+
SELECT 1 FROM barcodes.project WHERE project.project_id = np.project_id
13+
)
14+
)
15+
INSERT INTO barcodes.sample_observation_project_associations (observation_id, project_id)
16+
SELECT observation_id, project_id
17+
FROM all_observations
18+
CROSS JOIN add_projects;

microsetta_private_api/repo/admin_repo.py

-3
Original file line numberDiff line numberDiff line change
@@ -409,9 +409,6 @@ def _rows_to_dicts_list(rows):
409409
LEFT JOIN
410410
barcodes.sample_observations so
411411
ON bso.observation_id = so.observation_id
412-
LEFT JOIN
413-
barcodes.sample_observation_project_associations sopa
414-
ON so.observation_id = sopa.observation_id
415412
WHERE
416413
bs.barcode = %s
417414
GROUP BY

0 commit comments

Comments
 (0)