Querying ShotGrid to determine if more than 1 entity is on a multi-entity connection

Hey everyone,

At my company we are using a CustomNonProjectEntity (A) and linking to another CustomNonProjectEntity (B) in a multi-entity field.

There is a business reason why we don’t want more than one entity on that field, despite the schema.
I am looking to create a python script or use the REST API to help identify which “A” entities have more than one “B” entity. Is there an easy way to do this? Or do I need to query and grab ALL (90k) “A” entities and check the field?

Any suggestions on evaluating that many entities?

This sounds simplest as a python script, provided it doesn’t need to be run frequently.

It doesn’t, and it can be inefficient if needed. I doubt i can query all 90k at once so i will need to think of a way to batch it into chunks.

It may be a brute force type script…