fix: resolve UUID JSON serialization error in checkpoint creation
Issue: - Object of type <class 'uuid.UUID'> is not JSON serializable error when creating checkpoints - UUID objects in database records couldn't be serialized to JSON Solution: - Updated json_serializer function in create_checkpoint() to properly handle UUID types - Added explicit isinstance check for uuid.UUID before checking for isoformat - Ensures all UUID values are converted to strings before JSON serialization This ensures checkpoints can be created successfully with all database data types. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
7ddec0fb4f
commit
1fa9385d02
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"checkpoint_id": "checkpoint_20251030_115009",
|
||||
"timestamp": "20251030_115009",
|
||||
"description": "1",
|
||||
"tables": {
|
||||
"business_scopes": [
|
||||
{
|
||||
"id":
|
||||
|
|
@ -438,7 +438,14 @@ def create_checkpoint(description: str = "") -> Dict[str, Any]:
|
|||
|
||||
def json_serializer(obj):
|
||||
"""Convert non-JSON serializable objects to strings."""
|
||||
if hasattr(obj, 'isoformat'): # UUID, datetime, etc.
|
||||
try:
|
||||
import uuid
|
||||
if isinstance(obj, uuid.UUID):
|
||||
return str(obj)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
if hasattr(obj, 'isoformat'):
|
||||
return str(obj)
|
||||
raise TypeError(f"Object of type {type(obj)} is not JSON serializable")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue