passing dynamic sql queries involving double quotes in data through python

by Varen   Last Updated December 14, 2017 13:06 PM

Table is like:

ID   Text_Column
1    "Jason"
2    Jason Harvey
3    "Ramsy"

I wrote dynamic variable query like

SELECT bla bla FROM bla_table
WHERE col1 IN ('"""+dynamic_var_here+"""', 'CONCAT('"',"""+dynamic_var_here""",'"')')

Due to another code section being dependent on the rows of my table I have removed the double quotes from the values which is being passed to the dynamic varibale here.

So, basically I need that the "IN" part checks both the values i.e. Jason and "Jason", whichever is present and thus accordingly makes decision.

However, I get an empty result for above code. I think there is some problem with the CONCAT section the way I have written it but not sure where.

Tags : mysql-5.5 python


Related Questions



Connection pooling with python mysql-connector

Updated March 27, 2017 17:06 PM


My functions output will not appear in my Database

Updated April 21, 2018 15:06 PM