Skip to content

Commit

Permalink
Remove update_observations.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkelley committed Nov 20, 2024
1 parent 41e67d3 commit dc31ba1
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions sbsearch/sbsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,37 +365,6 @@ def add_observations(self, observations: List[Observation]) -> None:
"" if len(observations) == 1 else "s",
)

def update_observations(self, observations: List[Observation]) -> None:
"""Add observations to the database, updating on conflict.
If ``spatial_terms`` is not set, then new terms are generated.
The observation objects are not updated with any metadata from the
database.
Parameters
----------
observations: list of Observations
"""

for obs in observations:
if obs.spatial_terms is None:
obs.spatial_terms = self.indexer.index_polygon(
*core.polygon_string_to_arrays(obs.fov)
)

with self.db.session.begin():
for obs in observations:
self.db.session.merge(obs, load=False)

self.logger.debug(
"Added or updated %d observation%s.",
len(observations),
"" if len(observations) == 1 else "s",
)

def get_observations(self) -> List[Observation]:
"""Get observations from database."""
q: Query = self.db.session.query(self.source)
Expand Down

0 comments on commit dc31ba1

Please sign in to comment.