ansible / django-ansible-base

Apache License 2.0
11 stars 43 forks source link

Optimize SQL queries when creating orgs and teams #506

Closed cutwater closed 1 month ago

cutwater commented 2 months ago

The former SQL query was producing WHERE clause against python repr of tuples. Rewrting this exact query would likely require usage of raw PostgreSQL specific SQL. Therefore instead of querying list teams by tuples of organization name and team name, we query all teams within set of organization ids. This queries slighly more date, but tallows us to avoid extra JOIN with the Organization table and complicated filtering.

Minor refactoring.

sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
84.5% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud