I have one function(token_sort_ratio()) in python which compares two strings and gives the output as percentage match between them. I want to use that function in sql query which i'm running in python using pyodbc. But i cannot achieve it. Can anyone help me doing that.? Here is my code
cursor = conn.cursor()
sql_query ="""select """+fuzz.token_sort_ratio("""[MAT DESC],MAT_GROUP_DESC""")+""" as percentage_match ,[MAT DESC] MAT_GROUP_DESC from Sample_data """
cursor.execute(sql_query)
rows = cursor.fetchall()