Skip to content

Commit b06d6d3

Browse files
pjonssonomad
authored andcommitted
index: fix return types
This is what is currently returned, so adjust the type to reflect that.
1 parent 36df5b5 commit b06d6d3

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

cubedash/index/api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from datacube.index import Index
88
from datacube.model import Dataset, MetadataType, Product, Range
99
from datacube.model.fields import Field
10-
from sqlalchemy import Result, Row, Select
10+
from sqlalchemy import CursorResult, Result, Row, Select
1111
from sqlalchemy.sql import ColumnElement
1212
from sqlalchemy.sql.elements import ClauseElement, Label
1313

@@ -150,10 +150,10 @@ def upsert_product_record(
150150
) -> tuple[int, datetime]: ...
151151

152152
@abstractmethod
153-
def upsert_product_regions(self, product_id: int) -> Result: ...
153+
def upsert_product_regions(self, product_id: int) -> CursorResult: ...
154154

155155
@abstractmethod
156-
def delete_product_empty_regions(self, product_id: int) -> Result: ...
156+
def delete_product_empty_regions(self, product_id: int) -> CursorResult: ...
157157

158158
@abstractmethod
159159
def product_region_summary(self, product_id: int) -> Result: ...

cubedash/index/postgis/_api.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from geoalchemy2.shape import from_shape
2020
from sqlalchemy import (
2121
ClauseElement,
22+
CursorResult,
2223
Integer,
2324
Label,
2425
Result,
@@ -300,7 +301,7 @@ def product_summary_cols(self, product_name: str) -> Row:
300301
).fetchone()
301302

302303
@override
303-
def upsert_product_regions(self, product_id: int) -> Result:
304+
def upsert_product_regions(self, product_id: int) -> CursorResult:
304305
# add new regions row and/or update existing regions based on dataset_spatial
305306
with self.index._active_connection() as conn:
306307
return conn.execute(
@@ -336,7 +337,7 @@ def upsert_product_regions(self, product_id: int) -> Result:
336337
)
337338

338339
@override
339-
def delete_product_empty_regions(self, product_id: int) -> Result:
340+
def delete_product_empty_regions(self, product_id: int) -> CursorResult:
340341
with self.index._active_connection() as conn:
341342
return conn.execute(
342343
text(f"""

cubedash/index/postgres/_api.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from geoalchemy2.shape import from_shape
2222
from sqlalchemy import (
2323
ClauseElement,
24+
CursorResult,
2425
Integer,
2526
Label,
2627
Result,
@@ -316,7 +317,7 @@ def product_summary_cols(self, product_name: str) -> Row:
316317
).fetchone()
317318

318319
@override
319-
def upsert_product_regions(self, product_id: int) -> Result:
320+
def upsert_product_regions(self, product_id: int) -> CursorResult:
320321
# add new regions row and/or update existing regions based on dataset_spatial
321322
with self.index._active_connection() as conn:
322323
return conn.execute(
@@ -352,7 +353,7 @@ def upsert_product_regions(self, product_id: int) -> Result:
352353
)
353354

354355
@override
355-
def delete_product_empty_regions(self, product_id: int) -> Result:
356+
def delete_product_empty_regions(self, product_id: int) -> CursorResult:
356357
with self.index._active_connection() as conn:
357358
return conn.execute(
358359
text(f"""

0 commit comments

Comments
 (0)