mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
style: enforcing mypy typing for connectors (#9824)
Co-authored-by: John Bodley <john.bodley@airbnb.com>
This commit is contained in:
@@ -15,15 +15,22 @@
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import logging
|
||||
from typing import Callable, Optional
|
||||
|
||||
from flask_appbuilder import Model
|
||||
from sqlalchemy.orm import Session
|
||||
from sqlalchemy.orm.session import make_transient
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def import_datasource(
|
||||
session, i_datasource, lookup_database, lookup_datasource, import_time
|
||||
):
|
||||
session: Session,
|
||||
i_datasource: Model,
|
||||
lookup_database: Callable,
|
||||
lookup_datasource: Callable,
|
||||
import_time: Optional[int] = None,
|
||||
) -> int:
|
||||
"""Imports the datasource from the object to the database.
|
||||
|
||||
Metrics and columns and datasource will be overrided if exists.
|
||||
@@ -75,7 +82,7 @@ def import_datasource(
|
||||
return datasource.id
|
||||
|
||||
|
||||
def import_simple_obj(session, i_obj, lookup_obj):
|
||||
def import_simple_obj(session: Session, i_obj: Model, lookup_obj: Callable) -> Model:
|
||||
make_transient(i_obj)
|
||||
i_obj.id = None
|
||||
i_obj.table = None
|
||||
|
||||
Reference in New Issue
Block a user