Custom Serialization (#486)
Add support for using custom serializers and deserializers in DBOS
Python. You can now supply a custom serializer in DBOS configuration,
which completely replaces the default `pickle`-based serializer for
storing objects in the system database.
For example, here's how you would use a JSON serializer:
```python
from dbos import DBOS, DBOSConfig, Serializer
class JsonSerializer(Serializer):
def serialize(self, data: Any) -> str:
return json.dumps(data)
def deserialize(cls, serialized_data: str) -> Any:
return json.loads(serialized_data)
serializer = JsonSerializer()
config: DBOSConfig = {
"name": "dbos-starter",
"system_database_url": os.environ.get("DBOS_SYSTEM_DATABASE_URL"),
"serializer": serializer
}
DBOS(config=config)
DBOS.launch()
```
Addresses https://github.com/dbos-inc/dbos-transact-py/issues/485 P
Peter Kraft committed
cb51bbed31eef247a31378bf57c1b285bb7631ba
Parent: 1887532
Committed by GitHub <noreply@github.com>
on 10/8/2025, 7:49:29 PM