Skip to content

Commit ef31c17

Browse files
committed
Use HasStandardAttributes as parent class for Tags DB model
Tags db model class had defined standard attribute relationship as "subquery" which leads to massive number of SELECT sql queries to get those standard attributes for any tag. With this patch this db model will use relationship definition from the HasStandardAttributes class which is the same for all models with standard attributes and which is "joined" model. Change-Id: If11288c89c362c8d6f97833d89b3df77e51ee363 (cherry picked from commit 85d3fff)
1 parent f5523b2 commit ef31c17

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

neutron/db/models/tag.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ class Tag(model_base.BASEV2):
2626
tag = sa.Column(sa.String(255), nullable=False, primary_key=True)
2727
standard_attr = orm.relationship(
2828
'StandardAttribute', load_on_pending=True,
29-
backref=orm.backref('tags', lazy='subquery', viewonly=True),
29+
backref=orm.backref('tags', lazy='joined', viewonly=True),
3030
sync_backref=False)
3131
revises_on_change = ('standard_attr', )

0 commit comments

Comments
 (0)