You are viewing documentation about an older version (1.13.0). View latest version

snowflake.snowpark.functions.concat_ws¶

snowflake.snowpark.functions.concat_ws(*cols: Union[Column, str]) → Column[source]¶

Concatenates two or more strings, or concatenates two or more binary values. If any of the values is null, the result is also null. The CONCAT_WS operator requires at least two arguments, and uses the first argument to separate all following arguments.

Examples::
>>> from snowflake.snowpark.functions import lit
>>> df = session.create_dataframe([['Hello', 'World']], schema=['a', 'b'])
>>> df.select(concat_ws(lit(','), df.a, df.b)).show()
----------------------------------
|"CONCAT_WS(',', ""A"", ""B"")"  |
----------------------------------
|Hello,World                     |
----------------------------------
Copy
>>> df = session.create_dataframe([['Hello', 'World', ',']], schema=['a', 'b', 'sep'])
>>> df.select(concat_ws('sep', df.a, df.b)).show()
--------------------------------------
|"CONCAT_WS(""SEP"", ""A"", ""B"")"  |
--------------------------------------
|Hello,World                         |
--------------------------------------
Copy