mirror of https://github.com/apache/superset.git
[SQLLab] user server for the query limit check. (#1230)
This commit is contained in:
parent
472679bb38
commit
e11ef994bb
|
@ -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 = (
|
||||
<Tooltip id="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.
|
||||
</Tooltip>
|
||||
);
|
||||
limitWarning = (
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue