Skip to content
2 changes: 1 addition & 1 deletion docs/checks.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Here are the current supported functionalities of Checks.
| | areAnyComplete(columns) | Done |
| | haveAnyCompleteness(columns, assertion) | Done |
| | isUnique(column) | Done |
| | isPrimaryKey(column, *columns) | Not Implemented |
| | isPrimaryKey(column, *columns) | Done |
| | hasUniqueness(columns, assertion) | Done |
| | hasDistinctness(columns, assertion) | Done |
| | hasUniqueValueRatio(columns, assertion) | Done |
Expand Down
13 changes: 8 additions & 5 deletions pydeequ/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,15 +243,18 @@ def isPrimaryKey(self, column, *columns, hint=None):
Currently only checks uniqueness, but reserved for primary key checks if there is another
assertion to run on primary key columns.

# how does column and columns differ
:param str column: Column in Data Frame to run the assertion on.
Uniqueness is checked for the list of all columns: [column] + columns.

:param str column: The 1st column in Data Frame to run the assertion on.
:param list[str] columns: Additional columns to run the assertion on.
:param str hint: A hint that states why a constraint could have failed.
:param list[str] columns: Columns to run the assertion on.
:return: isPrimaryKey self: A Check.scala object that asserts completion in the columns.
"""
# This relies on Py4J's implicit conversion from Seq to varargs:
columns_seq = to_scala_seq(self._jvm, columns)
Comment thread
nikie marked this conversation as resolved.
hint = self._jvm.scala.Option.apply(hint)
print(f"Unsolved integration: {hint}")
raise NotImplementedError("Unsolved integration of Python tuple => varArgs")
self._Check = self._Check.isPrimaryKey(column, hint, columns_seq)
Comment thread
nikie marked this conversation as resolved.
Comment thread
nikie marked this conversation as resolved.
return self

Comment thread
nikie marked this conversation as resolved.
def hasUniqueness(self, columns, assertion, hint=None):
"""
Expand Down
Loading
Loading