I have a df with clients and products, and I have to get all information about this items from SQL Server, but I have to parsed with substring, because DateBase contains product path, like this:
productpath:
fruits/apple
vegetables/tomato
And list of my products looks like this, but real list contains more than 1000 values:
df['prod']= ['apple', 'orange', 'tomato']
So I decided to use this code:
sql_sales = """
SELECT
date,
client,
productpath,
cost
FROM all_sales
WHERE
client == %(c1)s
AND productpath LIKE '%%(prod)s%'
"""
And I've got mistake with using LIKE with this part '%%(prod)s%' like this:
not enough arguments for format string unable to rollback
Without LIKE-part it is working
client ==isn't valid syntax. T-SQL uses=for both assignment and comparison.productpathhave several '\' in it?