snowflake.snowpark.functions.as_number

snowflake.snowpark.functions.as_number(variant: Union[Column, str], precision: Optional[int] = None, scale: Optional[int] = None) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/src/snowflake/snowpark/functions.py#L7446-L7473)

Casts a VARIANT value to a fixed-point decimal (does not match floating-point values).

Example::
>>> df = session.sql("select 1.2345::variant as a")
>>> df.select(as_decimal("a", 4, 1).alias("result")).show()
------------
|"RESULT"  |
------------
|1.2       |
------------
Copy
Language: English