I am interested in knowing if I can pass the name of the column in the select statement of MySQL as a parametrized query in python, like
<database_cursor>.execute("select %s from employee_name",("Name",))
I have tried executing the above in python IDLE, but it raised an error. I am assuming that the error is with the double/single quotations of the parametrized query i.e., the "Name" literal
in sql shell, the command works in the way like:
select Name from employee_name
I am assuming python is passing the statement in this format to sql
select "Name" from employee_name
My analysis is that the double quotes of "Name" is causing the issue. Is there any way to fix this problem and get the desired output from python-MySQL