Code setup according to examples found here:
for ICAO_COUNTRY in ['GM','DA','DT']:
table='aerodrome'
query = 'delete from %s where code_icao regexp "%s[A-Z][A-Z]"'
cursor.execute(query,(table,ICAO_COUNTRY))
gives for answer
Traceback (most recent call last):
File "bin/cleanup2", line 22, in <module>
cursor.execute(query,(table,ICAO_COUNTRY))
File "/usr/lib/python2.7/dist-packages/mysql/connector/cursor.py", line 491, in execute
self._handle_result(self._connection.cmd_query(stmt))
File "/usr/lib/python2.7/dist-packages/mysql/connector/connection.py", line 635, in cmd_query statement))
File "/usr/lib/python2.7/dist-packages/mysql/connector/connection.py", line 553, in _handle_result
raise errors.get_exception(packet)
mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''aerodrome' where code_icao regexp "'GM'[A-Z][A-Z]"' at line 1
It seems to me that the single quotes get transferred to the MySql engine, this is not what I want.