I am trying to query Redshift using Python.
I am generating a query string which looks like the one below:
I am using psycopg2 as the library to establish the connection.
Select lat, lon, gender from table_x where x_name = "namestring"
If my name string contains an ', the query string fails to execute.
Can someone tell me a way to avoid this error? I have a list of approximately 25k names and hence escaping each of them with a \' is not an option.
''inside the query string.