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

keep full schema in cachew instead of just outer type #59

Open
karlicoss opened this issue Nov 8, 2023 · 0 comments
Open

keep full schema in cachew instead of just outer type #59

karlicoss opened this issue Nov 8, 2023 · 0 comments

Comments

@karlicoss
Copy link
Owner

After recent google_takeout_parser update getting this:

...
  File "/home/hpi/.local/lib/python3.12/site-packages/cachew/marshall/cachew.py", line 143, in load
    tidx, val = dct
                └ 62.81359

TypeError: cannot unpack non-iterable float object

Seems that this is because we switched some PlaceVisit fields to Optional -- so now it tries to unpack a float as a Union (which Optional is a special case of).
Normally cachew would invalidate the cache in this case (since we keep the previous schema in the database)

schema = str(self.cls_)

However seems that it is

 "schema": "typing.Union[google_takeout_parser.models.PlaceVisit, Exception]"`

, so if any of fields of PlaceVisit changed, this wouldn't have any impact.

I think we need to dump the datatype recursively in schema (with all field names etc -- doesn't hurt?) instead.

In the meantime for google_takeout_parser should be solvable by bumping google_takeout_version since it's also included in the cache key. cc @seanbreckenridge just in case you encounter this

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

1 participant