Is there an easy/efficient way to create surrogate keys in Snowflake?
Imagine this data set is going to be selected into in a table, during the insertion a battery_id column is added, which is the battery_uuid column mapped to a surrogate key. In this case specific case that could become e.g. [1,1,2,1,1,2,3]. Sequences in Snowflake do not have this functionality, because that becomes e.g. [1,2,3,4,5,6,7]. It is preferable if this mapping is done during the insertion, however, it could also be done after insertion if necessary. As context: This column is added because joins on UUID's are not performant.

If your goal is to turn a string into a number for the purposes of join performance, I recommend leveraging a
HASHfunction. In your case, you could simply create a new column and update the values to be theHASH(battery_uuid)to create a surrogate key. And then leverage that new column for your joins. If your natural key is more than 2 columns, this will still work for you, since theHASHfunction allows for more than a single column to be used.https://docs.snowflake.com/en/sql-reference/functions/hash.html