snowflake.snowpark.functions.uuid_string¶
- snowflake.snowpark.functions.uuid_string(uuid: Union[snowflake.snowpark.column.Column, str] = None, name: Union[snowflake.snowpark.column.Column, str] = None) Column[source]¶
Returns a universally unique identifier (UUID) as a string. If the uuid is provided, also the name must be provided.
- Parameters:
uuid (ColumnOrName, optional) – The namespace UUID as a string. If provided, generates a UUID based on this namespace.
name (ColumnOrName, optional) – The name to use for UUID generation. Used in combination with uuid parameter.
- Returns:
The UUID string.
- Return type:
- Examples::
>>> from snowflake.snowpark.functions import col
>>> df = session.create_dataframe( ... [["fe971b24-9572-4005-b22f-351e9c09274d", "foo"]], schema=["uuid", "name"] ... )
>>> df.select(uuid_string().alias("random_uuid")).collect() [Row(RANDOM_UUID='...')]
>>> result = df.select( ... uuid_string(col("uuid"), col("name")).alias("NAMED_UUID") ... ).collect() >>> expected_uuid = "dc0b6f65-fca6-5b4b-9d37-ccc3fde1f3e2" >>> result[0]["NAMED_UUID"] == expected_uuid True