Skip to content

Commit

Permalink
Adding FlightSQL driver
Browse files Browse the repository at this point in the history
  • Loading branch information
kenshaw committed Apr 12, 2023
1 parent e877064 commit 2525b8b
Show file tree
Hide file tree
Showing 10 changed files with 450 additions and 717 deletions.
116 changes: 59 additions & 57 deletions README.md

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions contrib/flightsql/podman-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
NAME=flightsql
IMAGE=docker.io/voltrondata/flight-sql
PUBLISH=31337:31337
ENV="FLIGHT_PASSWORD=P4ssw0rd"
2 changes: 2 additions & 0 deletions contrib/flightsql/usql-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DB="flightsql://flight_username:P4ssw0rd@localhost:31337?tls=skip-verify"
VSQL="SELECT version() AS version;"
2 changes: 1 addition & 1 deletion contrib/usql-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fi

for TARGET in $SRC/*/usql-config; do
NAME=$(basename $(dirname $TARGET))
if [ ! -z "$(docker ps -q --filter "name=$NAME")" ]; then
if [ ! -z "$(podman ps -q --filter "name=$NAME")" ]; then
unset DB VSQL
source $TARGET
if [ -z "$DB" ]; then
Expand Down
1 change: 1 addition & 0 deletions contrib/usqlpass
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ oracle:*:*:*:system:P4ssw0rd
pgx:*:*:*:postgres:P4ssw0rd
sqlserver:*:*:*:sa:Adm1nP@ssw0rd
vertica:*:*:*:vertica:P4ssw0rd
flightsql:*:*:*:flight_username:P4ssw0rd
28 changes: 28 additions & 0 deletions drivers/flightsql/flightsql.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Package flightsql defines and registers usql's FlightSQL driver.
//
// See: https://github.com/apache/arrow/tree/main/go/arrow/flight/flightsql/driver
package flight

import (
"context"

_ "github.com/apache/arrow/go/v12/arrow/flight/flightsql/driver" // DRIVER
"github.com/xo/usql/drivers"
)

func init() {
drivers.Register("flightsql", drivers.Driver{
AllowMultilineComments: true,
Version: func(ctx context.Context, db drivers.DB) (string, error) {
var ver string
err := db.QueryRowContext(
ctx,
`SELECT version()`,
).Scan(&ver)
if err != nil {
return "", err
}
return "FlightSQL " + ver, nil
},
})
}
66 changes: 33 additions & 33 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ require (
github.com/alexbrainman/odbc v0.0.0-20211220213544-9c9a2e61c5e2
github.com/aliyun/aliyun-tablestore-go-sql-driver v0.0.0-20220418015234-4d337cb3eed9
github.com/amsokol/ignite-go-client v0.12.2
github.com/apache/arrow/go/v12 v12.0.0-20230412182156-631c68a3068a
github.com/apache/calcite-avatica-go/v5 v5.2.0
github.com/bippio/go-impala v2.1.0+incompatible
github.com/btnguyen2k/gocosmos v0.2.0
github.com/couchbase/go_n1ql v0.0.0-20220303011133-0ed4bf93e31d
github.com/databendcloud/databend-go v0.4.1
github.com/docker/docker v20.10.24+incompatible
github.com/exasol/exasol-driver-go v0.4.7
github.com/docker/docker v23.0.3+incompatible
github.com/exasol/exasol-driver-go v1.0.0
github.com/genjidb/genji v0.15.1
github.com/go-sql-driver/mysql v1.7.0
github.com/gocql/gocql v1.3.2
Expand All @@ -43,19 +44,19 @@ require (
github.com/nakagami/firebirdsql v0.9.6
github.com/ory/dockertest/v3 v3.9.1
github.com/prestodb/presto-go-client v0.0.0-20230308082557-3d2522aa3016
github.com/sijms/go-ora/v2 v2.6.12
github.com/sijms/go-ora/v2 v2.6.16
github.com/sirupsen/logrus v1.9.0
github.com/snowflakedb/gosnowflake v1.6.19
github.com/thda/tds v0.1.7
github.com/trinodb/trino-go-client v0.310.0
github.com/uber/athenadriver v1.1.14
github.com/vertica/vertica-sql-go v1.3.2
github.com/xo/dburl v0.13.1
github.com/xo/dburl v0.14.1
github.com/xo/tblfmt v0.10.1
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e
github.com/yookoala/realpath v1.0.0
github.com/ziutek/mymysql v1.5.4
gorm.io/driver/bigquery v1.1.0
gorm.io/driver/bigquery v1.2.0
modernc.org/ql v1.4.4
modernc.org/sqlite v1.21.1
sqlflow.org/gohive v0.0.0-20220817082204-15a5e01fd889
Expand All @@ -65,14 +66,14 @@ require (
require (
cloud.google.com/go v0.110.0 // indirect
cloud.google.com/go/bigquery v1.50.0 // indirect
cloud.google.com/go/compute v1.19.0 // indirect
cloud.google.com/go/compute v1.19.1 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.0.0 // indirect
cloud.google.com/go/longrunning v0.4.1 // indirect
cloud.google.com/go/spanner v1.44.0 // indirect
cloud.google.com/go/spanner v1.45.0 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.2 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.5.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.0.0 // indirect
Expand All @@ -84,7 +85,6 @@ require (
github.com/IBM/nzgo v11.1.0+incompatible // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/Microsoft/hcsshim v0.9.4 // indirect
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/aliyun/aliyun-tablestore-go-sdk v1.7.7 // indirect
Expand All @@ -93,19 +93,19 @@ require (
github.com/apache/arrow/go/v11 v11.0.0 // indirect
github.com/apache/thrift v0.18.1 // indirect
github.com/avast/retry-go v3.0.0+incompatible // indirect
github.com/aws/aws-sdk-go v1.44.237 // indirect
github.com/aws/aws-sdk-go-v2 v1.17.7 // indirect
github.com/aws/aws-sdk-go v1.44.242 // indirect
github.com/aws/aws-sdk-go-v2 v1.17.8 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.13.18 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.60 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.31 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.25 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.23 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.13.20 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.62 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.32 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.26 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.24 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.26 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.25 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.14.0 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.31.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.27 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.26 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.14.1 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.31.3 // indirect
github.com/aws/smithy-go v1.13.5 // indirect
github.com/beltran/gohive v1.5.4 // indirect
github.com/beltran/gosasl v0.0.0-20230115020419-e3b503e58833 // indirect
Expand All @@ -124,9 +124,8 @@ require (
github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195 // indirect
github.com/cockroachdb/errors v1.9.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v0.0.0-20230405180252-16bf77ee4012 // indirect
github.com/cockroachdb/pebble v0.0.0-20230412195903-4e468412c552 // indirect
github.com/cockroachdb/redact v1.1.3 // indirect
github.com/containerd/cgroups v1.0.4 // indirect
github.com/containerd/containerd v1.6.8 // indirect
github.com/containerd/continuity v0.3.0 // indirect
github.com/couchbase/go-couchbase v0.1.1 // indirect
Expand All @@ -141,7 +140,7 @@ require (
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
github.com/edsrzf/mmap-go v1.1.0 // indirect
github.com/elastic/go-sysinfo v1.10.0 // indirect
github.com/elastic/go-sysinfo v1.10.1 // indirect
github.com/elastic/go-windows v1.0.1 // indirect
github.com/envoyproxy/go-control-plane v0.11.0 // indirect
github.com/envoyproxy/protoc-gen-validate v0.10.1 // indirect
Expand All @@ -166,6 +165,7 @@ require (
github.com/golang/snappy v0.0.4 // indirect
github.com/google/flatbuffers/go v0.0.0-20230110200425-62e4d2e5b215 // indirect
github.com/google/goterm v0.0.0-20190703233501-fc88cf888a3f // indirect
github.com/google/s2a-go v0.1.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
Expand Down Expand Up @@ -206,8 +206,8 @@ require (
github.com/mithrandie/go-file/v2 v2.1.0 // indirect
github.com/mithrandie/go-text v1.6.0 // indirect
github.com/mithrandie/ternary v1.1.1 // indirect
github.com/moby/sys/mount v0.3.3 // indirect
github.com/moby/sys/mountinfo v0.6.2 // indirect
github.com/moby/patternmatcher v0.5.0 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
github.com/mtibben/percent v0.2.1 // indirect
github.com/nathan-fiscaletti/consolesize-go v0.0.0-20220204101620-317176b6684d // indirect
Expand All @@ -228,7 +228,7 @@ require (
github.com/segmentio/asm v1.2.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/twmb/murmur3 v1.1.6 // indirect
github.com/twmb/murmur3 v1.1.7 // indirect
github.com/uber-go/tally v3.5.3+incompatible // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
Expand All @@ -243,20 +243,20 @@ require (
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/crypto v0.7.0 // indirect
golang.org/x/crypto v0.8.0 // indirect
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/oauth2 v0.6.0 // indirect
golang.org/x/net v0.9.0 // indirect
golang.org/x/oauth2 v0.7.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.7.0 // indirect
golang.org/x/term v0.7.0 // indirect
golang.org/x/text v0.8.0 // indirect
golang.org/x/tools v0.7.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/tools v0.8.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.116.0 // indirect
google.golang.org/api v0.118.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230403163135-c38d8f061ccd // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
google.golang.org/grpc v1.54.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
Expand Down
Loading

0 comments on commit 2525b8b

Please sign in to comment.