Encode directive
The ENCODE directive encodes a column value as one of base32
, base64
, hex
or url
 following RFC-4648.
Syntax
encode <base32|base64|hex> :column
The syntax for encoding a column as url is:
url-encode :column
The :column
 is the name of the column to which the encoding is applied.
Usage Notes
Base encoding of data is used in many situations to store or transfer data in environments that, for legacy reasons, are restricted to US-ASCII data. Base encoding can be used in new applications that do not have legacy restrictions because it allows the manipulation of objects with text editors.
The ENCODE directive generates a new column with a name following the format of <column>_encode_<type>
.
Different column values are handled following these rules:
If the column isÂ
null
, the resulting column will also beÂnull
.If the column specified is not found in the record, then the record is skipped as a no-op.
If the column value is not of either type string or byte array, it fails.
See also the DECODE directive.
Example
Using this record as an example:
{
"col1": "Base32 Encoding",
"col2": "Testing Base 64 Encoding",
"col3": "Hex Encoding"
"col4": "Mr.Owen HarrisBraund"
}
Applying these directives:
results in this record:
Â
Created in 2020 by Google Inc.