commit 6ace54c2601770a0e06418ce5b98c756c86f6a51
Author: Goutham Pacha Ravi <email address hidden>
Date: Wed May 19 17:14:24 2021 -0700
Fix with_entities usage in db queries
In order to retrieve shares with filters
pertaining to separate tables (shares, instances, metadata,
etc), we need to perform joined loads of those
respective database tables as necessary. After the
join, the query cannot select entities due to
Github issue #6253 - The following is an error when
the pattern is used:
sqlalchemy.exc.ArgumentError: Query has only expression-based entities - can't find property named "share_metadata".
sqlalchemy 1.4 has a performance improvement that
delays query processing [2] and disallows this
pattern of usage; we can use a query.count() instead.
In another instance, we can perform joins selectively
only if asked for.
Reviewed: https:/ /review. opendev. org/c/openstack /manila/ +/792303 /opendev. org/openstack/ manila/ commit/ 6ace54c2601770a 0e06418ce5b98c7 56c86f6a51
Committed: https:/
Submitter: "Zuul (22348)"
Branch: master
commit 6ace54c2601770a 0e06418ce5b98c7 56c86f6a51
Author: Goutham Pacha Ravi <email address hidden>
Date: Wed May 19 17:14:24 2021 -0700
Fix with_entities usage in db queries
In order to retrieve shares with filters
pertaining to separate tables (shares, instances, metadata,
etc), we need to perform joined loads of those
respective database tables as necessary. After the
join, the query cannot select entities due to
Github issue #6253 - The following is an error when
the pattern is used:
sqlalchemy. exc.ArgumentErr or: Query has only expression-based entities - can't find property named "share_metadata".
sqlalchemy 1.4 has a performance improvement that
delays query processing [2] and disallows this
pattern of usage; we can use a query.count() instead.
In another instance, we can perform joins selectively
only if asked for.
[1] https:/ /github. com/sqlalchemy/ sqlalchemy/ issues/ 625 /docs.sqlalchem y.org/en/ 14/changelog/ migration_ 14.html# many-core- and-orm- statement- objects- now-perform- much-of- their-construct ion-and- validation- in-the- compile- phase
[2] https:/
Change-Id: I8aa196c171bbc2 24cec06f517ea22 c4e91cbc06a
Closes-Bug: #1926399
Signed-off-by: Goutham Pacha Ravi <email address hidden>