Example #1
0
 def remove(self, wifi_keys):
     # BBB this might still get namedtuples encoded as a dicts for
     # one release, afterwards it'll get wifi hashkeys
     keys = [Wifi.to_hashkey(key=wifi['key']) for wifi in wifi_keys]
     query = Wifi.querykeys(self.session, keys)
     length = query.delete(synchronize_session=False)
     return length
Example #2
0
    def _query_database(self, wifi_keys):
        queried_wifis = []
        if len(wifi_keys) >= MIN_WIFIS_IN_QUERY:
            keys = [Wifi.to_hashkey(key=key) for key in wifi_keys]
            try:
                load_fields = ('key', 'lat', 'lon', 'range')
                query = (Wifi.querykeys(self.session_db, keys).options(
                    load_only(*load_fields)).filter(
                        Wifi.lat.isnot(None)).filter(Wifi.lon.isnot(None)))
                queried_wifis = query.all()
            except Exception:
                self.raven_client.captureException()

        return queried_wifis
Example #3
0
    def _query_database(self, wifi_keys):
        queried_wifis = []
        if len(wifi_keys) >= MIN_WIFIS_IN_QUERY:
            keys = [Wifi.to_hashkey(key=key) for key in wifi_keys]
            try:
                load_fields = ('key', 'lat', 'lon', 'range')
                query = (Wifi.querykeys(self.session_db, keys)
                             .options(load_only(*load_fields))
                             .filter(Wifi.lat.isnot(None))
                             .filter(Wifi.lon.isnot(None)))
                queried_wifis = query.all()
            except Exception:
                self.raven_client.captureException()

        return queried_wifis
Example #4
0
 def remove(self, wifi_keys):
     query = Wifi.querykeys(self.session, wifi_keys)
     length = query.delete(synchronize_session=False)
     return length
Example #5
0
 def remove(self, wifi_keys):
     query = Wifi.querykeys(self.session, wifi_keys)
     length = query.delete(synchronize_session=False)
     return length