From 5ea9340def1f2580c919c8be10024aeaeb5d038c Mon Sep 17 00:00:00 2001 From: Andrew Bolster Date: Sat, 27 Aug 2022 23:28:09 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Update=20GUID=20handling=20to=20use?= =?UTF-8?q?=20stdlib=20`UUID.hex`=20instead=20of=20an=20`int`=20(#26)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sebastián Ramírez --- sqlmodel/sql/sqltypes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlmodel/sql/sqltypes.py b/sqlmodel/sql/sqltypes.py index b3fda87..a9f53ad 100644 --- a/sqlmodel/sql/sqltypes.py +++ b/sqlmodel/sql/sqltypes.py @@ -47,10 +47,10 @@ class GUID(TypeDecorator): # type: ignore return str(value) else: if not isinstance(value, uuid.UUID): - return f"{uuid.UUID(value).int:x}" + return uuid.UUID(value).hex else: # hexstring - return f"{value.int:x}" + return value.hex def process_result_value(self, value: Any, dialect: Dialect) -> Optional[uuid.UUID]: if value is None: