CREATE TEMP FUNCTION to_uuid(x STRING)
RETURNS STRING
AS (
concat(substr(to_hex(md5(x)),1,8),
"-", substr(to_hex(md5(x)),9,4),
"-", to_hex(substr(md5(x),7,1) & b'\x0f' | b'\x30'), substr(to_hex(md5(x)),15,2),
"-", to_hex(substr(md5(x),9,1) & b'\x3f' | b'\x80'), substr(to_hex(md5(x)),19,2),
"-", substr(to_hex(md5(x)),21,12)
)
);