Skip to content

Commit 2f513e4

Browse files
committed
made __repr__ for Column more robust
1 parent 986b0c6 commit 2f513e4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

piccolo/columns/base.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,13 @@ def __str__(self):
503503
return self.querystring.__str__()
504504

505505
def __repr__(self):
506+
try:
507+
table = self._meta.table
508+
except ValueError:
509+
table_class_name = "Unknown"
510+
else:
511+
table_class_name = table.__name__
506512
return (
507-
f"{self._meta.table.__name__}.{self._meta.name} - "
513+
f"{table_class_name}.{self._meta.name} - "
508514
f"{self.__class__.__name__}"
509515
)

0 commit comments

Comments
 (0)