fastapi-utils icon indicating copy to clipboard operation
fastapi-utils copied to clipboard

[QUESTION] GUID Type: Use UUID.hex instead of UUID.int?

Open ppo opened this issue 5 years ago • 0 comments

For the GUID Type, the code from SQLAlchemy says that for non-PostgreSQL databases, it's "storing as stringified hex values"… but as far as I understand this code, it's actually storing as 128-bit integer because UUID.int is used.

It should use UUID.hex.

u = uuid4()  # UUID('33be8037-6c92-41d3-a5f7-018fa1175354')
u.int        # 68779764727731727554280205683269260116
u.hex        # '33be80376c9241d3a5f7018fa1175354'

ppo avatar Nov 22 '20 03:11 ppo