eager-loading of associations relationship on IPAddress model

This commit is contained in:
Thomas Maddox 2014-10-30 15:53:58 +00:00
parent 07c96b1973
commit 494a3a4ddc

View File

@ -160,7 +160,8 @@ class IPAddress(BASEV2, models.HasId):
address_type = sa.Column(sa.Enum(ip_types.FIXED, ip_types.FLOATING,
ip_types.SHARED,
name="quark_ip_address_types"))
associations = orm.relationship(PortIpAssociation, backref="ip_address")
associations = orm.relationship(PortIpAssociation, backref="ip_address",
lazy='subquery')
def enabled_for_port(self, port):
for assoc in self["associations"]: