Skip to content

Commit 4eaedc5

Browse files
author
Phil Varner
authored
Merge pull request #33 from stac-utils/pv/fix-bulk-ingest
iterate over the Item values rather than the Items string keys
2 parents 989c3de + af10418 commit 4eaedc5

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

.github/workflows/cicd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: stac-fastapi-nosql
1+
name: stac-fastapi-elasticsearch
22
on:
33
push:
44
branches: [ main, dev ]

stac_fastapi/elasticsearch/setup.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@
4545
"Programming Language :: Python :: 3.8",
4646
"License :: OSI Approved :: MIT License",
4747
],
48-
keywords="STAC FastAPI COG",
49-
author=u"Arturo Engineering",
50-
author_email="engineering@arturo.ai",
51-
url="https://github.com/jonhealy1/stac-fastapi-nosql",
48+
url="https://github.com/stac-utils/stac-fastapi-elasticsearch",
5249
license="MIT",
5350
packages=find_namespace_packages(exclude=["alembic", "tests", "scripts"]),
5451
zip_safe=False,

stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/transactions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,9 @@ def bulk_item_insert(self, items: Items, **kwargs) -> str:
215215
base_url = str(kwargs["request"].base_url)
216216
except Exception:
217217
base_url = ""
218-
processed_items = [self._preprocess_item(item, base_url) for item in items]
218+
processed_items = [
219+
self._preprocess_item(item, base_url) for item in items.items.values()
220+
]
219221
return_msg = f"Successfully added {len(processed_items)} items."
220222

221223
# helpers.bulk(

stac_fastapi/elasticsearch/tests/clients/test_elasticsearch.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
BulkTransactionsClient,
1414
TransactionsClient,
1515
)
16+
from stac_fastapi.extensions.third_party.bulk_transactions import Items
1617
from stac_fastapi.types.errors import ConflictError, NotFoundError
1718

1819

@@ -269,16 +270,16 @@ def test_bulk_item_insert(
269270

270271
item = load_test_data("test_item.json")
271272

272-
items = []
273+
items = {}
273274
for _ in range(10):
274275
_item = deepcopy(item)
275276
_item["id"] = str(uuid.uuid4())
276-
items.append(_item)
277+
items[_item["id"]] = _item
277278

278279
# fc = es_core.item_collection(coll["id"], request=MockStarletteRequest)
279280
# assert len(fc["features"]) == 0
280281

281-
es_bulk_transactions.bulk_item_insert(items=items)
282+
es_bulk_transactions.bulk_item_insert(Items(items=items))
282283
time.sleep(3)
283284
fc = es_core.item_collection(coll["id"], request=MockStarletteRequest)
284285
assert len(fc["features"]) >= 10

0 commit comments

Comments
 (0)