I'm building a database to hold a uuid generated by the python uuid4
method - however, the documentation doesn't mention how many chars the uuid is!
I'm not overly familiar with uuids, so i don't know if all languages generate the same length for a uuid.
There is a standard for UUIDs, so they're the same in all languages. However, there is a string representation and a binary representation. The normal string representation (str(myuuid)
) looks like 42c151a8-b22b-4cd5-b103-21bdb882e489
and is 36 characters. The binary representation, myuuid.bytes
(or bytes_le
, but stay consistent with it when reconstructing the UUID objects), is 16 bytes. You can also get the string representation with no hyphens (32 characters) with myuuid.hex
.
You should be aware that some databases have a specific UUID type for storing UUIDs. What kind of database are you using?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With