We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a84a6a6 commit 4c9d63aCopy full SHA for 4c9d63a
1 file changed
src/dstack/_internal/utils/json_utils.py
@@ -1,3 +1,4 @@
1
+import asyncpg.pgproto.pgproto
2
import orjson
3
from pydantic import BaseModel
4
@@ -8,6 +9,13 @@
8
9
FREEZEGUN = False
10
11
12
+ASYNCPG = True
13
+try:
14
+ import asyncpg.pgproto.pgproto
15
+except ImportError:
16
+ ASYNCPG = False
17
+
18
19
def orjson_default(obj):
20
if isinstance(obj, float):
21
# orjson does not convert float subclasses be default
@@ -16,6 +24,9 @@ def orjson_default(obj):
24
# Allows calling orjson.dumps() on pydantic models
25
# (e.g. to return from the API)
26
return obj.dict()
27
+ if ASYNCPG:
28
+ if isinstance(obj, asyncpg.pgproto.pgproto.UUID):
29
+ return str(obj)
30
if FREEZEGUN:
31
if isinstance(obj, FakeDatetime):
32
return obj.isoformat()
0 commit comments