Created
April 23, 2020 21:06
-
-
Save jriquelme/5d7e1a215ebf5fba41528ca6da06f68c to your computer and use it in GitHub Desktop.
Redshift UDF in Python to get an UUID v5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Use: | |
-- select f_py_uuid5('30fb0513-dddf-4801-ac98-dacc8b7953e5', '[email protected]'); | |
-- > d6d2210e-b94c-5a26-95b7-ccf97f29ad1f | |
create or replace function f_py_uuid5(namespace varchar, name varchar) | |
returns varchar | |
immutable | |
as $$ | |
import uuid | |
return uuid.uuid5(uuid.UUID(namespace), name).__str__() | |
$$ language plpythonu; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment