Skip to content
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

Docs: Flight SQL Driver Go Usage documentation is out of date #2354

Closed
NightTrain opened this issue Dec 5, 2024 · 1 comment · Fixed by #2395
Closed

Docs: Flight SQL Driver Go Usage documentation is out of date #2354

NightTrain opened this issue Dec 5, 2024 · 1 comment · Fixed by #2395
Assignees
Labels
Type: enhancement New feature or request

Comments

@NightTrain
Copy link

NightTrain commented Dec 5, 2024

What feature or improvement would you like to see?

Looks like the Go usage for the Flight SQL Driver is a bit out of date:
https://arrow.apache.org/adbc/current/driver/flight_sql.html

import (
   "context"

   "github.com/apache/arrow-adbc/go/adbc"
   "github.com/apache/arrow-adbc/go/adbc/driver/flightsql"
)

var headers = map[string]string{"foo": "bar"}

func main() {
   options := map[string]string{
       adbc.OptionKeyURI: "grpc+tls://localhost:8080",
       flightsql.OptionSSLSkipVerify: adbc.OptionValueEnabled,
   }

   for k, v := range headers {
       options[flightsql.OptionRPCCallHeaderPrefix + k] = v
   }

   var drv flightsql.Driver
   db, err := drv.NewDatabase(options)
   if err != nil {
       // do something with the error
   }
   defer db.Close()

   cnxn, err := db.Open(context.Background())
   if err != nil {
       // handle the error
   }
   defer cnxn.Close()
}

Specifically var drv flightsql.Driver doesn't work in the latest version. Looks like this was last viable as of v0.7.0
https://pkg.go.dev/github.com/apache/arrow-adbc/go/adbc@v0.7.0/driver/flightsql

Regardless using the NewDriver method works as intended:

import (
   "context"

   "github.com/apache/arrow-adbc/go/adbc"
   "github.com/apache/arrow-adbc/go/adbc/driver/flightsql"
)

var headers = map[string]string{"foo": "bar"}

func main() {
   options := map[string]string{
       adbc.OptionKeyURI: "grpc+tls://localhost:8080",
       flightsql.OptionSSLSkipVerify: adbc.OptionValueEnabled,
   }

   for k, v := range headers {
       options[flightsql.OptionRPCCallHeaderPrefix + k] = v
   }

   var alloc memory.Allocator
   drv := flightsql.NewDriver(alloc)
   db, err := drv.NewDatabase(options)
   if err != nil {
       // do something with the error
   }
   defer db.Close()

   cnxn, err := db.Open(context.Background())
   if err != nil {
       // handle the error
   }
   defer cnxn.Close()
}
@NightTrain NightTrain added the Type: enhancement New feature or request label Dec 5, 2024
@lidavidm
Copy link
Member

lidavidm commented Dec 5, 2024

Ah, I should try to turn this into an executable example so that it gets properly built and tested in CI

@lidavidm lidavidm added this to the ADBC Libraries 16 milestone Dec 5, 2024
@lidavidm lidavidm self-assigned this Dec 26, 2024
lidavidm added a commit to lidavidm/arrow-adbc that referenced this issue Dec 26, 2024
lidavidm added a commit to lidavidm/arrow-adbc that referenced this issue Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants