-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP Implement AsyncDB #162
Conversation
@@ -22,6 +22,8 @@ import ( | |||
"github.com/grafana/sqlds/v2" | |||
) | |||
|
|||
var validStatuses = []string{"SUBMITTED", "PICKED", "STARTED", "FINISHED"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can get these statuses from the redshiftdataapiservice
, for example: redshiftdataapiservice.StatementStatusStringSubmitted
for { | ||
for _, statement := range output.Statements { | ||
if statement.QueryString != nil && *statement.QueryString == query { | ||
if statement.Status != nil && sliceContains(validStatuses, *statement.Status) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you make validStatuses
map[string]bool, you can just do if statement.Status != nil && validStatuses[*statement.Status] {
func (c *API) GetQueryID(ctx context.Context, query string, args ...interface{}) (bool, string, error) { | ||
// alternatively, search individually for each status we care about | ||
input := &redshiftdataapiservice.ListStatementsInput{ | ||
Status: aws.String("ALL"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you probably don't need to filter by the status?
output, err = c.DataClient.ListStatementsWithContext(ctx, input) | ||
if err != nil { | ||
return false, "", fmt.Errorf("%w: %v", api.ExecuteError, err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you placethis at the beginning of the loop you don't need to repeat it
Closing for #177 |
No description provided.