Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

处理clickhouse特殊数据类型序列化问题 #1525

Merged
merged 2 commits into from
May 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions common/utils/extend_json_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from decimal import Decimal
from datetime import datetime, date, timedelta
from functools import singledispatch
from ipaddress import IPv4Address, IPv6Address
from uuid import UUID


@singledispatch
Expand Down Expand Up @@ -41,6 +43,21 @@ def _(o):
return list(o)


@convert.register(UUID)
def _(o):
return str(o)


@convert.register(IPv4Address)
def _(o):
return str(o)


@convert.register(IPv6Address)
def _(o):
return str(o)


class ExtendJSONEncoder(json.JSONEncoder):
def default(self, obj):
try:
Expand Down