mirror of
https://github.com/apache/superset.git
synced 2026-04-07 10:31:50 +00:00
fix: is_temporal should overwrite is_dttm (#14894)
* fix: is_temporal should overwrite is_dttm * move up
This commit is contained in:
@@ -230,6 +230,8 @@ class TableColumn(Model, BaseColumn):
|
||||
|
||||
@property
|
||||
def type_generic(self) -> Optional[utils.GenericDataType]:
|
||||
if self.is_dttm:
|
||||
return GenericDataType.TEMPORAL
|
||||
column_spec = self.db_engine_spec.get_column_spec(self.type)
|
||||
return column_spec.generic_type if column_spec else None
|
||||
|
||||
|
||||
@@ -102,6 +102,10 @@ class TestDatabaseModel(SupersetTestCase):
|
||||
self.assertEqual(col.is_numeric, db_col_type == GenericDataType.NUMERIC)
|
||||
self.assertEqual(col.is_string, db_col_type == GenericDataType.STRING)
|
||||
|
||||
for str_type, db_col_type in test_cases.items():
|
||||
col = TableColumn(column_name="foo", type=str_type, table=tbl, is_dttm=True)
|
||||
self.assertTrue(col.is_temporal)
|
||||
|
||||
@patch("superset.jinja_context.g")
|
||||
def test_extra_cache_keys(self, flask_g):
|
||||
flask_g.user.username = "abc"
|
||||
|
||||
Reference in New Issue
Block a user