src/risclog/sqlalchemy/cache.py
def _get_model_cache(self, model):
        """
        Return a list of every existing and newly created instance of `model`.
        """
        model_key = self._model_key(model)

        if model_key not in self._cached_instances:
            # Initialize model cache if it doesn't exist yet.
            if model_key in self._preload_models_data:
                query = model.query(*self._preload_models_data[model_key])
            else:
                query = model.query()

            if model_key in self._preload_models_filter:
                query = query.filter(self._preload_models_filter[model_key])

            if self._prefetch is not None and model_key in self._prefetch:
                query = query.options(
                    sqlalchemy.orm.joinedload(
                        *[attr for attr in self._prefetch[model_key]]
                    )
                )

            if self._preload_models:
                self._cached_instances[model_key] = query.all()
            else:
                # XXX: We run a noop DB request here to avoid some
                # hard-to-debug session transaction errors that crop up
                # otherwise.
                self._cached_instances[model_key] = query.limit(0).all()

            self._register_change_handler(model, self._instance_change_handler)

        return self._cached_instances[model_key]

        Return a list of every existing and newly created instance of `model`.
        
Return a list of every existing and newly created instance of `model`.
Return a list of every existing and newly created instance of ` model ` .
def _get_model_cache(self, model):
        model_key = self._model_key(model)
        if model_key not in self._cached_instances:
            if model_key in self._preload_models_data:
                query = model.query(*self._preload_models_data[model_key])
            else:
                query = model.query()
            if model_key in self._preload_models_filter:
                query = query.filter(self._preload_models_filter[model_key])
            if self._prefetch is not None and model_key in self._prefetch:
                query = query.options(
                    sqlalchemy.orm.joinedload(
                        *[attr for attr in self._prefetch[model_key]]
                    )
                )
            if self._preload_models:
                self._cached_instances[model_key] = query.all()
            else:
                self._cached_instances[model_key] = query.limit(0).all()
            self._register_change_handler(model, self._instance_change_handler)
        return self._cached_instances[model_key]
def _get_model_cache ( self , model ) : model_key = self . _model_key ( model ) if model_key not in self . _cached_instances : if model_key in self . _preload_models_data : query = model . query ( * self . _preload_models_data [ model_key ] ) else : query = model . query ( ) if model_key in self . _preload_models_filter : query = query . filter ( self . _preload_models_filter [ model_key ] ) if self . _prefetch is not None and model_key in self . _prefetch : query = query . options ( sqlalchemy . orm . joinedload ( * [ attr for attr in self . _prefetch [ model_key ] ] ) ) if self . _preload_models : self . _cached_instances [ model_key ] = query . all ( ) else : self . _cached_instances [ model_key ] = query . limit ( 0 ) . all ( ) self . _register_change_handler ( model , self . _instance_change_handler ) return self . _cached_instances [ model_key ]
Return a list of every existing and newly created instance of `model`.
Return a list of every existing and newly created instance of ` model ` .
"""
        Return a list of every existing and newly created instance of `model`.
        """ # Initialize model cache if it doesn't exist yet. # XXX: We run a noop DB request here to avoid some # hard-to-debug session transaction errors that crop up # otherwise.
self
model