'Override `save` to optionally mask out the query from being saved to the
database. This is because if the beeswax database contains sensitive
information like personally identifiable information, that information
could be leaked into the Hue database and logfiles.'

def save(self, *args, **kwargs):

    if global_redaction_engine.is_enabled():
        data = json.loads(self.data)
        try:
            query = data['query']['query']
        except KeyError:
            pass
        else:
            redacted_query = global_redaction_engine.redact(query)
            if (query != redacted_query):
                data['query']['query'] = redacted_query
                self.is_redacted = True
                self.data = json.dumps(data)
    super(SavedQuery, self).save(*args, **kwargs)
