mirror of
https://github.com/apache/superset.git
synced 2026-04-18 15:44:57 +00:00
feat: add UUID column to saved_query for export/import (#11397)
* Add UUID to saved_query * Reuse function from previous migration * Point to new head
This commit is contained in:
@@ -39,7 +39,7 @@ from sqlalchemy.engine.url import URL
|
||||
from sqlalchemy.orm import backref, relationship
|
||||
|
||||
from superset import security_manager
|
||||
from superset.models.helpers import AuditMixinNullable, ExtraJSONMixin
|
||||
from superset.models.helpers import AuditMixinNullable, ExtraJSONMixin, ImportMixin
|
||||
from superset.models.tags import QueryUpdater
|
||||
from superset.sql_parse import CtasMethod, ParsedQuery, Table
|
||||
from superset.utils.core import QueryStatus, user_label
|
||||
@@ -162,7 +162,7 @@ class Query(Model, ExtraJSONMixin):
|
||||
security_manager.raise_for_access(query=self)
|
||||
|
||||
|
||||
class SavedQuery(Model, AuditMixinNullable, ExtraJSONMixin):
|
||||
class SavedQuery(Model, AuditMixinNullable, ExtraJSONMixin, ImportMixin):
|
||||
"""ORM model for SQL query"""
|
||||
|
||||
__tablename__ = "saved_query"
|
||||
@@ -186,6 +186,15 @@ class SavedQuery(Model, AuditMixinNullable, ExtraJSONMixin):
|
||||
rows = Column(Integer, nullable=True)
|
||||
last_run = Column(DateTime, nullable=True)
|
||||
|
||||
export_parent = "database"
|
||||
export_fields = [
|
||||
"db_id",
|
||||
"schema",
|
||||
"label",
|
||||
"description",
|
||||
"sql",
|
||||
]
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return str(self.label)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user