]> git.ipfire.org Git - thirdparty/fastapi/sqlmodel.git/commitdiff
✨ Update GUID handling to use stdlib `UUID.hex` instead of an `int` (#26)
authorAndrew Bolster <me@andrewbolster.info>
Sat, 27 Aug 2022 22:28:09 +0000 (23:28 +0100)
committerGitHub <noreply@github.com>
Sat, 27 Aug 2022 22:28:09 +0000 (00:28 +0200)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
sqlmodel/sql/sqltypes.py

index b3fda87739f79aa683cefca1950b473f0422139f..a9f53ad2867a04bface4541bbcc6e5bf9b8a5ec2 100644 (file)
@@ -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: