In particular I would like to call the Postgres levenshtein
function.
I would like to write the blaze query to return words similar to the word 'similar', ie the equivalent of:
select word from wordtable where levenshtein(word, 'similar') < 3;
In Blaze this should look something like
db.wordtable.word[levenshtein(db.wordtable.word, 'similar') < 3]
but levenshtein
is not defined in any module I am importing on the python side.
Where/how do I get a levenshtein
definition for use in Blaze expressions on the Python side?
I have found the sqlalchemy.sql.func
package which provides Python handles for SQL functions for use with SqlAlchemy, but these do not work in Blaze expressions. Is there an equivalent Blaze package, or how can I use sqlalchemy.sql.func.levenshtein
inside a Blaze expression?
PyPi is your friend. Searching there finds the python-Levenshtein package. If you're on windows and want a precompiled version, use Christoph Gohlke's wheel (his builds are safe, reliable, and correct; numpy builds use the MKL libraries, so they're fast too!).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With