grafana / grafana/redshift-datasource
Support batched queries
- Dominant language
- TypeScript
- Stars
- 19
- Forks
- 10
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 3
Description
**Is your feature request related to a problem? Please describe.**
Currently the Redshift datasource is only capable of handling single-statement queries because we always use the [ExecuteStatement](https://docs.aws.amazon.com/redshift-data/latest/APIReference/API_ExecuteStatement.html) API call, for which the docs say "This statement must be a single SQL statement." This prevents the use of [stored procedures](https://docs.aws.amazon.com/redshift/latest/dg/stored-procedure-result-set.html), which must be called like this:
```
BEGIN;
CALL get_result_set(1, 'mycursor');
FETCH ALL FROM mycursor;
END;
```
**Describe the solution you'd like**
We should add support for queries like this by parsing the given query to see if it contains multiple statements and if so using the [BatchExecuteStatement](https://docs.aws.amazon.com/redshift-data/latest/APIReference/API_BatchExecuteStatement.html) API call instead.
**Describe alternatives you've considered**
It may be possible to execute queries like this against Redshift using the PostgreSQL datasource in Grafana, but this can only be accomplished using user+password authentication; these must either be long-term, creating security concerns, or short-term, leading to usability issues as they must be updated frequently in Grafana.
Contributor guide
Assessment
This issue has not been assessed yet.