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
This commit is contained in:
Slawek Kaplonski 2023-08-16 12:14:19 +02:00
parent 186e87e389
commit 85d3fff97e
1 changed files with 1 additions and 1 deletions

View File

@ -26,6 +26,6 @@ class Tag(model_base.BASEV2):
tag = sa.Column(sa.String(255), nullable=False, primary_key=True)
standard_attr = orm.relationship(
'StandardAttribute', load_on_pending=True,
backref=orm.backref('tags', lazy='subquery', viewonly=True),
backref=orm.backref('tags', lazy='joined', viewonly=True),
sync_backref=False)
revises_on_change = ('standard_attr', )