Merging context versions in Bigquery

Snowplow creates a separate column for each context (and version) in the raw events table in Bigquery. This is great but sometimes forces you to do complex self joins when you have several versions of a given context.

Some of us (led by @jayantak) at Omio wrote a Python script that generates a Bigquery View DDL to merge multiple context versions together.

I thought some of you may find it useful so sharing it here -