You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be good to have some support for versions of objects as users may change their classes or change the way that they store the state in the database.
The proposition is as follows:
Add a VERSION class attribute to SavableObject and TypeHelper that is expected to be an integer >= 0
Encourage users to add a special _version key to their saved state dictionary (if it's not a dict they will have to 'promote' it to one and store the current value within)
Now, when a user gets a state dict in load_instance_state they can interrogate the _version value and have logic that handles the various versions. If they absoloutely cannot handle the version they've been given they can raise a new UnsupportedVersion exception and provide an explanation to the user. This should be discouraged as it's effectively the end of the road for getting the data to be read.
The text was updated successfully, but these errors were encountered:
It would be good to have some support for versions of objects as users may change their classes or change the way that they store the state in the database.
The proposition is as follows:
VERSION
class attribute toSavableObject
andTypeHelper
that is expected to be an integer>= 0
_version
key to their saved state dictionary (if it's not a dict they will have to 'promote' it to one and store the current value within)Now, when a user gets a state dict in
load_instance_state
they can interrogate the_version
value and have logic that handles the various versions. If they absoloutely cannot handle the version they've been given they can raise a newUnsupportedVersion
exception and provide an explanation to the user. This should be discouraged as it's effectively the end of the road for getting the data to be read.The text was updated successfully, but these errors were encountered: