Skip to content

Commit

Permalink
add raw serializer to cli
Browse files Browse the repository at this point in the history
  • Loading branch information
Swen committed Sep 9, 2021
1 parent 766303c commit e49e1a4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
14 changes: 14 additions & 0 deletions esque/cli/commands.py
Expand Up @@ -1191,6 +1191,20 @@ def io(input_uri: str, output_uri: str):
\b
Available Serializers:
- raw
Doesn't deserialize the message payload and ignores the schema. Basically transfers messages 1:1.
Useful if you don't need to do any transformations and just want to get data from A to B without the overhead of
serialization, deserialization and schema handling.
WARNING: Be careful with data that has a schema which was or has to be registered by a schema registry!
This binary data is usually prefixed with a schema id that is valid only for one specific registry
instance. Transferring it to a different cluster 1:1 most likely makes it unable to be deserialized
because of two reasons:
1. The schema id is from another schema registry instance and either doesn't exist on the target or
refers to the wrong schema.
2. The schema was not registered for the target subject in the target schema registry.
Supported Parameters:
none
- json
Supported Parameters:
* indent
Expand Down
2 changes: 2 additions & 0 deletions esque/io/serializers/__init__.py
Expand Up @@ -3,6 +3,7 @@
from esque.io.exceptions import EsqueIOSerializerConfigException
from esque.io.serializers.base import DataSerializer, SerializerConfig
from esque.io.serializers.json import JsonSerializer
from esque.io.serializers.raw import RawSerializer
from esque.io.serializers.registry_avro import RegistryAvroSerializer
from esque.io.serializers.string import StringSerializer

Expand All @@ -12,6 +13,7 @@
"str": StringSerializer,
"reg-avro": RegistryAvroSerializer,
"json": JsonSerializer,
"raw": RawSerializer,
}


Expand Down
1 change: 1 addition & 0 deletions esque/io/serializers/raw.py
Expand Up @@ -11,6 +11,7 @@ class RawSerializerConfig(SerializerConfig):


class RawSerializer(DataSerializer):
config_cls = RawSerializerConfig
unknown_data_type: UnknownDataType = UnknownDataType()

def deserialize(self, raw_data: bytes) -> Data:
Expand Down

0 comments on commit e49e1a4

Please sign in to comment.