Skip to content

Commit

Permalink
feat: BI-5791 orjson for marshmallow
Browse files Browse the repository at this point in the history
  • Loading branch information
ForrestGump committed Nov 2, 2024
1 parent bc5d6f1 commit 828d4e3
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/dl_core/dl_core/us_manager/storage_schemas/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import enum
import orjson
from typing import (
TYPE_CHECKING,
Any,
Expand Down Expand Up @@ -95,6 +96,9 @@ def post_dump(self, data: Dict[str, Any], **_) -> Dict[str, Any]: # type: ignor


class DefaultStorageSchema(BaseStorageSchema[_TARGET_TV], Generic[_TARGET_TV]):
class Meta:
render_module = orjson

def to_object(self, data: dict) -> _TARGET_TV:
return self.get_target_cls()(**data)

Expand Down
2 changes: 2 additions & 0 deletions lib/dl_core/dl_core/us_manager/us_manager_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,13 @@ def get_raw_collection(
entry_scope: str,
entry_type: Optional[str] = None,
all_tenants: bool = False,
creation_time: Optional[dict[str, Union[str, int, None]]] = None,
) -> AsyncIterable[dict]:
return self._us_client.entries_iterator(
scope=entry_scope,
entry_type=entry_type,
all_tenants=all_tenants,
creation_time=creation_time,
include_data=False,
)

Expand Down
1 change: 1 addition & 0 deletions lib/dl_core/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ marshmallow = ">=3.19.0"
marshmallow-oneofschema = ">=3.0.1"
multidict = ">=4.0"
opentracing = ">=2.4.0"
orjson = ">=3.9.15"
python = ">=3.10, <3.13"
python-dateutil = ">=2.8.2"
pytz = ">=2022.7.1"
Expand Down
67 changes: 67 additions & 0 deletions metapkg/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 828d4e3

Please sign in to comment.