Skip to content

Commit 7fddd18

Browse files
authored
✨ Feat: add support for M2M Oauth Serive Principal Authentication (#81)
* ✨ Feat: add support for M2M Oauth Serive Principal Authentication * 📝 Doc: update readme config editor image * ♻️ Refactor: ping databricks after connection * ♻️ Refactor: change variable naming & update readme
1 parent 7a2aef0 commit 7fddd18

File tree

9 files changed

+358
-268
lines changed

9 files changed

+358
-268
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Changelog
22

3-
## 1.2.5
3+
## 1.2.6
4+
5+
- Feature: Add support for M2M OAuth Authentication via Service Principal
6+
7+
---
8+
9+
### 1.2.5
410

511
- Fix: Add support for milliseconds in time window interval
612

README.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,24 @@ grafana/grafana
5454
* Click the `+ Add data source` button in the top header.
5555
* Select Databricks.
5656

57-
To configure the plugin use the values provided under JDBC/ODBC in the advanced options of the Databricks Cluster (or SQL Warehouse) and create a personal access token for Databricks.
57+
To configure the plugin use the values provided under JDBC/ODBC in the advanced options of the Databricks Cluster (or SQL Warehouse) and the the Credentials according to the chosen Authentication Method.
58+
59+
You can either authenticate the plugin using a [Personal Access Token (PAT)](https://docs.databricks.com/en/dev-tools/auth/pat.html) or via [M2M OAuth](https://docs.databricks.com/en/dev-tools/auth/oauth-m2m.html) using a Service Principal Client ID and Client Secret.
5860

5961
![img_1.png](img/config_editor.png)
6062

6163
Available configuration fields are as follows:
6264

63-
| Name | Description |
64-
|----------------------|--------------------------------------------------------------------------------------------------------------|
65-
| Server Hostname | Databricks Server Hostname (without http). i.e. `XXX.cloud.databricks.com` |
66-
| Server Port | Databricks Server Port (default `443`) |
67-
| HTTP Path | HTTP Path value for the existing cluster or SQL warehouse. i.e. `sql/1.0/endpoints/XXX` |
68-
| Access Token | Personal Access Token for Databricks. |
69-
| Code Auto Completion | If enabled the SQL editor will fetch catalogs/schemas/tables/columns from Databricks to provide suggestions. |
65+
| Name | Description |
66+
|-----------------------|--------------------------------------------------------------------------------------------------------------|
67+
| Server Hostname | Databricks Server Hostname (without http). i.e. `XXX.cloud.databricks.com` |
68+
| Server Port | Databricks Server Port (default `443`) |
69+
| HTTP Path | HTTP Path value for the existing cluster or SQL warehouse. i.e. `sql/1.0/endpoints/XXX` |
70+
| Authentication Method | PAT (Personal Access Token) or M2M (Machine to Machine) OAuth Authentication |
71+
| Client ID | Databricks Service Principal Client ID. (only if M2M OAuth is chosen as Auth Method) |
72+
| Client Secret | Databricks Service Principal Client Secret. (only if M2M OAuth is chosen as Auth Method) |
73+
| Access Token | Personal Access Token for Databricks. (only if PAT is chosen as Auth Method) |
74+
| Code Auto Completion | If enabled the SQL editor will fetch catalogs/schemas/tables/columns from Databricks to provide suggestions. |
7075

7176
### Supported Macros
7277

go.mod

Lines changed: 46 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -5,55 +5,58 @@ go 1.21
55
toolchain go1.21.0
66

77
require (
8-
github.com/databricks/databricks-sql-go v1.5.3
9-
github.com/grafana/grafana-plugin-sdk-go v0.217.0
8+
github.com/databricks/databricks-sql-go v1.5.7
9+
github.com/grafana/grafana-plugin-sdk-go v0.235.0
1010
)
1111

1212
require (
1313
github.com/BurntSushi/toml v1.3.2 // indirect
1414
github.com/andybalholm/brotli v1.0.5 // indirect
1515
github.com/apache/arrow/go/v12 v12.0.1 // indirect
16-
github.com/apache/arrow/go/v15 v15.0.0 // indirect
16+
github.com/apache/arrow/go/v15 v15.0.2 // indirect
1717
github.com/apache/thrift v0.17.0 // indirect
1818
github.com/beorn7/perks v1.0.1 // indirect
19-
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
20-
github.com/cespare/xxhash/v2 v2.2.0 // indirect
19+
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
20+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
2121
github.com/cheekybits/genny v1.0.0 // indirect
2222
github.com/chromedp/cdproto v0.0.0-20220208224320-6efb837e6bc2 // indirect
2323
github.com/coreos/go-oidc/v3 v3.5.0 // indirect
24-
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
24+
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
2525
github.com/dnephin/pflag v1.0.7 // indirect
2626
github.com/elazarl/goproxy v0.0.0-20230731152917-f99041a5c027 // indirect
2727
github.com/fatih/color v1.15.0 // indirect
2828
github.com/fsnotify/fsnotify v1.5.4 // indirect
29-
github.com/getkin/kin-openapi v0.120.0 // indirect
29+
github.com/getkin/kin-openapi v0.124.0 // indirect
3030
github.com/go-jose/go-jose/v3 v3.0.3 // indirect
3131
github.com/go-logr/logr v1.4.1 // indirect
3232
github.com/go-logr/stdr v1.2.2 // indirect
33-
github.com/go-openapi/jsonpointer v0.19.6 // indirect
34-
github.com/go-openapi/swag v0.22.4 // indirect
33+
github.com/go-openapi/jsonpointer v0.20.2 // indirect
34+
github.com/go-openapi/swag v0.22.8 // indirect
3535
github.com/goccy/go-json v0.10.2 // indirect
3636
github.com/gogo/protobuf v1.3.2 // indirect
37-
github.com/golang/protobuf v1.5.3 // indirect
37+
github.com/golang/protobuf v1.5.4 // indirect
3838
github.com/golang/snappy v0.0.4 // indirect
3939
github.com/google/flatbuffers v23.5.26+incompatible // indirect
4040
github.com/google/go-cmp v0.6.0 // indirect
4141
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
4242
github.com/google/uuid v1.6.0 // indirect
43-
github.com/gorilla/mux v1.8.0 // indirect
44-
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
45-
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
46-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect
43+
github.com/gorilla/mux v1.8.1 // indirect
44+
github.com/grafana/otel-profiling-go v0.5.1 // indirect
45+
github.com/grafana/pyroscope-go/godeltaprof v0.1.7 // indirect
46+
github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1 // indirect
47+
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 // indirect
48+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect
4749
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
48-
github.com/hashicorp/go-hclog v1.6.2 // indirect
49-
github.com/hashicorp/go-plugin v1.6.0 // indirect
50+
github.com/hashicorp/go-hclog v1.6.3 // indirect
51+
github.com/hashicorp/go-plugin v1.6.1 // indirect
5052
github.com/hashicorp/go-retryablehttp v0.7.1 // indirect
5153
github.com/hashicorp/yamux v0.1.1 // indirect
5254
github.com/invopop/yaml v0.2.0 // indirect
5355
github.com/josharian/intern v1.0.0 // indirect
5456
github.com/json-iterator/go v1.1.12 // indirect
57+
github.com/jszwedko/go-datemath v0.1.1-0.20230526204004-640a500621d6 // indirect
5558
github.com/klauspost/asmfmt v1.3.2 // indirect
56-
github.com/klauspost/compress v1.16.7 // indirect
59+
github.com/klauspost/compress v1.17.3 // indirect
5760
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
5861
github.com/magefile/mage v1.15.0 // indirect
5962
github.com/mailru/easyjson v0.7.7 // indirect
@@ -73,44 +76,42 @@ require (
7376
github.com/pierrec/lz4/v4 v4.1.18 // indirect
7477
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
7578
github.com/pkg/errors v0.9.1 // indirect
76-
github.com/prometheus/client_golang v1.18.0 // indirect
77-
github.com/prometheus/client_model v0.5.0 // indirect
78-
github.com/prometheus/common v0.46.0 // indirect
79-
github.com/prometheus/procfs v0.12.0 // indirect
79+
github.com/prometheus/client_golang v1.19.0 // indirect
80+
github.com/prometheus/client_model v0.6.1 // indirect
81+
github.com/prometheus/common v0.53.0 // indirect
82+
github.com/prometheus/procfs v0.14.0 // indirect
8083
github.com/rs/zerolog v1.28.0 // indirect
8184
github.com/russross/blackfriday/v2 v2.1.0 // indirect
8285
github.com/unknwon/bra v0.0.0-20200517080246-1e3013ecaff8 // indirect
8386
github.com/unknwon/com v1.0.1 // indirect
8487
github.com/unknwon/log v0.0.0-20150304194804-e617c87089d3 // indirect
85-
github.com/urfave/cli v1.22.14 // indirect
88+
github.com/urfave/cli v1.22.15 // indirect
8689
github.com/zeebo/xxh3 v1.0.2 // indirect
87-
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect
88-
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.49.0 // indirect
89-
go.opentelemetry.io/contrib/propagators/jaeger v1.22.0 // indirect
90-
go.opentelemetry.io/contrib/samplers/jaegerremote v0.18.0 // indirect
91-
go.opentelemetry.io/otel v1.24.0 // indirect
92-
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 // indirect
93-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0 // indirect
94-
go.opentelemetry.io/otel/metric v1.24.0 // indirect
95-
go.opentelemetry.io/otel/sdk v1.24.0 // indirect
96-
go.opentelemetry.io/otel/trace v1.24.0 // indirect
97-
go.opentelemetry.io/proto/otlp v1.1.0 // indirect
98-
golang.org/x/crypto v0.21.0 // indirect
90+
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.51.0 // indirect
91+
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.51.0 // indirect
92+
go.opentelemetry.io/contrib/propagators/jaeger v1.26.0 // indirect
93+
go.opentelemetry.io/contrib/samplers/jaegerremote v0.20.0 // indirect
94+
go.opentelemetry.io/otel v1.26.0 // indirect
95+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.26.0 // indirect
96+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.26.0 // indirect
97+
go.opentelemetry.io/otel/metric v1.26.0 // indirect
98+
go.opentelemetry.io/otel/sdk v1.26.0 // indirect
99+
go.opentelemetry.io/otel/trace v1.26.0 // indirect
100+
go.opentelemetry.io/proto/otlp v1.2.0 // indirect
101+
golang.org/x/crypto v0.23.0 // indirect
99102
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
100103
golang.org/x/mod v0.13.0 // indirect
101-
golang.org/x/net v0.22.0 // indirect
102-
golang.org/x/oauth2 v0.16.0 // indirect
103-
golang.org/x/sync v0.6.0 // indirect
104-
golang.org/x/sys v0.18.0 // indirect
105-
golang.org/x/term v0.18.0 // indirect
106-
golang.org/x/text v0.14.0 // indirect
104+
golang.org/x/net v0.25.0 // indirect
105+
golang.org/x/oauth2 v0.20.0 // indirect
106+
golang.org/x/sync v0.7.0 // indirect
107+
golang.org/x/sys v0.20.0 // indirect
108+
golang.org/x/term v0.20.0 // indirect
109+
golang.org/x/text v0.15.0 // indirect
107110
golang.org/x/tools v0.14.0 // indirect
108111
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
109-
google.golang.org/appengine v1.6.8 // indirect
110-
google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect
111-
google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 // indirect
112-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect
113-
google.golang.org/grpc v1.62.1 // indirect
112+
google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be // indirect
113+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be // indirect
114+
google.golang.org/grpc v1.64.0 // indirect
114115
google.golang.org/protobuf v1.33.0 // indirect
115116
gopkg.in/fsnotify/fsnotify.v1 v1.4.7 // indirect
116117
gopkg.in/yaml.v3 v3.0.1 // indirect

0 commit comments

Comments
 (0)