Skip to content

Commit

Permalink
dry_run false... success!
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaraphael committed Oct 14, 2023
1 parent 1633dd3 commit 34be2aa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
3 changes: 2 additions & 1 deletion cerulean_cloud/cloud_function_ais_analysis/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ scipy==1.8.0
shapely==2.0.1
Flask>=1.0,<3.0
functions-framework==3.0.0
geoalchemy2
geoalchemy2
asyncpg
19 changes: 13 additions & 6 deletions cerulean_cloud/database_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from dateutil.parser import parse
from geoalchemy2.shape import from_shape
from shapely.geometry import MultiPolygon, Polygon, box, shape
from sqlalchemy import select
from sqlalchemy import and_, select
from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine

import cerulean_cloud.database_schema as db
Expand Down Expand Up @@ -182,15 +182,22 @@ async def get_slicks_without_sources_from_scene_id(self, scene_id, active=True):
- It joins multiple tables: `db.Slick`, `db.SlickToSource`, `db.OrchestratorRun`, and `db.Sentinel1Grd`.
- The query uses an outer join to filter out slicks that have associated sources.
"""
return (
self.session.query(db.Slick)

query = (
select(db.Slick)
.outerjoin(db.SlickToSource, db.Slick.id == db.SlickToSource.slick)
.filter(db.SlickToSource.slick is None)
.join(db.OrchestratorRun)
.join(db.Sentinel1Grd)
.filter(db.Sentinel1Grd.id == scene_id, db.Slick.active == active)
.all()
.where(
and_(
db.SlickToSource.slick is None,
db.Sentinel1Grd.scene_id == scene_id,
db.Slick.active == active,
)
)
)
result = await self.session.execute(query)
return result.scalars().all()

async def get_scene_from_id(self, scene_id):
"""
Expand Down

0 comments on commit 34be2aa

Please sign in to comment.