snowflake.snowpark.functions.try_cast¶
- snowflake.snowpark.functions.try_cast(column: Union[Column, str], to: Union[str, DataType]) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/functions.py#L6024-L6046)¶
A special version of CAST for a subset of data type conversions. It performs the same operation (i.e. converts a value of one data type into another data type), but returns a NULL value instead of raising an error when the conversion can not be performed.
The
columnargument must be a string column in Snowflake.Example:
Example: