Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stac_fastapi.sqlalchemy: Delete collection API not working #21

Open
keul opened this issue Apr 5, 2023 · 0 comments
Open

stac_fastapi.sqlalchemy: Delete collection API not working #21

keul opened this issue Apr 5, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@keul
Copy link
Contributor

keul commented Apr 5, 2023

Delete API seems to not work, or at least the user receive an error message which lead to wrong assumptions.

  1. Wrong error message

Example:

curl -X 'DELETE' \
  'http://localhost:8000/collections/my-collection-id' \
  -H 'accept: application/json'

What I got back is:

{
  "code": "ForeignKeyError",
  "description": "collection does not exist"
}

But the collection is there, the error seems related to a general error handling at https://github.com/stac-utils/stac-fastapi/blob/d8e3edad3254dd59945de755a2f212603f7fcb29/stac_fastapi/sqlalchemy/stac_fastapi/sqlalchemy/session.py#L30:L32

  1. Why my delete is failing?

https://github.com/stac-utils/stac-fastapi/blob/d8e3edad3254dd59945de755a2f212603f7fcb29/stac_fastapi/sqlalchemy/stac_fastapi/sqlalchemy/transactions.py#L155:L158

I think this query is just trying to delete the collection record, while not deleting the items, so it triggers an integrity error (missing cascade).

@keul keul changed the title stac.sqlalchemy: Delete collection API not working stac_fastapi.sqlalchemy: Delete collection API not working Apr 5, 2023
@gadomski gadomski added the bug Something isn't working label Apr 5, 2023
@gadomski gadomski transferred this issue from stac-utils/stac-fastapi May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants