BuzzCutNorman / tap-mssql

Singer Tap for MS SQL built with Meltano Singer SDK.
MIT License
2 stars 9 forks source link

bug: Encoded Binary Types via b64encode not Converted to Strings #48

Closed BuzzCutNorman closed 1 year ago

BuzzCutNorman commented 1 year ago

During the post_process method checks each elements property schema for "contentEncoding": "base64" if it is found the element's value is then encoded in base64 via b64encode. It takes in a bytes and returns a bytes the issue is most JSON libraries don't deal with bytes and convert them to string which contain a leading "b\' and trailing '/'"which have to be removed before decoding the string from base64. This can be avoided if you have the returnedbytesconverted to a string using.decode(). This would also stop the base64 encoded stings from being encoded in hex by_conform_primitive_property. Once this bug is fixed I will also need to change the correspondingb64decodecode in buzzcutnorman--target-mssql and buzzcutnorman--target-postgres since it won't need to runfromhex` on the value before decoding from base64.

Current Code

record.update({key: b64encode(value)})

Proposed Code

record.update({key: b64encode(value).decode()})