mirror of https://github.com/apache/superset.git
fix(schedule-query): getUISchema function called in SchemaForm component (#20256)
* Revert "Superset - Release and Improvements (12-05-2022)"
* merging conflic changes
* Revert "Revert "Superset - Release and Improvements (12-05-2022)""
This reverts commit 6d18661e03
.
* fixed breaking changes
* sync with master
* fixed breaking flows
* fixed getUISchema function call
* added default placeholder and updated docs
* fixed format and comments
* changed flag to configuration
* fix: indentation of SCHEDULED_QUERIES dict
* fix: changed intendation for SCHEDULED_QUERIES
* fix: updated docs for SCHEDULED_QUERIES
* fix: replaced button to menu item for SCHEDULED_QUERIES
* fix: updated docs for SCHEDULED_QUERIES
* fix: trailing whitespace
This commit is contained in:
parent
59491f5396
commit
4137fe03a0
|
@ -391,94 +391,91 @@ You can optionally allow your users to schedule queries directly in SQL Lab. Thi
|
||||||
extra metadata to saved queries, which are then picked up by an external scheduled (like
|
extra metadata to saved queries, which are then picked up by an external scheduled (like
|
||||||
[Apache Airflow](https://airflow.apache.org/)).
|
[Apache Airflow](https://airflow.apache.org/)).
|
||||||
|
|
||||||
To allow scheduled queries, add the following to your configuration file:
|
To allow scheduled queries, add the following to `SCHEDULED_QUERIES` in your configuration file:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
FEATURE_FLAGS = {
|
SCHEDULED_QUERIES = {
|
||||||
# Configuration for scheduling queries from SQL Lab. This information is
|
# This information is collected when the user clicks "Schedule query",
|
||||||
# collected when the user clicks "Schedule query", and saved into the `extra`
|
# and saved into the `extra` field of saved queries.
|
||||||
# field of saved queries.
|
|
||||||
# See: https://github.com/mozilla-services/react-jsonschema-form
|
# See: https://github.com/mozilla-services/react-jsonschema-form
|
||||||
'SCHEDULED_QUERIES': {
|
'JSONSCHEMA': {
|
||||||
'JSONSCHEMA': {
|
'title': 'Schedule',
|
||||||
'title': 'Schedule',
|
'description': (
|
||||||
'description': (
|
'In order to schedule a query, you need to specify when it '
|
||||||
'In order to schedule a query, you need to specify when it '
|
'should start running, when it should stop running, and how '
|
||||||
'should start running, when it should stop running, and how '
|
'often it should run. You can also optionally specify '
|
||||||
'often it should run. You can also optionally specify '
|
'dependencies that should be met before the query is '
|
||||||
'dependencies that should be met before the query is '
|
'executed. Please read the documentation for best practices '
|
||||||
'executed. Please read the documentation for best practices '
|
'and more information on how to specify dependencies.'
|
||||||
'and more information on how to specify dependencies.'
|
),
|
||||||
),
|
'type': 'object',
|
||||||
'type': 'object',
|
'properties': {
|
||||||
'properties': {
|
'output_table': {
|
||||||
'output_table': {
|
'type': 'string',
|
||||||
'type': 'string',
|
'title': 'Output table name',
|
||||||
'title': 'Output table name',
|
},
|
||||||
},
|
'start_date': {
|
||||||
'start_date': {
|
'type': 'string',
|
||||||
'type': 'string',
|
'title': 'Start date',
|
||||||
'title': 'Start date',
|
# date-time is parsed using the chrono library, see
|
||||||
# date-time is parsed using the chrono library, see
|
# https://www.npmjs.com/package/chrono-node#usage
|
||||||
# https://www.npmjs.com/package/chrono-node#usage
|
'format': 'date-time',
|
||||||
'format': 'date-time',
|
'default': 'tomorrow at 9am',
|
||||||
'default': 'tomorrow at 9am',
|
},
|
||||||
},
|
'end_date': {
|
||||||
'end_date': {
|
'type': 'string',
|
||||||
'type': 'string',
|
'title': 'End date',
|
||||||
'title': 'End date',
|
# date-time is parsed using the chrono library, see
|
||||||
# date-time is parsed using the chrono library, see
|
# https://www.npmjs.com/package/chrono-node#usage
|
||||||
# https://www.npmjs.com/package/chrono-node#usage
|
'format': 'date-time',
|
||||||
'format': 'date-time',
|
'default': '9am in 30 days',
|
||||||
'default': '9am in 30 days',
|
|
||||||
},
|
|
||||||
'schedule_interval': {
|
|
||||||
'type': 'string',
|
|
||||||
'title': 'Schedule interval',
|
|
||||||
},
|
|
||||||
'dependencies': {
|
|
||||||
'type': 'array',
|
|
||||||
'title': 'Dependencies',
|
|
||||||
'items': {
|
|
||||||
'type': 'string',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
|
||||||
'UISCHEMA': {
|
|
||||||
'schedule_interval': {
|
'schedule_interval': {
|
||||||
'ui:placeholder': '@daily, @weekly, etc.',
|
'type': 'string',
|
||||||
|
'title': 'Schedule interval',
|
||||||
},
|
},
|
||||||
'dependencies': {
|
'dependencies': {
|
||||||
'ui:help': (
|
'type': 'array',
|
||||||
'Check the documentation for the correct format when '
|
'title': 'Dependencies',
|
||||||
'defining dependencies.'
|
'items': {
|
||||||
),
|
'type': 'string',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'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',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
# link to the scheduler; this example links to an Airflow pipeline
|
|
||||||
# that uses the query id and the output table as its name
|
|
||||||
'linkback': (
|
|
||||||
'https://airflow.example.com/admin/airflow/tree?'
|
|
||||||
'dag_id=query_${id}_${extra_json.schedule_info.output_table}'
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
|
'UISCHEMA': {
|
||||||
|
'schedule_interval': {
|
||||||
|
'ui:placeholder': '@daily, @weekly, etc.',
|
||||||
|
},
|
||||||
|
'dependencies': {
|
||||||
|
'ui:help': (
|
||||||
|
'Check the documentation for the correct format when '
|
||||||
|
'defining dependencies.'
|
||||||
|
),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'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',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
# link to the scheduler; this example links to an Airflow pipeline
|
||||||
|
# that uses the query id and the output table as its name
|
||||||
|
'linkback': (
|
||||||
|
'https://airflow.example.com/admin/airflow/tree?'
|
||||||
|
'dag_id=query_${id}_${extra_json.schedule_info.output_table}'
|
||||||
|
),
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
This feature flag is based on
|
This configuration is based on
|
||||||
[react-jsonschema-form](https://github.com/mozilla-services/react-jsonschema-form) and will add a
|
[react-jsonschema-form](https://github.com/mozilla-services/react-jsonschema-form) and will add a
|
||||||
button called “Schedule Query” to SQL Lab. When the button is clicked, a modal will show up where
|
menu item called “Schedule” to SQL Lab. When the menu item is clicked, a modal will show up where
|
||||||
the user can add the metadata required for scheduling the query.
|
the user can add the metadata required for scheduling the query.
|
||||||
|
|
||||||
This information can then be retrieved from the endpoint `/savedqueryviewapi/api/read` and used to
|
This information can then be retrieved from the endpoint `/savedqueryviewapi/api/read` and used to
|
||||||
|
|
|
@ -197,7 +197,7 @@ const ScheduleQueryButton: FunctionComponent<ScheduleQueryButtonProps> = ({
|
||||||
<StyledJsonSchema>
|
<StyledJsonSchema>
|
||||||
<SchemaForm
|
<SchemaForm
|
||||||
schema={getJSONSchema()}
|
schema={getJSONSchema()}
|
||||||
uiSchema={getUISchema}
|
uiSchema={getUISchema()}
|
||||||
onSubmit={onScheduleSubmit}
|
onSubmit={onScheduleSubmit}
|
||||||
validate={getValidator()}
|
validate={getValidator()}
|
||||||
>
|
>
|
||||||
|
|
|
@ -237,6 +237,9 @@ SHOW_STACKTRACE = True
|
||||||
ENABLE_PROXY_FIX = False
|
ENABLE_PROXY_FIX = False
|
||||||
PROXY_FIX_CONFIG = {"x_for": 1, "x_proto": 1, "x_host": 1, "x_port": 1, "x_prefix": 1}
|
PROXY_FIX_CONFIG = {"x_for": 1, "x_proto": 1, "x_host": 1, "x_port": 1, "x_prefix": 1}
|
||||||
|
|
||||||
|
# Configuration for scheduling queries from SQL Lab.
|
||||||
|
SCHEDULED_QUERIES: Dict[str, Any] = {}
|
||||||
|
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
# GLOBALS FOR APP Builder
|
# GLOBALS FOR APP Builder
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
|
|
Loading…
Reference in New Issue