shotgunsoftware / python-api

A Python-based library for accessing Flow Production Tracking API.
https://developer.shotgridsoftware.com/python-api
Other
306 stars 198 forks source link

Using find() and ordering by playlists.PlaylistVersionConnection.sg_sort_order returns CRUD ERROR #288

Open blerrgh opened 1 year ago

blerrgh commented 1 year ago

The following code:

shotgun.find(
    "Version",
    order=[{"field_name": "playlists.PlaylistVersionConnection.sg_sort_order", "direction": "asc"}],
)

Results in the following error:

shotgun_api3.shotgun.Fault: API read() CRUD ERROR #10: Read failed for entity type [Version]

This is probably an issue on the server side rather than the python api client, but I would expect to be able to sort by the Playlists > Sort Order field though the API in the same way you can through the UI.

blerrgh commented 1 year ago

More specifically, this is an issue because when the UI is sorted by Playlist -> Sort Order and an Action Menu Item is triggered, the POST payload from Shotgrid includes sort_column: playlists.PlaylistVersionConnection.sg_sort_order

However, querying the API using that sort column triggers this ambiguous CRUD error.

I would expect any sort_column value that is provided by Action Menu Items or Webhooks to be valid a sort order field for an api find() query, but that doesn't always seem to be the case.

At the very least, it would be nice if the error message was more descriptive.