Python Create UUID from integer


import uuid
my_uuid = uuid.UUID(int=1)

That should show the following string:


You can also convert back to integer by doing:

For my use case this was needed because my source database has integer based IDs, however the destination database was using UUID based IDs. So converting from integer to UUID was helpful to ensure data can easily be deduplicated.

Review the Python UUID docs for more detailed explanation: Python official docs UUID