snowflake.snowpark.functions.xpath_boolean

snowflake.snowpark.functions.xpath_boolean(col: Union[Column, str], path: str) Column[source]

Evaluates an XPath expression and returns the result as a boolean.

Returns FALSE if no matches are found. Follows XPath boolean coercion rules.

Parameters:
  • col – Column containing XML data

  • path – XPath expression string

Example:

>>> df = session.create_dataframe([['<root><a>1</a></root>']], schema=['xml'])
>>> df.select(xpath_boolean('xml', 'count(//a) > 0').alias('has_a')).collect()
[Row(HAS_A=True)]
Copy