feat: add generic type to column payload (#14547)

* feat: add generic type to column payload

* feat: add generic type to column payload

* xit flaky test
This commit is contained in:
Ville Brofeldt
2021-05-13 09:36:09 +03:00
committed by GitHub
parent ad699e8b48
commit 3f6bd1e4a4
15 changed files with 466 additions and 357 deletions

View File

@@ -533,6 +533,7 @@ class BaseColumn(AuditMixinNullable, ImportExportMixin):
def __repr__(self) -> str:
return str(self.column_name)
bool_types = ("BOOL",)
num_types = (
"DOUBLE",
"FLOAT",
@@ -560,6 +561,22 @@ class BaseColumn(AuditMixinNullable, ImportExportMixin):
def is_string(self) -> bool:
return self.type and any(map(lambda t: t in self.type.upper(), self.str_types))
@property
def is_boolean(self) -> bool:
return self.type and any(map(lambda t: t in self.type.upper(), self.bool_types))
@property
def type_generic(self) -> Optional[utils.GenericDataType]:
if self.is_string:
return utils.GenericDataType.STRING
if self.is_boolean:
return utils.GenericDataType.BOOLEAN
if self.is_numeric:
return utils.GenericDataType.NUMERIC
if self.is_temporal:
return utils.GenericDataType.TEMPORAL
return None
@property
def expression(self) -> Column:
raise NotImplementedError()