mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 11:52:30 +08:00
SQL Expressions: Re-implement feature using go-mysql-server (#99521)
* Under feature flag `sqlExpressions` and is experimental * Excluded from arm32 * Will not work with the Query Service yet * Does not have limits in place yet * Does not working with alerting yet * Currently requires "prepare time series" Transform for time series viz --------- Co-authored-by: Sam Jewell <sam.jewell@grafana.com>
This commit is contained in:
@ -93,11 +93,10 @@ func (gr *SQLCommand) Execute(ctx context.Context, now time.Time, vars mathexp.V
|
||||
|
||||
rsp := mathexp.Results{}
|
||||
|
||||
db := sql.NewInMemoryDB()
|
||||
var frame = &data.Frame{}
|
||||
db := sql.DB{}
|
||||
|
||||
logger.Debug("Executing query", "query", gr.query, "frames", len(allFrames))
|
||||
err := db.QueryFramesInto(gr.refID, gr.query, allFrames, frame)
|
||||
frame, err := db.QueryFrames(ctx, gr.refID, gr.query, allFrames)
|
||||
if err != nil {
|
||||
logger.Error("Failed to query frames", "error", err.Error())
|
||||
rsp.Error = err
|
||||
@ -105,12 +104,11 @@ func (gr *SQLCommand) Execute(ctx context.Context, now time.Time, vars mathexp.V
|
||||
}
|
||||
logger.Debug("Done Executing query", "query", gr.query, "rows", frame.Rows())
|
||||
|
||||
frame.RefID = gr.refID
|
||||
|
||||
if frame.Rows() == 0 {
|
||||
rsp.Values = mathexp.Values{
|
||||
mathexp.NoData{Frame: frame},
|
||||
}
|
||||
return rsp, nil
|
||||
}
|
||||
|
||||
rsp.Values = mathexp.Values{
|
||||
|
Reference in New Issue
Block a user