--- a/neutron/db/models/segment.py
+++ b/neutron/db/models/segment.py
@@ -69,11 +69,9 @@ class SegmentHostMapping(model_base.BASEV2):
# Add a relationship to the NetworkSegment model in order to instruct
# SQLAlchemy to eagerly load this association
- # Monkey-patch : change the lazy strategy from 'subquery' to 'joined'
- # as MariaDB 10.3 don't use an optimal execution plan with 'subquery'
network_segment = orm.relationship( NetworkSegment, load_on_pending=True, backref=orm.backref("segment_host_mapping",
- lazy='joined',
+ lazy='subquery', cascade='delete'))
revises_on_change = ('network_segment', )
Regarding your last comment, we have used this approach for two ORM objects for stable/ussuri back then:
------- ------- ------- ------- ------- ------- ------- ------- ------- ------- --
--- a/neutron/ db/models/ segment. py db/models/ segment. py ing(model_ base.BASEV2) :
+++ b/neutron/
@@ -69,11 +69,9 @@ class SegmentHostMapp
# Add a relationship to the NetworkSegment model in order to instruct segment = orm.relationship(
NetworkSegmen t, load_on_ pending= True,
backref= orm.backref( "segment_ host_mapping" ,
cascade= 'delete' )) on_change = ('network_segment', )
# SQLAlchemy to eagerly load this association
- # Monkey-patch : change the lazy strategy from 'subquery' to 'joined'
- # as MariaDB 10.3 don't use an optimal execution plan with 'subquery'
network_
- lazy='joined',
+ lazy='subquery',
revises_
------- ------- ------- ------- ------- ------- ------- ------- ------- ------- -- db/models/ segment. py db/models/ segment. py standard_ attr.HasStandar dAttributes,
nullable= True) p(models_ v2.Network,
backref= orm.backref( "segments" ,
cascade= 'delete' )) collections = [segment.SEGMENTS]
--- a/neutron/
+++ b/neutron/
@@ -49,7 +49,7 @@ class NetworkSegment(
network = orm.relationshi
- lazy='subquery',
+ lazy='joined',
api_