Fix lint in superset/db_engine_spec (#8338)

* Enable lint checking for files in db_engine_spec that have few to no
lint issues

* Enable lint and fix issue in db_engine_spec/mysql.py

* Enable pylint and fix lint for db_engine_spec/pinot.py

* Enable lint and fix issues for db_engine_specs/hive.py

* Enable lint and fix for db_engine_spec/presto.py

* Re-enable lint on base.py, fix/disable specific failures, including one
bad method signature

* Make flake8 happy after a number of pylint fixes

* Update db_engine_spec_test test cases related to Presto to support
different method naming

* automated reformatting

* One more pylint disable for druid.py

* Find the magic invocation that makes all the lint tools happy
This commit is contained in:
Will Barrett
2019-10-04 09:19:21 -07:00
committed by Beto Dealmeida
parent 65a05ca47e
commit ec86d9de17
22 changed files with 116 additions and 191 deletions

View File

@@ -528,7 +528,7 @@ class DbEngineSpecsTestCase(SupersetTestCase):
}
self.assertEqual(datum, expected_datum)
def test_split_array_columns_by_process_state(self):
def test_presto_split_ary_cols_by_proc_state(self):
array_cols = ["array_column", "array_column.nested_array"]
array_col_hierarchy = {
"array_column": {
@@ -541,7 +541,7 @@ class DbEngineSpecsTestCase(SupersetTestCase):
},
}
datum = {"array_column": [[[1], [2]]]}
actual_array_cols_to_process, actual_unprocessed_array_cols = PrestoEngineSpec._split_array_columns_by_process_state( # noqa ignore: E50
actual_array_cols_to_process, actual_unprocessed_array_cols = PrestoEngineSpec._split_ary_cols_by_proc_state( # noqa ignore: E50
array_cols, array_col_hierarchy, datum
)
expected_array_cols_to_process = ["array_column"]
@@ -549,13 +549,13 @@ class DbEngineSpecsTestCase(SupersetTestCase):
self.assertEqual(actual_array_cols_to_process, expected_array_cols_to_process)
self.assertEqual(actual_unprocessed_array_cols, expected_unprocessed_array_cols)
def test_presto_convert_data_list_to_array_data_dict(self):
def test_presto_convert_data_lst_to_ary_dict(self):
data = [
{"array_column": [1, 2], "int_column": 3},
{"array_column": [11, 22], "int_column": 33},
]
array_columns_to_process = ["array_column"]
actual_array_data_dict = PrestoEngineSpec._convert_data_list_to_array_data_dict(
actual_array_data_dict = PrestoEngineSpec._convert_data_lst_to_ary_dict(
data, array_columns_to_process
)
expected_array_data_dict = {
@@ -592,30 +592,6 @@ class DbEngineSpecsTestCase(SupersetTestCase):
}
self.assertEqual(actual_array_data, expected_array_data)
def test_presto_consolidate_array_data_into_data(self):
data = [
{"arr_col": [[1], [2]], "int_col": 3},
{"arr_col": [[11], [22]], "int_col": 33},
]
array_data = {
0: [
{"arr_col": [[1], [2]], "arr_col.nested_row": 1},
{"arr_col": "", "arr_col.nested_row": 2, "int_col": ""},
],
1: [
{"arr_col": [[11], [22]], "arr_col.nested_row": 11},
{"arr_col": "", "arr_col.nested_row": 22, "int_col": ""},
],
}
PrestoEngineSpec._consolidate_array_data_into_data(data, array_data)
expected_data = [
{"arr_col": [[1], [2]], "arr_col.nested_row": 1, "int_col": 3},
{"arr_col": "", "arr_col.nested_row": 2, "int_col": ""},
{"arr_col": [[11], [22]], "arr_col.nested_row": 11, "int_col": 33},
{"arr_col": "", "arr_col.nested_row": 22, "int_col": ""},
]
self.assertEqual(data, expected_data)
def test_presto_remove_processed_array_columns(self):
array_col_hierarchy = {
"array_column": {