Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
betodealmeida committed Nov 3, 2020
1 parent e318242 commit 40b607d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
7 changes: 1 addition & 6 deletions superset/connectors/sqla/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
)
from sqlalchemy.exc import CompileError
from sqlalchemy.orm import backref, Query, relationship, RelationshipProperty, Session
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.schema import UniqueConstraint
from sqlalchemy.sql import column, ColumnElement, literal_column, table, text
from sqlalchemy.sql.expression import Label, Select, TextAsFrom
Expand All @@ -58,11 +57,7 @@
from superset.constants import NULL_STRING
from superset.db_engine_specs.base import TimestampExpression
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
from superset.exceptions import (
DatabaseNotFound,
QueryObjectValidationError,
SupersetSecurityException,
)
from superset.exceptions import QueryObjectValidationError, SupersetSecurityException
from superset.jinja_context import (
BaseTemplateProcessor,
ExtraCache,
Expand Down
5 changes: 3 additions & 2 deletions superset/dashboards/commands/importers/v0.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import time
from copy import copy
from datetime import datetime
from typing import Any, Dict, List, Optional
from typing import Any, Dict, Optional

from flask_babel import lazy_gettext as _
from sqlalchemy.orm import make_transient, Session
Expand Down Expand Up @@ -325,7 +325,7 @@ def run(self) -> None:
self.validate()

for file_name, content in self.contents.items():
logger.info(f"Importing dashboard from file {file_name}")
logger.info("Importing dashboard from file %s", file_name)
import_dashboards(db.session, content, self.database_id)

def validate(self) -> None:
Expand All @@ -334,4 +334,5 @@ def validate(self) -> None:
try:
json.loads(content)
except ValueError:
logger.exception("Invalid JSON file")
raise
9 changes: 4 additions & 5 deletions superset/datasets/commands/importers/v0.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import yaml
from flask_appbuilder import Model
from flask_babel import gettext as _
from sqlalchemy.orm import Session
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.orm.session import make_transient
Expand All @@ -35,7 +34,6 @@
)
from superset.connectors.sqla.models import SqlaTable, SqlMetric, TableColumn
from superset.databases.commands.exceptions import DatabaseNotFoundError
from superset.datasets.commands.exceptions import DatasetNotFoundError
from superset.models.core import Database
from superset.utils.dict_import_export import DATABASES_KEY, DRUID_CLUSTERS_KEY

Expand Down Expand Up @@ -144,7 +142,7 @@ def import_metric(session: Session, metric: BaseMetric) -> BaseMetric:

def lookup_sqla_column(session: Session, column: TableColumn) -> TableColumn:
return (
db.session.query(TableColumn)
session.query(TableColumn)
.filter(
TableColumn.table_id == column.table_id,
TableColumn.column_name == column.column_name,
Expand All @@ -155,7 +153,7 @@ def lookup_sqla_column(session: Session, column: TableColumn) -> TableColumn:

def lookup_druid_column(session: Session, column: DruidColumn) -> DruidColumn:
return (
db.session.query(DruidColumn)
session.query(DruidColumn)
.filter(
DruidColumn.datasource_id == column.datasource_id,
DruidColumn.column_name == column.column_name,
Expand Down Expand Up @@ -292,7 +290,7 @@ def run(self) -> None:
self.validate()

for file_name, content in self.contents.items():
logger.info(f"Importing dataset from file {file_name}")
logger.info("Importing dataset from file %s", file_name)
import_from_dict(db.session, yaml.safe_load(content), sync=self.sync)

def validate(self) -> None:
Expand All @@ -301,4 +299,5 @@ def validate(self) -> None:
try:
yaml.safe_load(content)
except yaml.parser.ParserError:
logger.exception("Invalid YAML file")
raise
2 changes: 1 addition & 1 deletion superset/utils/dict_import_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import logging
import re
import unicodedata
from typing import Any, Dict, List, Optional
from typing import Any, Dict

from sqlalchemy.orm import Session

Expand Down

0 comments on commit 40b607d

Please sign in to comment.