stac-fastapi-core 6.10.0__tar.gz → 6.10.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/PKG-INFO +1 -1
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/core.py +41 -7
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/version.py +1 -1
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/.gitignore +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/README.md +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/pyproject.toml +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/pytest.ini +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/__init__.py +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/base_database_logic.py +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/base_settings.py +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/basic_auth.py +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/datetime_utils.py +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/extensions/__init__.py +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/extensions/aggregation.py +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/extensions/catalogs.py +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/extensions/collections_search.py +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/extensions/fields.py +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/extensions/filter.py +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/extensions/query.py +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/models/__init__.py +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/models/links.py +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/models/search.py +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/queryables.py +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/rate_limit.py +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/redis_utils.py +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/route_dependencies.py +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/serializers.py +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/session.py +0 -0
- {stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/utilities.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: stac_fastapi_core
|
|
3
|
-
Version: 6.10.
|
|
3
|
+
Version: 6.10.1
|
|
4
4
|
Summary: Core library for the Elasticsearch and Opensearch stac-fastapi backends.
|
|
5
5
|
Project-URL: Homepage, https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch
|
|
6
6
|
License: MIT
|
|
@@ -1006,14 +1006,31 @@ class TransactionsClient(AsyncBaseTransactionsClient):
|
|
|
1006
1006
|
database=self.database, settings=self.settings
|
|
1007
1007
|
)
|
|
1008
1008
|
features = item_dict["features"]
|
|
1009
|
-
|
|
1009
|
+
all_prepped = [
|
|
1010
1010
|
bulk_client.preprocess_item(
|
|
1011
1011
|
feature, base_url, BulkTransactionMethod.INSERT
|
|
1012
1012
|
)
|
|
1013
1013
|
for feature in features
|
|
1014
1014
|
]
|
|
1015
|
+
# Filter out None values (skipped duplicates from DB check)
|
|
1016
|
+
processed_items = [item for item in all_prepped if item is not None]
|
|
1017
|
+
skipped_db_duplicates = len(all_prepped) - len(processed_items)
|
|
1018
|
+
|
|
1019
|
+
# Deduplicate items within the batch by ID (keep last occurrence)
|
|
1020
|
+
# This matches ES behavior where later items overwrite earlier ones
|
|
1021
|
+
seen_ids: dict = {}
|
|
1022
|
+
for item in processed_items:
|
|
1023
|
+
seen_ids[item["id"]] = item
|
|
1024
|
+
unique_items = list(seen_ids.values())
|
|
1025
|
+
skipped_batch_duplicates = len(processed_items) - len(unique_items)
|
|
1026
|
+
processed_items = unique_items
|
|
1027
|
+
|
|
1028
|
+
skipped = skipped_db_duplicates + skipped_batch_duplicates
|
|
1015
1029
|
attempted = len(processed_items)
|
|
1016
1030
|
|
|
1031
|
+
if not processed_items:
|
|
1032
|
+
return f"No items to insert. {skipped} items were skipped (duplicates)."
|
|
1033
|
+
|
|
1017
1034
|
success, errors = await self.database.bulk_async(
|
|
1018
1035
|
collection_id=collection_id,
|
|
1019
1036
|
processed_items=processed_items,
|
|
@@ -1027,7 +1044,7 @@ class TransactionsClient(AsyncBaseTransactionsClient):
|
|
|
1027
1044
|
logger.info(
|
|
1028
1045
|
f"Bulk async operation succeeded with {success} actions for collection {collection_id}."
|
|
1029
1046
|
)
|
|
1030
|
-
return f"Successfully added {success} Items. {attempted - success} errors occurred."
|
|
1047
|
+
return f"Successfully added {success} Items. {skipped} skipped (duplicates). {attempted - success} errors occurred."
|
|
1031
1048
|
|
|
1032
1049
|
# Handle single item
|
|
1033
1050
|
await self.database.create_item(
|
|
@@ -1340,18 +1357,35 @@ class BulkTransactionsClient(BaseBulkTransactionsClient):
|
|
|
1340
1357
|
base_url = ""
|
|
1341
1358
|
|
|
1342
1359
|
processed_items = []
|
|
1360
|
+
skipped_db_duplicates = 0
|
|
1343
1361
|
for item in items.items.values():
|
|
1344
1362
|
try:
|
|
1345
1363
|
validated = Item(**item) if not isinstance(item, Item) else item
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
validated.model_dump(mode="json"), base_url, items.method
|
|
1349
|
-
)
|
|
1364
|
+
prepped = self.preprocess_item(
|
|
1365
|
+
validated.model_dump(mode="json"), base_url, items.method
|
|
1350
1366
|
)
|
|
1367
|
+
if prepped is not None:
|
|
1368
|
+
processed_items.append(prepped)
|
|
1369
|
+
else:
|
|
1370
|
+
skipped_db_duplicates += 1
|
|
1351
1371
|
except ValidationError:
|
|
1352
1372
|
# Immediately raise on the first invalid item (strict mode)
|
|
1353
1373
|
raise
|
|
1354
1374
|
|
|
1375
|
+
# Deduplicate items within the batch by ID (keep last occurrence)
|
|
1376
|
+
# This matches ES behavior where later items overwrite earlier ones
|
|
1377
|
+
seen_ids: dict = {}
|
|
1378
|
+
for item in processed_items:
|
|
1379
|
+
seen_ids[item["id"]] = item
|
|
1380
|
+
unique_items = list(seen_ids.values())
|
|
1381
|
+
skipped_batch_duplicates = len(processed_items) - len(unique_items)
|
|
1382
|
+
processed_items = unique_items
|
|
1383
|
+
|
|
1384
|
+
skipped = skipped_db_duplicates + skipped_batch_duplicates
|
|
1385
|
+
|
|
1386
|
+
if not processed_items:
|
|
1387
|
+
return f"No items to insert. {skipped} items were skipped (duplicates)."
|
|
1388
|
+
|
|
1355
1389
|
collection_id = processed_items[0]["collection"]
|
|
1356
1390
|
attempted = len(processed_items)
|
|
1357
1391
|
success, errors = self.database.bulk_sync(
|
|
@@ -1364,4 +1398,4 @@ class BulkTransactionsClient(BaseBulkTransactionsClient):
|
|
|
1364
1398
|
else:
|
|
1365
1399
|
logger.info(f"Bulk sync operation succeeded with {success} actions.")
|
|
1366
1400
|
|
|
1367
|
-
return f"Successfully added/updated {success} Items. {attempted - success} errors occurred."
|
|
1401
|
+
return f"Successfully added/updated {success} Items. {skipped} skipped (duplicates). {attempted - success} errors occurred."
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""library version."""
|
|
2
|
-
__version__ = "6.10.
|
|
2
|
+
__version__ = "6.10.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/base_database_logic.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/extensions/__init__.py
RENAMED
|
File without changes
|
{stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/extensions/aggregation.py
RENAMED
|
File without changes
|
{stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/extensions/catalogs.py
RENAMED
|
File without changes
|
|
File without changes
|
{stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/extensions/fields.py
RENAMED
|
File without changes
|
{stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/extensions/filter.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stac_fastapi_core-6.10.0 → stac_fastapi_core-6.10.1}/stac_fastapi/core/route_dependencies.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|