Closed gabor closed 6 months ago
I think it's just confusion with the sdk that you can return a frame with an error, and an error. And when should a frame be returned with an error vs an error. And if a frame is returned with an error, do we also return an error.
EDIT: I see the explanation here.
to be honest, when i write go
, i prefer the pattern that if err == nil, then i ignore the result...but that would complicate the code a bit too much.
currently, when there's an error (for example an error in the sql query), we do not get back the executed-query-string into grafana's query inspector:
QueryDB
we do construct a dataframe with the required metadata: https://github.com/grafana/sqlds/blob/3c409475badfb0bad9e76f547fa01a676d351e0a/query.go#L64handleQuery
, whenQueryDB
ends with an error, we do not return the "returned" dataframe in the general case: https://github.com/grafana/sqlds/blob/3c409475badfb0bad9e76f547fa01a676d351e0a/datasource.go#L294this PR returns the result, but i'm not sure if this is the best approach. could there be some leak of info with this that we want to avoid? WDYT?