How to Compile MySQL's "ON DUPLICATE KEY UPDATE" in SQL Alchemy

by  Tim Henderson

This snippet contains a well tested way to compile an "Upsert" statement for MySQL in SQL Alchemy. I have found it useful for several project and I am making it available via this gist for others to enjoy and improve. Unlike some other examples out there this one supports doing a bulk insert.