Merge "Fix SQL query counting the number of individual consumers having allocations by only selecting the aggregated consumer_id column."

This commit is contained in:
Zuul 2021-07-29 11:07:41 +00:00 committed by Gerrit Code Review
commit 3c51c6413b
1 changed files with 3 additions and 2 deletions

View File

@ -62,8 +62,9 @@ class Checks(upgradecheck.UpgradeCommands):
# Count the total number of consumers.
num_consumers = ctxt.session.query(models.Consumer).count()
# Count the total number of unique consumers in the allocations table.
num_alloc_consumers = ctxt.session.query(models.Allocation).group_by(
models.Allocation.consumer_id).count()
num_alloc_consumers = ctxt.session.query(
models.Allocation.consumer_id).group_by(
models.Allocation.consumer_id).count()
return num_alloc_consumers - num_consumers
def _check_incomplete_consumers(self):