Include CellMapping in InstanceMapping object
Right now InstanceMapping exposes the cell_mappings.id db field which is just an implementation detail of the db relationship and should not be exposed in the object. It is also useless as a way to look up the actual CellMapping through that object interface. And InstanceMapping is only looked up in order to find a CellMapping. So the CellMapping should be joined during the db query and loaded on the InstanceMapping object by default. Change-Id: Ia8691b76bba310327bfe0995964525409794d1af
This commit is contained in:
parent
208fd5560f
commit
62c94408af
@ -68,6 +68,10 @@ class InstanceMapping(API_BASE):
|
||||
cell_id = Column(Integer, ForeignKey('cell_mappings.id'),
|
||||
nullable=True)
|
||||
project_id = Column(String(255), nullable=False)
|
||||
cell_mapping = orm.relationship('CellMapping',
|
||||
backref=backref('instance_mapping', uselist=False),
|
||||
foreign_keys=cell_id,
|
||||
primaryjoin=('InstanceMapping.cell_id == CellMapping.id'))
|
||||
|
||||
|
||||
class HostMapping(API_BASE):
|
||||
|
Loading…
Reference in New Issue
Block a user