Skip to content

Commit

Permalink
support structure dataclass and flytescheme with DataClassJSONMixin
Browse files Browse the repository at this point in the history
Signed-off-by: hhcs9527 <hhcs9527@gmail.com>
  • Loading branch information
hhcs9527 committed Aug 6, 2023
1 parent 70149cc commit fcc0a0d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions flytekit/types/schema/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from flytekit.loggers import logger
from flytekit.models.literals import Literal, Scalar, Schema
from flytekit.models.types import LiteralType, SchemaType
from mashumaro.mixins.json import DataClassJSONMixin

T = typing.TypeVar("T")

Expand Down Expand Up @@ -179,9 +180,8 @@ def get_handler(cls, t: Type) -> SchemaHandler:
return cls._SCHEMA_HANDLERS[t]


@dataclass_json
@dataclass
class FlyteSchema(object):
class FlyteSchema(DataClassJSONMixin):
remote_path: typing.Optional[str] = field(default=None, metadata=config(mm_field=fields.String()))
"""
This is the main schema class that users should use.
Expand Down
4 changes: 2 additions & 2 deletions flytekit/types/structured/structured_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from flytekit.models import types as type_models
from flytekit.models.literals import Literal, Scalar, StructuredDatasetMetadata
from flytekit.models.types import LiteralType, SchemaType, StructuredDatasetType
from mashumaro.mixins.json import DataClassJSONMixin

if typing.TYPE_CHECKING:
import pandas as pd
Expand All @@ -43,9 +44,8 @@
GENERIC_PROTOCOL: str = "generic protocol"


@dataclass_json
@dataclass
class StructuredDataset(object):
class StructuredDataset(DataClassJSONMixin):
"""
This is the user facing StructuredDataset class. Please don't confuse it with the literals.StructuredDataset
class (that is just a model, a Python class representation of the protobuf).
Expand Down

0 comments on commit fcc0a0d

Please sign in to comment.