This is an automated email from the ASF dual-hosted git repository.
lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git
The following commit(s) were added to refs/heads/main by this push:
new 4ba03374 feat(go/adbc/driver/flightsql): add
adbc.flight.sql.client_option.authority (#1060)
4ba03374 is described below
commit 4ba03374a3c5152c4790885a33d06ff9d12697c6
Author: ElenaHenderson <[email protected]>
AuthorDate: Thu Sep 14 06:04:37 2023 -0700
feat(go/adbc/driver/flightsql): add adbc.flight.sql.client_option.authority
(#1060)
Fixes https://github.com/apache/arrow-adbc/issues/1059
---
go/adbc/driver/flightsql/flightsql_adbc.go | 10 ++++++++++
go/adbc/driver/flightsql/flightsql_adbc_test.go | 8 ++++++++
2 files changed, 18 insertions(+)
diff --git a/go/adbc/driver/flightsql/flightsql_adbc.go
b/go/adbc/driver/flightsql/flightsql_adbc.go
index 1dea6eb8..d4583ac9 100644
--- a/go/adbc/driver/flightsql/flightsql_adbc.go
+++ b/go/adbc/driver/flightsql/flightsql_adbc.go
@@ -68,6 +68,7 @@ import (
)
const (
+ OptionAuthority = "adbc.flight.sql.client_option.authority"
OptionMTLSCertChain =
"adbc.flight.sql.client_option.mtls_cert_chain"
OptionMTLSPrivateKey =
"adbc.flight.sql.client_option.mtls_private_key"
OptionSSLOverrideHostname =
"adbc.flight.sql.client_option.tls_override_hostname"
@@ -167,6 +168,7 @@ type dbDialOpts struct {
opts []grpc.DialOption
block bool
maxMsgSize int
+ authority string
}
func (d *dbDialOpts) rebuild() {
@@ -178,6 +180,9 @@ func (d *dbDialOpts) rebuild() {
if d.block {
d.opts = append(d.opts, grpc.WithBlock())
}
+ if d.authority != "" {
+ d.opts = append(d.opts, grpc.WithAuthority(d.authority))
+ }
}
type database struct {
@@ -209,6 +214,11 @@ func (d *database) SetOptions(cnOptions map[string]string)
error {
d.options[k] = v
}
+ if authority, ok := cnOptions[OptionAuthority]; ok {
+ d.dialOpts.authority = authority
+ delete(cnOptions, OptionAuthority)
+ }
+
mtlsCert := cnOptions[OptionMTLSCertChain]
mtlsKey := cnOptions[OptionMTLSPrivateKey]
switch {
diff --git a/go/adbc/driver/flightsql/flightsql_adbc_test.go
b/go/adbc/driver/flightsql/flightsql_adbc_test.go
index 9b434593..057fd08c 100644
--- a/go/adbc/driver/flightsql/flightsql_adbc_test.go
+++ b/go/adbc/driver/flightsql/flightsql_adbc_test.go
@@ -440,6 +440,14 @@ func (suite *OptionTests) TestOverrideHostname() {
suite.Require().NoError(err)
}
+func (suite *OptionTests) TestAuthority() {
+ // Just checks that the option is accepted
+ options := suite.Quirks.DatabaseOptions()
+ options["adbc.flight.sql.client_option.authority"] = "hostname"
+ _, err := suite.Driver.NewDatabase(options)
+ suite.Require().NoError(err)
+}
+
func (suite *OptionTests) TestRootCerts() {
// Just checks that the option is accepted - doesn't actually configure
TLS
options := suite.Quirks.DatabaseOptions()