-
Notifications
You must be signed in to change notification settings - Fork 102
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
Duplicated "items" link when trying to update an existing collection #505
Comments
The PUT/POST I think it'd be reasonable for either For now, I would suggest removing the collection.clear_links("items") |
@remicres If you'd like to update an item in a collection you do not need to update the collection. Instead you may use the transactions extension ( This being said you and @gadomski have touched on an interesting subject which is how stac-fastapi is currently dealing with inferred links. Inferred links are any links that may be inferred from information in the request, these are automatically generated by the API to ensure that links resolve properly. Inferred links generated by the API should always take precedence over those passed by a user, and IMO should not be persisted in the database. The INFERRED_LINK_RELS = ["self", "item", "parent", "collection", "root"]
def filter_links(links: List[Dict]) -> List[Dict]:
"""Remove inferred links."""
return [link for link in links if link["rel"] not in INFERRED_LINK_RELS] This function is used by the sqlalchemy backend but I don't believe it is called in pgstac. We could also be more aggressive with which links are included in TLDR: |
Hi @geospatial-jeff and @gadomski , |
Hi,
I am trying to update a remote collection using
pystac
,pystac_client
andrequests
.The collection is read and updated using the STAC FastAPI.
The problem is that the "items" link of the collection is duplicated every time the collection is updated.
After N updates, I got N "items" links in the collection links!
I don't know if its a bug, a limitation, of a wrong usage of pystac with pystac_client.
I have added below a minimal example to reproduce the thing.
Code snippet to reproduce the error
First run
Output:
Resulting collection:
Nothing really exciting here. The collection is created.
Second run
Output:
Resulting collection:
Here, you can notice that "items " is duplicated!
Third run
Resulting collection:
Here "items" has been one more time duplicated. There is now 3 "items" entry.
Is this behavior nominal?
If yes, how should I avoid the duplicated links?
Thanks
Rémi
The text was updated successfully, but these errors were encountered: