BYTES
Bytes data type and usages
Description
Sequence of bytes with a maximum of L bytes allowed in the binary string. The maximum length is 8 MB (8,388,608 bytes). For more information please refer to BigQuery BYTES data type.
Sample Source Patterns
BYTES output format
The default output format for binary data types in BigQuery is 'BASE64' and in Snowflake 'HEX'. For this reason, when a binary column is selected, the BASE64_ENCODE function is automatically added. In order to maintain the default formatting of BigQuery.
Input Code:
Output Code:
In case it is not added automatically and you want to see the data in BASE64 format, you can use the BASE64_ENCODE function or set the BINARY_OUTPUT_FORMAT format.
BYTES Literal
The following cases represent the forms that can be used to format byte literals in BigQuery.
These literals are not supported in Snowflake, but instead the TRY_TO_BINARY function can be used to convert the input expression to a binary value. This function is a special version of TO_BINARY that performs the same operation, but with error handling support.
It is important to take into consideration that the binary format for the conversion can be: HEX, BASE64, or UTF-8. The default is the value of the BINARY_INPUT_FORMAT session parameter. If this parameter is not set, the default value is HEX.
Observations
Please keep in mind that the default output format for binary data types in BigQuery is 'BASE64' and in Snowflake 'HEX'. You can use the BASE64_ENCODE function or set the BINARY_OUTPUT_FORMAT format if you want to view the data in BASE64 format.
The only formats supported by Snowflake are: HEX, BASE64, or UTF-8. For more information, please refer to Binary Input and Output in Snowflake.
Binary functions used to insert data into a values clause are not supported in Snowflake. Please refer to Bytes Functions documentation to learn more about this.
Last updated