-
Notifications
You must be signed in to change notification settings - Fork 1
Advanced SQL Analytics Framework #9
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
base: data-analysis-features
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,26 @@ | ||||||||||||||||||||||||||||||||||||||||||||
| package sql | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| import ( | ||||||||||||||||||||||||||||||||||||||||||||
| "errors" | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| "github.com/grafana/grafana-plugin-sdk-go/data" | ||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| type DB struct { | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| func (db *DB) TablesList(rawSQL string) ([]string, error) { | ||||||||||||||||||||||||||||||||||||||||||||
| return nil, errors.New("not implemented") | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| func (db *DB) RunCommands(commands []string) (string, error) { | ||||||||||||||||||||||||||||||||||||||||||||
| return "", errors.New("not implemented") | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| func (db *DB) QueryFramesInto(name string, query string, frames []*data.Frame, f *data.Frame) error { | ||||||||||||||||||||||||||||||||||||||||||||
| return errors.New("not implemented") | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| func NewInMemoryDB() *DB { | ||||||||||||||||||||||||||||||||||||||||||||
| return &DB{} | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+9
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: All database methods are unimplemented stubs. This implementation replaces the external Consider one of the following approaches:
func (db *DB) TablesList(rawSQL string) ([]string, error) {
- return nil, errors.New("not implemented")
+ return nil, errors.New("SQL expressions are temporarily disabled - implementation in progress")
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,6 @@ import ( | |
| "time" | ||
|
|
||
| "github.com/grafana/grafana-plugin-sdk-go/data" | ||
| "github.com/scottlepp/go-duck/duck" | ||
|
|
||
| "github.com/grafana/grafana/pkg/apimachinery/errutil" | ||
| "github.com/grafana/grafana/pkg/expr/mathexp" | ||
|
|
@@ -94,11 +93,11 @@ func (gr *SQLCommand) Execute(ctx context.Context, now time.Time, vars mathexp.V | |
|
|
||
| rsp := mathexp.Results{} | ||
|
|
||
| duckDB := duck.NewInMemoryDB() | ||
| db := sql.NewInMemoryDB() | ||
| var frame = &data.Frame{} | ||
|
|
||
| logger.Debug("Executing query", "query", gr.query, "frames", len(allFrames)) | ||
| err := duckDB.QueryFramesInto(gr.refID, gr.query, allFrames, frame) | ||
| err := db.QueryFramesInto(gr.refID, gr.query, allFrames, frame) | ||
|
Comment on lines
+96
to
+100
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SQL query execution will fail due to unimplemented database methods. The migration from Ensure either:
🤖 Prompt for AI Agents |
||
| if err != nil { | ||
| logger.Error("Failed to query frames", "error", err.Error()) | ||
| rsp.Error = 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.
Critical logic error in feature gate implementation.
The
enableSqlExpressionsfunction has flawed logic that always returnsfalse, effectively disabling SQL expressions unconditionally:falseFix the logic to properly respect the feature flag:
func enableSqlExpressions(h *ExpressionQueryReader) bool { - enabled := !h.features.IsEnabledGlobally(featuremgmt.FlagSqlExpressions) - if enabled { - return false - } - return false + return h.features.IsEnabledGlobally(featuremgmt.FlagSqlExpressions) }📝 Committable suggestion
🤖 Prompt for AI Agents