URL_ENCODE

This function will escape the given input value by encoding it so that it can be safely included in URL query parameter names and values:

  • Alphanumeric characters are not encoded.

  • The characters ., -, * and _ are not encoded.

  • The ASCII space character is encoded as +.

  • All other characters are converted to UTF-8 and the bytes are encoded as the string %XX where XX is the uppercase hexadecimal value of the UTF-8 byte.

Syntax

URL_ENCODE(VALUE)

Arguments

VALUE

Type: string

The value to encode.

Returns

Type: string

The encoded VALUE.


Examples

VALUEOutput

The quick brown fox

The+quick+brown+fox

Comment #5

Comment+%235

&$#_line_!123

%26%24%23_line_%21123

''

''

word+word word

word%2Bword++word

Transformation job example

SQL

CREATE JOB function_operator_example
    ADD_MISSING_COLUMNS = true	
AS INSERT INTO default_glue_catalog.upsolver_samples.orders_transformed_data 
  MAP_COLUMNS_BY_NAME
    SELECT 
        URL_ENCODE('word+word  word') AS url_example1,
        URL_ENCODE('&$#_line_!123') AS url_example2
    FROM default_glue_catalog.upsolver_samples.orders_raw_data 
    WHERE $commit_time BETWEEN run_start_time() AND run_end_time()
    LIMIT 1;

Query result

url_example1url_example2

word%2Bword++word

%26%24%23_line_%21123

Last updated