From cd90626f1dbf278989e6284a651fa1d6378c01fc Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 30 Nov 2024 12:26:56 -0600 Subject: [PATCH] feat: make v7 UUID values instead of v1 this is thanks to the presentation at https://www.youtube.com/watch?v=n9Cxs0sTqEY the basic rationale is that: - v1 UUID is "less private" in that MAC address can be deduced - v7 UUID has "better index performance" per sortable prefix we also need to store these as true UUID data type in postgres, but that will be a separate effort.. --- pyproject.toml | 1 + src/wuttjamaican/util.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7415569..3f68a36 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,6 +32,7 @@ dependencies = [ "progress", "python-configuration", "typer", + "uuid7", ] diff --git a/src/wuttjamaican/util.py b/src/wuttjamaican/util.py index 342868e..48c321d 100644 --- a/src/wuttjamaican/util.py +++ b/src/wuttjamaican/util.py @@ -28,7 +28,8 @@ import importlib import logging import os import shlex -from uuid import uuid1 + +from uuid_extensions import uuid7 log = logging.getLogger(__name__) @@ -176,7 +177,7 @@ def make_uuid(): :returns: A 32-character hex string. """ - return uuid1().hex + return uuid7().hex def parse_bool(value):