File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import (
1313 "github.com/grafana/grafana-plugin-sdk-go/data/sqlutil"
1414 "github.com/grafana/sqlds/v2"
1515 "github.com/pkg/errors"
16+ "github.com/trinodb/grafana-trino/pkg/trino/constants"
1617 "github.com/trinodb/grafana-trino/pkg/trino/driver"
1718 "github.com/trinodb/grafana-trino/pkg/trino/models"
1819)
@@ -79,11 +80,20 @@ func (s *TrinoDatasource) Converters() (sc []sqlutil.Converter) {
7980}
8081
8182func (s * TrinoDatasource ) SetQueryArgs (ctx context.Context , headers http.Header ) []interface {} {
82- user := ctx .Value ("X-Trino-User" )
83- if user == nil {
84- return []interface {}{}
83+ var args []interface {}
84+
85+ user := ctx .Value (constants .TrinoUserHeader )
86+ accessToken := ctx .Value (constants .AccessTokenKey )
87+
88+ if user != nil {
89+ args = append (args , sql .Named (constants .TrinoUserHeader , string (user .(* backend.User ).Login )))
8590 }
86- return []interface {}{sql .Named ("X-Trino-User" , string (user .(* backend.User ).Login ))}
91+
92+ if accessToken != nil {
93+ args = append (args , sql .Named (constants .AccessTokenKey , accessToken .(string )))
94+ }
95+
96+ return args
8797}
8898
8999func (s * TrinoDatasource ) Schemas (ctx context.Context , options sqlds.Options ) ([]string , error ) {
You can’t perform that action at this time.
0 commit comments