From: Andrew Bolster Date: Sat, 27 Aug 2022 22:28:09 +0000 (+0100) Subject: ✨ Update GUID handling to use stdlib `UUID.hex` instead of an `int` (#26) X-Git-Tag: 0.0.7~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ea9340def1f2580c919c8be10024aeaeb5d038c;p=thirdparty%2Ffastapi%2Fsqlmodel.git ✨ Update GUID handling to use stdlib `UUID.hex` instead of an `int` (#26) Co-authored-by: Sebastián Ramírez --- diff --git a/sqlmodel/sql/sqltypes.py b/sqlmodel/sql/sqltypes.py index b3fda877..a9f53ad2 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: