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

Mockgun raises exception on dotted filter #298

Open
austinwitherspoon opened this issue Aug 24, 2023 · 3 comments
Open

Mockgun raises exception on dotted filter #298

austinwitherspoon opened this issue Aug 24, 2023 · 3 comments

Comments

@austinwitherspoon
Copy link

Running the following code:

mockgun.find("Version", [["entity.Shot.code", "is", "bunny_080_0010"]], ["code", "description"])

raises the exception shotgun_api3.shotgun.ShotgunError: Deep query field Version.entity.Shot.code does not match type with data {'type': 'Asset', 'id': 1351, 'name': 'mp_415'}

This exception is raised from _get_field_from_row() which is expecting that every single row has the same type, but a field like entity is multi-entity and this will always raise an exception.

I did a small experiment and it appears that we can just return None instead of raising an exception which will fix the issue (although there may be a side effect of filters like ["entity.Shot.other_field", "is", "None"] getting falsely included when entity != Shot.. maybe a special return type like "NoField" to indicate a field wasn't found and to skip?)

@austinwitherspoon
Copy link
Author

Happy to make a pull request if y'all think it's the right move to fix this

@carlos-villavicencio-adsk
Copy link
Contributor

How is the real behavior without using mockgun when using ShotGrid with a similar scenario?

@austinwitherspoon
Copy link
Author

This is a valid query in actual shotgun. (You can run it on any demo site). It will return versions linked to shots with the code bunny_080_0010.

The problem is that mockgun raises an exception for this valid query, because it doesn't like that a version can be linked to multiple entity types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants