How to check if data row has labels attached? Without exporting labels

Hello,

From the SDK, I am trying to iterate through all selected data rows and delete them if there is no label.
Is there an attribute or method to see if the data row object has any annotations attached to it? Every related function I can find pertains to only labels that exist / data rows that have labels, not the opposite.

Thanks

The SDK has a function that can return the labels on a particular data row data_row.labels()
This function will return the labels (if any) that are connected to that data_row across all projects. If this function is not what answers your question, please clarify where I could have misunderstood your question.

Thanks!

1 Like

Hello,
Yes this helps. But label=data_row.labels() returns a PaginatedCollection generator, and then I have to handle StopIteration errors for data rows with no labels since the paginated class does not return None when empty.

This method will work for us just fine! - I was just curious if there was a quick & simple way without pulling the actual labeled data and dealing with generator error handling.

Thanks!

Hello,
I see where your concern is stemming from, I would suggest using list(data_row.labels()) which will return an empty array if there are no labels on that data row. This call should not error but rather give you an empty array when called on an empty PaginatedCollection.
Please let me know if that answers your question.
Thanks!