(self, *args, **kwargs)
return query.options(selectin_polymorphic(
            VulnerabilityGeneric,
            [Vulnerability, VulnerabilityWeb]
        ), *options)
Eager hostnames loading.

        This is too complex to get_joinedloads so I have to
        override the function
Eager hostnames loading.
Eager hostnames loading .
def _get_eagerloaded_query(self, *args, **kwargs):
        """Eager hostnames loading.

        This is too complex to get_joinedloads so I have to
        override the function
        """
        query = super()._get_eagerloaded_query(
            *args, **kwargs)
        options = [
            joinedload(Vulnerability.host)
                .load_only(Host.id)  # Only hostnames are needed
                .joinedload(Host.hostnames),

            joinedload(Vulnerability.service)
                .joinedload(Service.host)
                .joinedload(Host.hostnames),

            joinedload(VulnerabilityWeb.service)
                .joinedload(Service.host)
                .joinedload(Host.hostnames),
            joinedload(VulnerabilityGeneric.update_user),
            undefer(VulnerabilityGeneric.creator_command_id),
            undefer(VulnerabilityGeneric.creator_command_tool),
            undefer(VulnerabilityGeneric.target_host_ip),
            undefer(VulnerabilityGeneric.target_host_os),
            joinedload(VulnerabilityGeneric.tags),
        ]

        if flask.request.args.get('get_evidence'):
            options.append(joinedload(VulnerabilityGeneric.evidence))
        else:
            options.append(noload(VulnerabilityGeneric.evidence))

        return query.options(selectin_polymorphic(
            VulnerabilityGeneric,
            [Vulnerability, VulnerabilityWeb]
        ), *options)
def _get_eagerloaded_query ( self , * args , * * kwargs ) : query = super ( ) . _get_eagerloaded_query ( * args , * * kwargs ) options = [ joinedload ( Vulnerability . host ) . load_only ( Host . id ) # Only hostnames are needed . joinedload ( Host . hostnames ) , joinedload ( Vulnerability . service ) . joinedload ( Service . host ) . joinedload ( Host . hostnames ) , joinedload ( VulnerabilityWeb . service ) . joinedload ( Service . host ) . joinedload ( Host . hostnames ) , joinedload ( VulnerabilityGeneric . update_user ) , undefer ( VulnerabilityGeneric . creator_command_id ) , undefer ( VulnerabilityGeneric . creator_command_tool ) , undefer ( VulnerabilityGeneric . target_host_ip ) , undefer ( VulnerabilityGeneric . target_host_os ) , joinedload ( VulnerabilityGeneric . tags ) , ] if flask . request . args . get ( 'get_evidence' ) : options . append ( joinedload ( VulnerabilityGeneric . evidence ) ) else : options . append ( noload ( VulnerabilityGeneric . evidence ) ) return query . options ( selectin_polymorphic ( VulnerabilityGeneric , [ Vulnerability , VulnerabilityWeb ] ) , * options )