The fuzzy query in the pip documentation is not working. Changing a little bit to the Manager class (change "==" in the query function to "ilike") solves this problem.
class BetterManager(Manager):
def __init__(self, dbfile, logger=None):
super().__init__(dbfile, logger)
def fuzzy_query(self, Meta, key=None, value=None):
query = self.session.query(Meta)
if key:
if key not in Meta.__dict__:
self.logger.warning(f'unavailable key: {key}')
return None
else:
query = query.filter(Meta.__dict__[key].ilike(value))
return query
The fuzzy query in the pip documentation is not working. Changing a little bit to the Manager class (change "==" in the query function to "ilike") solves this problem.