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

Feature request: Support UUID data type #279

Closed
havardthom opened this issue Dec 1, 2021 · 0 comments
Closed

Feature request: Support UUID data type #279

havardthom opened this issue Dec 1, 2021 · 0 comments

Comments

@havardthom
Copy link
Contributor

havardthom commented Dec 1, 2021

Would love support for UUID data type. Current situation:

import pprint
import uuid

from deepdiff import DeepDiff

t1 = {"id": uuid.uuid4()}
t2 = {"id": uuid.uuid4()}

result = DeepDiff(t1, t2)

pprint.pprint(result)

{'values_changed': {"root['id'].int": {'new_value': 117850254076634266241219085205683222228,
                                       'old_value': 91358784609380289177662098655200634313}}}

This causes problems for me since an unexpected int is appended to path, and dumping result as json will crash due to Integer exceeds 64-bit range. Would be great if result could rather be something like:

{'values_changed': {"root['id']": {'new_value': UUID(...),
                                   'old_value': UUID(...)}}}

I've added exclude_types={UUID} to work around my problems for now.

Docs mentions support for custom objects, but I didn't find any examples

Supported data types
int, string, unicode, dictionary, list, tuple, set, frozenset, OrderedDict, NamedTuple, Numpy, custom objects and more!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants