is_unique

calista.core.functions.is_unique(col_name: str) ConditionExpression

Create a condition to check if all values in a column are unique.

Args:

col_name (str): The name of the column.

Returns:

ConditionExpression: The condition to check if all values in the column are unique.

Example

>>> from calista import CalistaEngine
>>> from calista.core.functions import is_unique
>>>
>>> calista_table = CalistaEngine(engine = "spark").load_from_dict({"ID": [1, 2, 3, 2]})
>>> my_rule = is_unique(col_name="ID")
>>> print(calista_table.analyze(rule_name="My Rule Name", condition=my_rule))
rule_name : My Rule Name
total_row_count : 4
valid_row_count : 2
valid_row_count_pct : 50.0
timestamp : 2024-01-01 00:00:00.000000