You could put the format string into a query parameter:
sql = "select name, date_format(%s, birthdate) as date from People where name = %" cursor.execute(sql, ("%Y-%m-%d", "Peter"))