danD
danD

Reputation: 716

add uuid column in snowflake table after loading

We have a table in snowflake which is already loaded and now we need to add a unique identifier(UUID) column in the table.

We are trying to achieve this by adding a uuid column in snowflake and then updating the value.

Alter table xyz add column(uuidx String)

update xyz
Set uuidx = string_uuid()

Will it be safe to say all the column value in this new field will be unique. I tested it by updating a table with 999999 record and it came out to be unique. However no where in snowflake document it says how it works. So I am not able to assure it will be unique in any case.

If it is not the safe way then please suggest the best approach

Upvotes: 1

Views: 449

Answers (1)

Dave Welden
Dave Welden

Reputation: 1918

By definition UUIDs are universally unique across space and time. See UUID - Wikipedia for more information. Snowflake documentation assurance is "Generates either a version 4 (random) or version 5 (named) RFC 4122-compliant UUID as a formatted string". The generated UUIDs would not be RFC-4122 compliant if not unique.

Upvotes: 1

Related Questions