Making save operations robust #146
Replies: 1 comment 6 replies
-
hmmm... the problem actually is that our Also, another complexity is, if we allow attributes such as |
Beta Was this translation helpful? Give feedback.
-
hmmm... the problem actually is that our Also, another complexity is, if we allow attributes such as |
Beta Was this translation helpful? Give feedback.
-
We had a brief discussion of this topic in our meeting last week, but I have a followup that I think is appropriate here in github.
Recall in our discussion I initially argued a save operator was not black and white (success or fail) but couldn't recreate an example on the spot of an example that was no black just success of failure. In writing the CRUD section of the user manual, however, realized there is a clear situation we need to handle that is not a pure 100% success of failure.
Suppose a user wrote a custom algorithm that altered one of the normalized attributes. To be concrete suppose they estimate a revised location for an earthquake from a moment tensor inversion and naively decide they can just post the new estimate to source_lat, source_lon, source_depth, and source_time.
The topic for discussion is what should happen when this user makes this kind of mistake? A range of actions are:
This leaves open the question of what, if anything, a save method should return? The old school way would be this:
-1 if the save failed completely
0 for success
+n where n is the number of nonfatal errors logged during the save
The alternative is something like a tuple or a special dbsave return class. To me a simple integer return is fine, but I am old school.
Beta Was this translation helpful? Give feedback.
All reactions