pysparky.quality
Functions
| Name | Description |
|---|---|
expect_any_to_one | A decorator function that ensures an N:1 relationship between col1 and col2, |
expect_criteria | A decorator function that ensures a specific criterion on a Spark DataFrame. |
expect_one_to_one | A decorator function that ensures a 1:1 relationship between col1 and col2, |
expect_type | A decorator function that verifies the data type of a specified column in a Spark DataFrame. |
expect_unique | A decorator function that ensures the uniqueness of a column in a Spark DataFrame. |
expect_any_to_onefunction#
def expect_any_to_one(col1: str | Sequence[str], col2: str | Sequence[str])A decorator function that ensures an N:1 relationship between col1 and col2, meaning each value in col1 corresponds to only one distinct value in col2.
expect_criteriafunction#
def expect_criteria(criteria)A decorator function that ensures a specific criterion on a Spark DataFrame.
Parameters
| Name | Type | Description |
|---|---|---|
criteria | pyspark.sql.column.Column | The filter criterion to be applied to the DataFrame. |
Returns
function- A decorated function that checks the criterion.
Raises
AssertionError- If the filtered count and unfiltered count of the DataFrame are not equal.
expect_one_to_onefunction#
def expect_one_to_one(col1: str | Sequence[str], col2: str | Sequence[str])A decorator function that ensures a 1:1 relationship between col1 and col2, meaning each value in col1 corresponds to only one distinct value in col2 and vice-versa.
expect_typefunction#
def expect_type(col_name, col_type)A decorator function that verifies the data type of a specified column in a Spark DataFrame.
Parameters
| Name | Type | Description |
|---|---|---|
col_name | str | The column’s name. |
col_type | pyspark.sql.types.DataType | The expected data type for the column. |
Returns
function- A decorated function that checks the column’s data type.
Raises
AssertionError- If the column’s data type does not match the expected type.
expect_uniquefunction#
def expect_unique(col_name)A decorator function that ensures the uniqueness of a column in a Spark DataFrame.
Parameters
| Name | Type | Description |
|---|---|---|
col_name | str | The column’s name. |
Returns
function- A decorated function that checks the column’s uniqueness.
Raises
AssertionError- If the column’s count and distinct count are not equal.