Skip to content

Commit

Permalink
change private to public
Browse files Browse the repository at this point in the history
  • Loading branch information
villebro committed Aug 24, 2020
1 parent d0c043e commit ca9f843
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions superset/db_engine_specs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class BaseEngineSpec: # pylint: disable=too-many-public-methods
] = None # used for user messages, overridden in child classes
_date_trunc_functions: Dict[str, str] = {}
_time_grain_expressions: Dict[Optional[str], str] = {}
_column_type_mappings: Tuple[
column_type_mappings: Tuple[
Tuple[Pattern[str], Union[TypeEngine, Callable[[Match[str]], TypeEngine]]], ...,
] = ()
time_groupby_inline = False
Expand Down Expand Up @@ -897,7 +897,7 @@ def get_sqla_column_type(cls, type_: str) -> Optional[TypeEngine]:
:param type_: Column type returned by inspector
:return: SqlAlchemy column type
"""
for regex, sqla_type in cls._column_type_mappings:
for regex, sqla_type in cls.column_type_mappings:
match = regex.match(type_)
if match:
if callable(sqla_type):
Expand Down
2 changes: 1 addition & 1 deletion superset/db_engine_specs/mssql.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def fetch_data(cls, cursor: Any, limit: int) -> List[Tuple[Any, ...]]:
# Lists of `pyodbc.Row` need to be unpacked further
return cls.pyodbc_rows_to_tuples(data)

_column_type_mappings = (
column_type_mappings = (
(re.compile(r"^N((VAR)?CHAR|TEXT)", re.IGNORECASE), UnicodeText()),
(re.compile(r"^((VAR)?CHAR|TEXT|STRING)", re.IGNORECASE), String()),
)
Expand Down
2 changes: 1 addition & 1 deletion superset/db_engine_specs/presto.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def _show_columns(
columns = inspector.bind.execute("SHOW COLUMNS FROM {}".format(full_table))
return columns

_column_type_mappings = (
column_type_mappings = (
(re.compile(r"^boolean.*", re.IGNORECASE), types.Boolean()),
(re.compile(r"^tinyint.*", re.IGNORECASE), TinyInteger()),
(re.compile(r"^smallint.*", re.IGNORECASE), types.SmallInteger()),
Expand Down
3 changes: 1 addition & 2 deletions tests/db_engine_specs/presto_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,7 @@ def test_presto_expand_data_array(self):
self.assertEqual(actual_data, expected_data)
self.assertEqual(actual_expanded_cols, expected_expanded_cols)

@staticmethod
def test_get_sqla_column_type():
def test_get_sqla_column_type(self):
sqla_type = PrestoEngineSpec.get_sqla_column_type("varchar(255)")
assert isinstance(sqla_type, types.VARCHAR)
assert sqla_type.length == 255
Expand Down

0 comments on commit ca9f843

Please sign in to comment.