Skip to content

Commit

Permalink
Merge pull request #297 from microbiomedata/280-log-update-query
Browse files Browse the repository at this point in the history
280 fix update query syntax
  • Loading branch information
mbthornton-lbl authored Nov 22, 2024
2 parents 7213e8b + f241a2f commit b79eb3c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
7 changes: 4 additions & 3 deletions nmdc_automation/import_automation/activity_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,10 @@ def map_sequencing_data(self) -> Tuple[nmdc.Database, Dict]:
db.data_object_set.append(DataObject(**do_record))
has_output.append(data_object_id)
update = {
"collection": "data_generation_set",
"filter": {"id": self.nucelotide_sequencing_id},
"update": {"$addToSet": {"has_output": has_output}}
"update": "data_generation_set",
"updates": [
{"q": {"id": self.nucelotide_sequencing_id}, "u": {"$addToSet": {"has_output": has_output[0]}}}
]
}
# update self.data_object_map
if len(has_output) > 1:
Expand Down
1 change: 1 addition & 0 deletions nmdc_automation/run_process/run_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def import_projects(import_file, import_yaml, site_configuration, iteration):
runtime.run_query(data_generation_update)
except Exception as e:
logger.error(f"Error applying update to sequencing data generation: {e}")
logger.error(data_generation_update)
raise e


Expand Down
7 changes: 4 additions & 3 deletions tests/test_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ def test_gold_mapper_map_sequencing_data(gold_mapper):
exp_dobj_type = "Metagenome Raw Reads" # From the gold_import_files fixture
exp_nucleotide_sequencing_id = "nmdc:omprc-11-importT" # From the gold mapper fixture
exp_update = {
"collection": "data_generation_set",
"filter": {"id": exp_nucleotide_sequencing_id},
"update": {"$addToSet": {"has_output": [exp_dobj_id]}}
"update": "data_generation_set",
"updates": [
{"q": {"id": exp_nucleotide_sequencing_id}, "u": {"$addToSet": {"has_output": exp_dobj_id}}}
],
}
# Sequencing data does not get a URL
exp_url = None
Expand Down

0 comments on commit b79eb3c

Please sign in to comment.