Skip to content

Conversation

@kraftp
Copy link
Member

@kraftp kraftp commented Oct 7, 2025

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:

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 #485

@kraftp kraftp marked this pull request as ready for review October 7, 2025 23:38
@dosubot
Copy link

dosubot bot commented Oct 7, 2025

Related Documentation

Checked 7 published document(s). No updates required.

How did I do? Any feedback?  Join Discord

Copy link
Member

@qianl15 qianl15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR looks good! I wonder if we want to add some guardrails or warnings for serializers before using it in workflows. For example, if there's a bug in their serializer then the workflows are not recoverable...

@kraftp
Copy link
Member Author

kraftp commented Oct 8, 2025

PR looks good! I wonder if we want to add some guardrails or warnings for serializers before using it in workflows. For example, if there's a bug in their serializer then the workflows are not recoverable...

Yeah, if you're bringing in a custom serializer it's your responsibility to make sure it's correct, but if deserialization fails there will be clear errors in the recovered workflow.

@kraftp kraftp merged commit cb51bbe into main Oct 8, 2025
8 checks passed
@kraftp kraftp deleted the kraftp/custom-serializer branch October 8, 2025 19:49
@dosubot
Copy link

dosubot bot commented Oct 8, 2025

Documentation Updates

Checked 7 published document(s). No updates required.

How did I do? Any feedback?  Join Discord

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants