diff --git a/caravel/assets/javascripts/SqlLab/components/SqlEditor.jsx b/caravel/assets/javascripts/SqlLab/components/SqlEditor.jsx index d6a43a4289..af2fc4f47c 100644 --- a/caravel/assets/javascripts/SqlLab/components/SqlEditor.jsx +++ b/caravel/assets/javascripts/SqlLab/components/SqlEditor.jsx @@ -193,12 +193,12 @@ class SqlEditor extends React.Component { ); } let limitWarning = null; - const rowLimit = 1000; - if (this.props.latestQuery && this.props.latestQuery.rows === rowLimit) { + if (this.props.latestQuery && this.props.latestQuery.limit_reached) { const tooltip = ( It appears that the number of rows in the query results displayed - was limited on the server side to the {rowLimit} limit. + was limited on the server side to + the {this.props.latestQuery.rows} limit. ); limitWarning = ( diff --git a/caravel/models.py b/caravel/models.py index 1a28e0c64f..ec82efa531 100644 --- a/caravel/models.py +++ b/caravel/models.py @@ -1972,6 +1972,7 @@ class Query(Model): # Could be configured in the caravel config. limit = Column(Integer) limit_used = Column(Boolean, default=False) + limit_reached = Column(Boolean, default=False) select_as_cta = Column(Boolean) select_as_cta_used = Column(Boolean, default=False) @@ -1994,6 +1995,10 @@ class Query(Model): sqla.Index('ti_user_id_changed_on', user_id, changed_on), ) + @property + def limit_reached(self): + return self.rows == self.limit if self.limit_used else False + def to_dict(self): return { 'changedOn': self.changed_on, @@ -2016,6 +2021,7 @@ class Query(Model): 'tab': self.tab_name, 'tempTable': self.tmp_table_name, 'userId': self.user_id, + 'limit_reached': self.limit_reached, } @property