-
Hey, I’m considering going with uuid7 for a database primary key. I know it won’t be as efficient as as auto number due to the size etc but I think this is I’ll help solve the clustered index issue. I tried to extract the timestamp from the generated uuid. Does the time method return the ns since epoch? The values I’m seeing on my machine are kind of strange and don’t seem to represent the current time. Maybe I’m just missing something? Any help much appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hey @murtaghj , import uuid_utils
b = uuid_utils.uuid7().bytes
millis = b[0] << 40 | b[1] << 32 | b[2] << 24 | b[3] << 16 | b[4] << 8 | b[5]
print(millis) I think this is a useful method, I will add it to the public methods to make it easier with |
Beta Was this translation helpful? Give feedback.
-
Added it in #22 |
Beta Was this translation helpful? Give feedback.
Hey @murtaghj ,
I think you can use the following snippet to get it:
I think this is a useful method, I will add it to the public methods to make it easier with
uuid_utils.uuid7().timestamp
or something