You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by en...@apache.org on 2026/05/28 08:06:25 UTC
(superset) 10/13: fix(extensions): complete model move — remove from core.py, fix import, ensure ORM registration
This is an automated email from the ASF dual-hosted git repository.
EnxDev pushed a commit to branch test/chatbot-local
in repository https://gitbox.apache.org/repos/asf/superset.git
commit da4d09a00614eacc9460983351485c1c524a76cb
Author: Enzo Martellucci <en...@gmail.com>
AuthorDate: Wed May 27 23:51:38 2026 +0200
fix(extensions): complete model move — remove from core.py, fix import, ensure ORM registration
- Create superset/extensions/models.py with ExtensionSettings and ExtensionEnabled.
- Remove both classes from superset/models/core.py.
- Update superset/extensions/settings.py import to the new path.
- ORM registration is guaranteed by the existing import chain:
api.py → settings.py → extensions/models.py — no additional import needed.
Co-Authored-By: Claude Sonnet 4.6 <no...@anthropic.com>
---
superset/extensions/models.py | 37 +++++++++++++++++++++++++++++++++++++
superset/extensions/settings.py | 2 +-
superset/models/core.py | 16 ----------------
3 files changed, 38 insertions(+), 17 deletions(-)
diff --git a/superset/extensions/models.py b/superset/extensions/models.py
new file mode 100644
index 00000000000..623b839134a
--- /dev/null
+++ b/superset/extensions/models.py
@@ -0,0 +1,37 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""SQLAlchemy models for extension settings persistence."""
+
+from flask_appbuilder import Model
+from sqlalchemy import Boolean, Column, Integer, String
+
+
+class ExtensionSettings(Model): # pylint: disable=too-few-public-methods
+ """Global admin settings for extensions (singleton row, id=1)."""
+
+ __tablename__ = "extension_settings"
+ id = Column(Integer, primary_key=True)
+ active_chatbot_id = Column(String(250), nullable=True)
+
+
+class ExtensionEnabled(Model): # pylint: disable=too-few-public-methods
+ """Per-extension enable/disable flag."""
+
+ __tablename__ = "extension_enabled"
+ extension_id = Column(String(250), primary_key=True)
+ enabled = Column(Boolean, nullable=False, default=True)
diff --git a/superset/extensions/settings.py b/superset/extensions/settings.py
index 367ab4aef44..ecce0accf19 100644
--- a/superset/extensions/settings.py
+++ b/superset/extensions/settings.py
@@ -23,7 +23,7 @@ from sqlalchemy.dialects.postgresql import insert as pg_insert
from sqlalchemy.dialects.sqlite import insert as sqlite_insert
from superset import db
-from superset.models.core import ExtensionEnabled, ExtensionSettings
+from superset.extensions.models import ExtensionEnabled, ExtensionSettings
from superset.utils.decorators import transaction
_SETTINGS_ROW_ID = 1
diff --git a/superset/models/core.py b/superset/models/core.py
index 35a36f588d5..1f99630ab3d 100755
--- a/superset/models/core.py
+++ b/superset/models/core.py
@@ -108,22 +108,6 @@ class KeyValue(Model): # pylint: disable=too-few-public-methods
value = Column(utils.MediumText(), nullable=False)
-class ExtensionSettings(Model): # pylint: disable=too-few-public-methods
- """Global admin settings for extensions (singleton row, id=1)."""
-
- __tablename__ = "extension_settings"
- id = Column(Integer, primary_key=True)
- active_chatbot_id = Column(String(250), nullable=True)
-
-
-class ExtensionEnabled(Model): # pylint: disable=too-few-public-methods
- """Per-extension enable/disable flag."""
-
- __tablename__ = "extension_enabled"
- extension_id = Column(String(250), primary_key=True)
- enabled = Column(Boolean, nullable=False, default=True)
-
-
class CssTemplate(AuditMixinNullable, UUIDMixin, Model):
"""CSS templates for dashboards"""