NightTrain opened a new issue, #2354:
URL: https://github.com/apache/arrow-adbc/issues/2354

   ### 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 this context. Based 
on the commit history I'm not sure if this was ever a part of this specific 
package. I did find a reference to it in the sqldriver package so perhaps that 
is where this came from. 
https://github.com/apache/arrow-adbc/blob/main/go/adbc/sqldriver/driver.go#L107
   
   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()
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to