Mako

March 16, 2021

TIL: Snowflake binary data type

The other day a customer wanted to integrate binary data from MySQL to Snowflake and the pipeline was returning an error on our platform. I did some further digging and found out that Snowflake binary only supports the following binary format as per their documentation.

1. hex
2. base64
3. UTF-8

We can use MySQL's HEX() or TO_BASE64() functions and we can use those on the query level. For example:

SELECT HEX(id), name from binary_test;
SELECT TO_BASE64(id), name FROM binary_test;

The output of the above would be accepted when inserted to a Snowflake binary column.