Skip to content

Commit 234879f

Browse files
committed
making sure every Column has a column_type property
1 parent 8442831 commit 234879f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

piccolo/columns/base.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,15 +462,16 @@ def get_sql_value(self, value: t.Any) -> t.Any:
462462

463463
return output
464464

465+
@property
466+
def column_type(self):
467+
return self.__class__.__name__.upper()
468+
465469
@property
466470
def querystring(self) -> QueryString:
467471
"""
468472
Used when creating tables.
469473
"""
470-
column_type = getattr(
471-
self, "column_type", self.__class__.__name__.upper()
472-
)
473-
query = f'"{self._meta.name}" {column_type}'
474+
query = f'"{self._meta.name}" {self.column_type}'
474475
if self._meta.primary:
475476
query += " PRIMARY"
476477
if self._meta.key:

0 commit comments

Comments
 (0)