Skip to content

Commit

Permalink
Load treeitems and ogcservers in sqlmalchemy session.identity_map
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaud-morvan committed May 27, 2019
1 parent 046b86f commit 69886a0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions geoportal/c2cgeoportal_geoportal/views/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,9 @@ def _wms_layers(self, ogc_server):
return wms, list(wms.contents), wms_errors

def _load_tree_items(self):
# Populate sqlalchemy session.identity_map to reduce the number of database requests.
self._ogcservers_cache = models.DBSession.query(main.OGCServer).all()
self._treeitems_cache = models.DBSession.query(main.TreeItem).all()
self._layerswms_cache = models.DBSession.query(main.LayerWMS).options(
subqueryload(main.LayerWMS.dimensions), subqueryload(main.LayerWMS.metadatas)
).all()
Expand Down

0 comments on commit 69886a0

Please sign in to comment.