diff --git a/piccolo/table.py b/piccolo/table.py index bae9b8a4..22e742a3 100644 --- a/piccolo/table.py +++ b/piccolo/table.py @@ -851,6 +851,13 @@ def __repr__(self) -> str: ) return f"<{self.__class__.__name__}: {pk}>" + def __eq__(self, other: Table): + return ( + isinstance(other, self.__class__) + and self.__class__._meta.primary_key + == other.__class__._meta.primary_key + ) + ########################################################################### # Classmethods