Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* Manually exclude non-truthy optional values from sqlalchemy serialization of Collections ([#508](https://github.com/stac-utils/stac-fastapi/pull/508))
* Support `intersects` in GET requests ([#521](https://github.com/stac-utils/stac-fastapi/pull/521))
* Deleting items that had repeated ids in other collections ([#520](https://github.com/stac-utils/stac-fastapi/pull/520))
* 404 for missing collection on /items for sqlalchemy ([#528](https://github.com/stac-utils/stac-fastapi/pull/528))

### Deprecated

Expand Down
2 changes: 2 additions & 0 deletions stac_fastapi/sqlalchemy/stac_fastapi/sqlalchemy/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ def item_collection(
"""Read an item collection from the database."""
base_url = str(kwargs["request"].base_url)
with self.session.reader.context_session() as session:
# Look up the collection first to get a 404 if it doesn't exist
_ = self._lookup_id(collection_id, self.collection_table, session)
query = (
session.query(self.item_table)
.join(self.collection_table)
Expand Down
2 changes: 1 addition & 1 deletion stac_fastapi/sqlalchemy/tests/resources/test_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ def test_item_search_get_query_extension(app_client, load_test_data):
def test_get_missing_item_collection(app_client):
"""Test reading a collection which does not exist"""
resp = app_client.get("/collections/invalid-collection/items")
assert resp.status_code == 200
assert resp.status_code == 404


def test_pagination_item_collection(app_client, load_test_data):
Expand Down