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

@@ -22,7 +22,7 @@ from sqlalchemy.dialects.mysql import DATE, NVARCHAR, TEXT, VARCHAR
from superset.db_engine_specs.mysql import MySQLEngineSpec
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
from superset.utils.core import GenericDataType
from tests.db_engine_specs.base_tests import TestDbEngineSpec
from tests.db_engine_specs.base_tests import assert_generic_types, TestDbEngineSpec
class TestMySQLEngineSpecsDbEngineSpec(TestDbEngineSpec):
@@ -65,7 +65,7 @@ class TestMySQLEngineSpecsDbEngineSpec(TestDbEngineSpec):
)
self.assertEqual(actual, expected)
def test_is_db_column_type_match(self):
def test_generic_type(self):
type_expectations = (
# Numeric
("TINYINT", GenericDataType.NUMERIC),
@@ -89,10 +89,7 @@ class TestMySQLEngineSpecsDbEngineSpec(TestDbEngineSpec):
("TIMESTAMP", GenericDataType.TEMPORAL),
("TIME", GenericDataType.TEMPORAL),
)
for type_str, col_type in type_expectations:
column_spec = MySQLEngineSpec.get_column_spec(type_str)
assert column_spec.generic_type == col_type
assert_generic_types(MySQLEngineSpec, type_expectations)
def test_extract_error_message(self):
from MySQLdb._exceptions import OperationalError