fuzzymatcher icon indicating copy to clipboard operation
fuzzymatcher copied to clipboard

OperationalError: malformed MATCH expression

Open egolinko opened this issue 6 years ago • 3 comments

What I'm experiencing is when the term 'NOT' is within the string(s) of columns we are trying to join, I'm getting back 'OperationalError: malformed MATCH expression' . My feeling is because there is a SQL dependency for reserved words, example below ought to show error.

The below code snipped ought to reproduce error.

x1=pd.DataFrame(['xyz NOT', 'YES', '425255'], columns=['X'])
x2=pd.DataFrame(['NOT', 'OK', '42525511'], columns=['X'])

fuzzy_left_join(x1,x2, left_on='X', right_on='X')

egolinko avatar Dec 19 '19 14:12 egolinko

I had the same problem here: https://github.com/RobinL/fuzzymatcher/issues/47 He said he fixed it but he must have forgotten about 'NOT'.

soliverc avatar Jan 16 '20 19:01 soliverc

He said he fixed it but he must have forgotten about 'NOT'.

I believe you are right. Anywhere the word 'not' is mentioned in my data it gives me an error. I've tried removing those entries one by one and that error for that particular entry goes away. However I still haven't been able to get rid of the error completely yet.

But yeah, seconding this. Still looking for a way around this. Would appreciate some tips.

SidSaxena avatar Aug 30 '20 18:08 SidSaxena

It's fixed here on GitHub but when you install the package via pip, it seems that takes an older version. You just have to edit the file fuzzymatcher/data_getter_sqlite.py and in the line 180, add the "NOT" token to escape: tokens_to_escape = ["AND", "OR", "NEAR", "NOT"] You can look for the location of the package with the command "pip show fuzzymatcher"

michelsantanalpa avatar Dec 10 '20 23:12 michelsantanalpa