snowflake.snowpark.functions.decompress_string¶

snowflake.snowpark.functions.decompress_string(input_data: Union[snowflake.snowpark.column.Column, str], method: Union[snowflake.snowpark.column.Column, str]) → Column[source]¶

Decompresses a BINARY value using the specified compression method and returns the result as a string.

Parameters:
  • input_data (ColumnOrName) – The compressed binary data to decompress.

  • method (ColumnOrName) – The compression method used. Supported methods include ‘SNAPPY’, ‘GZIP’, etc.

Returns:

The decompressed string.

Return type:

Column

Example:

>>> from snowflake.snowpark.functions import to_binary
>>> df = session.create_dataframe([['0920536E6F77666C616B65', 'SNAPPY']], schema=["compressed_hex", "method"])
>>> df.select(decompress_string(to_binary(df["compressed_hex"], 'HEX'), df["method"]).alias("decompressed")).collect()
[Row(DECOMPRESSED='Snowflake')]
Copy