You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
Equal operator in table constraints class throws error when instance in None
Code issue equal operator
classTableConstraints:
"""The TableConstraints defines the primary key and foreign key. Args: primary_key: Represents a primary key constraint on a table's columns. Present only if the table has a primary key. The primary key is not enforced. foreign_keys: Present only if the table has a foreign key. The foreign key is not enforced. """def__init__(
self,
primary_key: Optional[PrimaryKey],
foreign_keys: Optional[List[ForeignKey]],
):
self.primary_key=primary_keyself.foreign_keys=foreign_keysdef__eq__(self, other):
ifnotisinstance(other, TableConstraints) andotherisnotNone:
raiseTypeError("The value provided is not a BigQuery TableConstraints.")
return (
self.primary_key==other.primary_keyifother.primary_keyelseNone
) and (self.foreign_keys==other.foreign_keysifother.foreign_keyselseNone)```
#### Stack trace
fix
class TableConstraints:
"""The TableConstraints defines the primary key and foreign key.
Args:
primary_key:
Represents a primary key constraint on a table's columns. Present only if the table
has a primary key. The primary key is not enforced.
foreign_keys:
Present only if the table has a foreign key. The foreign key is not enforced.
"""
def __init__(
self,
primary_key: Optional[PrimaryKey],
foreign_keys: Optional[List[ForeignKey]],
):
self.primary_key = primary_key
self.foreign_keys = foreign_keys
def __eq__(self, other):
if not isinstance(other, TableConstraints) and other is not None:
raise TypeError("The value provided is not a BigQuery TableConstraints.")
return (
self.primary_key == other.primary_key if other and other.primary_key else None
) and (self.foreign_keys == other.foreign_keys if other.foreign_keys else None)
Equal operator in table constraints class throws error when instance in None
Code issue equal operator
fix
class TableConstraints:
"""The TableConstraints defines the primary key and foreign key.