snowflake.snowpark.functions.concat_ws¶
- snowflake.snowpark.functions.concat_ws(*cols: ColumnOrName) 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 | ----------------------------------
>>> 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 | --------------------------------------