mirror of
https://github.com/apache/superset.git
synced 2026-04-16 22:55:52 +00:00
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:
committed by
Beto Dealmeida
parent
65a05ca47e
commit
ec86d9de17
@@ -14,7 +14,6 @@
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
# pylint: disable=C,R,W
|
||||
from datetime import datetime
|
||||
from typing import List, TYPE_CHECKING
|
||||
|
||||
@@ -25,7 +24,7 @@ from superset.utils import core as utils
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# prevent circular imports
|
||||
from superset.models.core import Database
|
||||
from superset.models.core import Database # pylint: disable=unused-import
|
||||
|
||||
|
||||
class SqliteEngineSpec(BaseEngineSpec):
|
||||
@@ -50,27 +49,27 @@ class SqliteEngineSpec(BaseEngineSpec):
|
||||
|
||||
@classmethod
|
||||
def get_all_datasource_names(
|
||||
cls, db, datasource_type: str
|
||||
cls, database, datasource_type: str
|
||||
) -> List[utils.DatasourceName]:
|
||||
schemas = db.get_all_schema_names(
|
||||
cache=db.schema_cache_enabled,
|
||||
cache_timeout=db.schema_cache_timeout,
|
||||
schemas = database.get_all_schema_names(
|
||||
cache=database.schema_cache_enabled,
|
||||
cache_timeout=database.schema_cache_timeout,
|
||||
force=True,
|
||||
)
|
||||
schema = schemas[0]
|
||||
if datasource_type == "table":
|
||||
return db.get_all_table_names_in_schema(
|
||||
return database.get_all_table_names_in_schema(
|
||||
schema=schema,
|
||||
force=True,
|
||||
cache=db.table_cache_enabled,
|
||||
cache_timeout=db.table_cache_timeout,
|
||||
cache=database.table_cache_enabled,
|
||||
cache_timeout=database.table_cache_timeout,
|
||||
)
|
||||
elif datasource_type == "view":
|
||||
return db.get_all_view_names_in_schema(
|
||||
return database.get_all_view_names_in_schema(
|
||||
schema=schema,
|
||||
force=True,
|
||||
cache=db.table_cache_enabled,
|
||||
cache_timeout=db.table_cache_timeout,
|
||||
cache=database.table_cache_enabled,
|
||||
cache_timeout=database.table_cache_timeout,
|
||||
)
|
||||
else:
|
||||
raise Exception(f"Unsupported datasource_type: {datasource_type}")
|
||||
|
||||
Reference in New Issue
Block a user