Skip to content

Commit

Permalink
use Index to config combo index
Browse files Browse the repository at this point in the history
  • Loading branch information
justinpark committed Mar 7, 2024
1 parent 99c4c5f commit fcf7a84
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions superset/models/sql_lab.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Query(
user_id = Column(Integer, ForeignKey("ab_user.id"), nullable=True)
status = Column(String(16), default=QueryStatus.PENDING)
tab_name = Column(String(256))
sql_editor_id = Column(String(256), index=True)
sql_editor_id = Column(String(256))
schema = Column(String(256))
sql = Column(MediumText())
# Query to retrieve the results,
Expand Down Expand Up @@ -128,7 +128,10 @@ class Query(
)
user = relationship(security_manager.user_model, foreign_keys=[user_id])

__table_args__ = (sqla.Index("ti_user_id_changed_on", user_id, changed_on),)
__table_args__ = (
sqla.Index("ti_user_id_changed_on", user_id, changed_on),
sqla.Index("ix_query_user_id_sql_editor_id", user_id, sql_editor_id),
)

def get_template_processor(self, **kwargs: Any) -> BaseTemplateProcessor:
return get_template_processor(query=self, database=self.database, **kwargs)
Expand Down

0 comments on commit fcf7a84

Please sign in to comment.