docs: def compile_insert_on_duplicate_key_update(insert: Insert,
                                             compiler: SQLCompiler,
                                             **kw) -> str:
      """
      Hooks into the use of the :class:`InsertOnDuplicate` class
      for the MySQL dialect. Compiles the relevant SQL for an ``INSERT...
      ON DUPLICATE KEY UPDATE`` statement.
  
      Notes:
   
      - We can't get the fieldnames directly from ``insert`` or ``compiler``.
      - We could rewrite the innards of the visit_insert statement
        (https://github.com/bedwards/sqlalchemy_mysql_ext/blob/master/duplicate.py)... 
        but, like that, it will get outdated.
      - We could use a hack-in-by-hand method
        (http://stackoverflow.com/questions/6611563/sqlalchemy-on-duplicate-key-update)
        ... but a little automation would be nice.
      - So, regex to the rescue.
      - NOTE THAT COLUMNS ARE ALREADY QUOTED by this stage; no need to repeat.
      """  # noqa
      # log.critical(compiler.__dict__)
      # log.critical(compiler.dialect.__dict__)
      # log.critical(insert.__dict__)
      s = compiler.visit_insert(insert, **kw)
      # log.critical(s)
      m = RE_INSERT_FIELDNAMES.match(s)
      if m is None:
          raise ValueError("compile_insert_on_duplicate_key_update: no match")
      columns = [c.strip() for c in m.group('columns').split(",")]
      # log.critical(columns)
      updates = ", ".join(
          ["{c} = VALUES({c})".format(c=c) for c in columns])
      s += ' ON DUPLICATE KEY UPDATE {}'.format(updates)
      # log.critical(s)
      return s