mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
Validate start/end when scheduling queries (#7544)
* Validate start/end when scheduling queries * Use chrono instead of Sugar
This commit is contained in:
@@ -858,13 +858,19 @@ To allow scheduled queries, add the following to your `config.py`:
|
||||
},
|
||||
'start_date': {
|
||||
'type': 'string',
|
||||
'format': 'date-time',
|
||||
'title': 'Start date',
|
||||
# date-time is parsed using the chrono library, see
|
||||
# https://www.npmjs.com/package/chrono-node#usage
|
||||
'format': 'date-time',
|
||||
'default': 'tomorrow at 9am',
|
||||
},
|
||||
'end_date': {
|
||||
'type': 'string',
|
||||
'format': 'date-time',
|
||||
'title': 'End date',
|
||||
# date-time is parsed using the chrono library, see
|
||||
# https://www.npmjs.com/package/chrono-node#usage
|
||||
'format': 'date-time',
|
||||
'default': '9am in 30 days',
|
||||
},
|
||||
'schedule_interval': {
|
||||
'type': 'string',
|
||||
@@ -890,6 +896,16 @@ To allow scheduled queries, add the following to your `config.py`:
|
||||
),
|
||||
},
|
||||
},
|
||||
'VALIDATION': [
|
||||
# ensure that start_date <= end_date
|
||||
{
|
||||
'name': 'less_equal',
|
||||
'arguments': ['start_date', 'end_date'],
|
||||
'message': 'End date cannot be before start date',
|
||||
# this is where the error message is shown
|
||||
'container': 'end_date',
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user