From e5d0c0e77a9c395a5b143dde4d227261ff43fa21 Mon Sep 17 00:00:00 2001 From: Chuan Miao Date: Tue, 23 Mar 2021 12:16:16 +0100 Subject: [PATCH] Pass sync_backref=False to relationship call Need to bump the lower-constraint of sqlalchemy to a version where 'sync_backref' was introduced [1] [1] https://docs.sqlalchemy.org/en/13/orm/relationship_api.html#sqlalchemy.orm.relationship.params.sync_backref Change-Id: I589281d8e77a160adcd48b8d3e4951441f843463 Closes-Bug: #1924806 Signed-off-by: Goutham Pacha Ravi --- lower-constraints.txt | 2 +- manila/db/sqlalchemy/models.py | 2 ++ ...-sqlalchemy-view-only-relationships-807d406cf8fac06c.yaml | 5 +++++ requirements.txt | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/bug-1924806-sqlalchemy-view-only-relationships-807d406cf8fac06c.yaml diff --git a/lower-constraints.txt b/lower-constraints.txt index 81fdb0fb0b..7a3b7e0eca 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -113,7 +113,7 @@ Routes==2.4.1 simplejson==3.13.2 six==1.15.0 snowballstemmer==1.2.1 -SQLAlchemy==1.3.1 +SQLAlchemy==1.3.17 sqlalchemy-migrate==0.11.0 sqlparse==0.2.4 statsd==3.2.2 diff --git a/manila/db/sqlalchemy/models.py b/manila/db/sqlalchemy/models.py index 81a388d149..245185ca98 100644 --- a/manila/db/sqlalchemy/models.py +++ b/manila/db/sqlalchemy/models.py @@ -805,6 +805,7 @@ class ShareSnapshotInstance(BASE, ManilaBase): ), viewonly=True, join_depth=2, + sync_backref=False, ) share_group_snapshot = orm.relationship( "ShareGroupSnapshot", @@ -815,6 +816,7 @@ class ShareSnapshotInstance(BASE, ManilaBase): 'ShareSnapshotInstance.share_group_snapshot_id'), viewonly=True, join_depth=2, + sync_backref=False, ) diff --git a/releasenotes/notes/bug-1924806-sqlalchemy-view-only-relationships-807d406cf8fac06c.yaml b/releasenotes/notes/bug-1924806-sqlalchemy-view-only-relationships-807d406cf8fac06c.yaml new file mode 100644 index 0000000000..1449ab2f02 --- /dev/null +++ b/releasenotes/notes/bug-1924806-sqlalchemy-view-only-relationships-807d406cf8fac06c.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + View-only relationships in database objects have been appropriately + tagged to avoid sqlalchemy deprecation messages flooding the log files. diff --git a/requirements.txt b/requirements.txt index 2c4b275cca..662bf42372 100644 --- a/requirements.txt +++ b/requirements.txt @@ -37,7 +37,7 @@ requests>=2.23.0 # Apache-2.0 retrying!=1.3.0,>=1.2.3 # Apache-2.0 Routes>=2.4.1 # MIT six>=1.15.0 # MIT -SQLAlchemy>=1.3.1 # MIT +SQLAlchemy>=1.3.17 # MIT stevedore>=3.2.2 # Apache-2.0 tooz>=2.7.1 # Apache-2.0 python-cinderclient!=4.0.0,>=3.3.0 # Apache-2.0