From 8b39060ddf1b8fbecd1a1b71d543b5de8990a909 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Fri, 23 Apr 2021 17:16:35 +0000 Subject: [PATCH] Fix SQLAlchemy backref warnings for viewonly columns Fixed backref warning for two view only relationship defined in the ORM, "QosNetworkPolicyBinding.port" and "Tag.standard_attr". Change-Id: I7fcb1268f4fc637e7f39eae4fcde33f82cb9772c Closes-Bug: #1925841 --- lower-constraints.txt | 2 +- neutron/db/models/tag.py | 3 ++- neutron/db/qos/models.py | 3 ++- requirements.txt | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lower-constraints.txt b/lower-constraints.txt index 63acbd33dd5..67836a1e888 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -116,7 +116,7 @@ simplejson==3.5.1 smmap==0.9.0 snowballstemmer==1.2.1 sqlalchemy-migrate==0.11.0 -SQLAlchemy==1.2.0 +SQLAlchemy==1.3.23 sqlparse==0.2.2 statsd==3.2.1 stestr==1.0.0 diff --git a/neutron/db/models/tag.py b/neutron/db/models/tag.py index 3cab5a81959..7f4fdaa1c86 100644 --- a/neutron/db/models/tag.py +++ b/neutron/db/models/tag.py @@ -27,5 +27,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='subquery', viewonly=True), + sync_backref=False) revises_on_change = ('standard_attr', ) diff --git a/neutron/db/qos/models.py b/neutron/db/qos/models.py index 54e2bd5e1ec..71cc175a468 100644 --- a/neutron/db/qos/models.py +++ b/neutron/db/qos/models.py @@ -59,7 +59,8 @@ class QosNetworkPolicyBinding(model_base.BASEV2): primaryjoin='QosNetworkPolicyBinding.network_id == Port.network_id', foreign_keys=network_id, backref=sa.orm.backref('qos_network_policy_binding', uselist=False, - viewonly=True, lazy='joined')) + viewonly=True, lazy='joined'), + sync_backref=False) class QosFIPPolicyBinding(model_base.BASEV2): diff --git a/requirements.txt b/requirements.txt index bf410a9387b..9292e4aa7f6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,7 +19,7 @@ netifaces>=0.10.4 # MIT neutron-lib>=2.10.1 # Apache-2.0 python-neutronclient>=6.7.0 # Apache-2.0 tenacity>=6.0.0 # Apache-2.0 -SQLAlchemy>=1.2.0 # MIT +SQLAlchemy>=1.3.23 # MIT WebOb>=1.8.2 # MIT keystoneauth1>=3.14.0 # Apache-2.0 alembic>=0.9.6 # MIT