From c92a975e4b72962baf34d1fcbf2ee38011199377 Mon Sep 17 00:00:00 2001 From: "Michael S. Molina" <70410625+michael-s-molina@users.noreply.github.com> Date: Wed, 23 Aug 2023 09:10:17 -0300 Subject: [PATCH] fix: Error when using the legacy dataset editor (#25057) Co-authored-by: John Bodley <4567245+john-bodley@users.noreply.github.com> --- .pre-commit-config.yaml | 7 ++++--- superset/connectors/sqla/views.py | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 07544d66d26db..9e0318456deea 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -42,12 +42,13 @@ repos: hooks: - id: mypy args: [--check-untyped-defs] - additional_dependencies: - [ + additional_dependencies: [ types-simplejson, types-python-dateutil, types-requests, - types-redis, + # types-redis 4.6.0.5 is failing mypy + # because of https://github.com/python/typeshed/pull/10531 + types-redis==4.6.0.4, types-pytz, types-croniter, types-PyYAML, diff --git a/superset/connectors/sqla/views.py b/superset/connectors/sqla/views.py index bce647dcda2d4..d79f5f6358edd 100644 --- a/superset/connectors/sqla/views.py +++ b/superset/connectors/sqla/views.py @@ -411,6 +411,7 @@ class TableModelView( # pylint: disable=too-many-ancestors "database": QuerySelectField( "Database", query_func=lambda: db.session.query(models.Database), + get_pk_func=lambda item: item.id, widget=Select2Widget(extra_classes="readonly"), ) }