if len(args) > 0:
    cursor.execute('SELECT ' + ', '.join(['quote(?)' for i in args]), args)
quoted_values = cursor.fetchone()
for quoted_value in quoted_values:
    pass
Python SQLite how to get SQL string statement being executed