Skip to content

Conversation

@carlos-villavicencio-adsk
Copy link
Contributor

@carlos-villavicencio-adskcarlos-villavicencio-adsk commented Dec 19, 2024

Summary

This is a follow up work from #360 in this case including support for in and not_inoperators for lists of entities.

Affected methods

  • find
  • summarize
  • text_search (API query_display_name_cache)

Detailed Description

The change should transform calls like:

sg.find("Asset", [[ "project", "in", [{"created_at": datetime.datetime(2015, 12, 16, 11, 2, 10, tzinfo), "id": 72, "name": "Demo: Game", "type": "Project", # ... },{"created_at": datetime.datetime(2015, 12, 16, 11, 2, 10, tzinfo), "id": 73, "name": "Demo: Game 2", "type": "Project", # ... } ] ]] )

as if the following had been called:

sg.find('Asset', [['project', 'in', [{'id': 72, 'type': 'Project'},{'id': 73, 'type': 'Project'}]]]) 

@carlos-villavicencio-adskcarlos-villavicencio-adsk changed the title SG-37544 Include the "in" and "not_in" for payload optimizationSG-37544 Include the "in" and "not_in" operators for payload optimizationDec 19, 2024
}
],
}
os.environ["SHOTGUN_API_ENABLE_ENTITY_OPTIMIZATION"] ="1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this kind of test, in order to leave in the same state, I prefer to use a context:

fromunittestimportmockwithmock.patch.dict("os.environ",{"SHOTGUN_API_ENABLE_ENTITY_OPTIMIZATION": "1", }):

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've found a way using a decorator for the test case.

Copy link
Member

@julien-langjulien-lang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@carlos-villavicencio-adskcarlos-villavicencio-adsk merged commit f0451f5 into masterJan 28, 2025
24 checks passed
@carlos-villavicencio-adskcarlos-villavicencio-adsk deleted the ticket/SG-37544 branch January 28, 2025 19:59
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@carlos-villavicencio-adsk@julien-lang@eduardoChaucaGallegos