Do not enlarge a column solely because “UUIDs have 36 characters” after Data too long. First match the column contract to what the application sends: a hyphenated string, 32 hex digits or 16 binary bytes.
from uuid import UUID
u = UUID("12345678-1234-5678-9abc-123456789abc")
print(len(str(u)), len(u.hex), len(u.bytes))
print(UUID(bytes=u.bytes) == u)
Python 3.12.3 actually printed 36 32 16 and True. This verifies representation lengths and Python round-tripping, not equivalence between 16 text characters and 16 binary bytes. Check the binding type used by the database driver separately.
Keep database products and conversion rules separate
MySQL’s UUID_TO_BIN and BIN_TO_UUID provide storage and reverse conversion. If a swap option is used, both directions must follow the same contract. The MariaDB UUID type, available from MariaDB 10.7, is a separate feature rather than a reason to assume MySQL examples are interchangeable.
Build a small input matrix before altering the schema
Record the version, actual SHOW CREATE TABLE definition and driver binding type; define expected behavior for a valid UUID, malformed input and NULL. Sending str(u) to CHAR(32) violates the representation contract. Sending hex text directly to BINARY(16) is not repaired merely by shortening a string.
In staging, verify input, storage, retrieval and reverse conversion against the original UUID. Evaluate existing data, foreign keys, indexes and lock duration before designing a migration. Disabling strict mode or truncating strings can hide errors and change identifiers. This experiment does not demonstrate a successful database insert or DDL change.