Skip to content

Commit cb1f190

Browse files
committed
Add VirusTotal upload to release workflow, bring back Snowflake driver
Adds a step to the release workflow to upload artifacts to VirusTotal, brings back the Snowflake driver.
1 parent 4f338e2 commit cb1f190

File tree

7 files changed

+208
-44
lines changed

7 files changed

+208
-44
lines changed

.github/workflows/release.yml

+26-1
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,33 @@ jobs:
152152
steps:
153153
- name: Download artifacts
154154
uses: actions/download-artifact@v4
155+
- name: Extract artifacts
156+
run: |
157+
mkdir /tmp/scan
158+
mkdir scan
159+
for i in dist-*/*/*/*.tar.bz2; do
160+
ver=$(sed -e 's/\.tar\.bz2$//' <<< $i|cut -d- -f2-)
161+
echo "extracting $i ($ver)"
162+
tar -C /tmp/scan -jv -f $i -x $APP
163+
hash=$(sha256sum /tmp/scan/$APP|awk '{print $1}')
164+
mv /tmp/scan/$APP ./scan/$APP-$ver-${hash:0:8}
165+
done
166+
for i in dist-*/*/*/*.zip; do
167+
ver=$(sed -e 's/\.zip$//' <<< $i|cut -d- -f2-)
168+
echo "extracting $i ($ver)"
169+
unzip -d /tmp/scan $i $APP.exe
170+
hash=$(sha256sum /tmp/scan/$APP.exe|awk '{print $1}')
171+
mv /tmp/scan/$APP.exe ./scan/$APP-$ver-${hash:0:8}.exe
172+
done
173+
- name: Submit to VirusTotal
174+
uses: crazy-max/ghaction-virustotal@v4
175+
with:
176+
vt_api_key: ${{ secrets.VIRUSTOTAL_API_KEY }}
177+
request_rate: 4
178+
files: |
179+
./scan/${{ env.APP }}-*
155180
- name: Release
156-
uses: softprops/action-gh-release@v1
181+
uses: softprops/action-gh-release@v2
157182
if: startsWith(github.ref, 'refs/tags/v')
158183
with:
159184
name: ${{ env.APP }} ${{ env.VER }}

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ associated database, scheme / build tag, and scheme aliases:
283283
| DynamoDb | `dynamodb` | `dy`, `dyn`, `dynamo`, `dynamodb` | [github.com/btnguyen2k/godynamo][d-dynamodb] |
284284
| Exasol | `exasol` | `ex`, `exa` | [github.com/exasol/exasol-driver-go][d-exasol] |
285285
| Firebird | `firebird` | `fb`, `firebirdsql` | [github.com/nakagami/firebirdsql][d-firebird] |
286-
| FlightSQL | `flightsql` | `fl`, `flight` | [github.com/apache/arrow/go/v16/arrow/flight/flightsql/driver][d-flightsql] |
286+
| FlightSQL | `flightsql` | `fl`, `flight` | [github.com/apache/arrow/go/v17/arrow/flight/flightsql/driver][d-flightsql] |
287287
| Google BigQuery | `bigquery` | `bq` | [gorm.io/driver/bigquery/driver][d-bigquery] |
288288
| Google Spanner | `spanner` | `sp` | [github.com/googleapis/go-sql-spanner][d-spanner] |
289289
| Microsoft ADODB | `adodb` | `ad`, `ado` | [github.com/mattn/go-adodb][d-adodb] |
@@ -295,6 +295,7 @@ associated database, scheme / build tag, and scheme aliases:
295295
| RamSQL | `ramsql` | `rm`, `ram` | [github.com/proullon/ramsql/driver][d-ramsql] |
296296
| SAP ASE | `sapase` | `ax`, `ase`, `tds` | [github.com/thda/tds][d-sapase] |
297297
| SAP HANA | `saphana` | `sa`, `sap`, `hana`, `hdb` | [github.com/SAP/go-hdb/driver][d-saphana] |
298+
| Snowflake | `snowflake` | `sf` | [github.com/snowflakedb/gosnowflake][d-snowflake] |
298299
| Trino | `trino` | `tr`, `trs`, `trinos` | [github.com/trinodb/trino-go-client/trino][d-trino] |
299300
| Vertica | `vertica` | `ve` | [github.com/vertica/vertica-sql-go][d-vertica] |
300301
| VoltDB | `voltdb` | `vo`, `vdb`, `volt` | [github.com/VoltDB/voltdb-client-go/voltdbclient][d-voltdb] |
@@ -355,6 +356,7 @@ associated database, scheme / build tag, and scheme aliases:
355356
[d-ramsql]: https://github.com/proullon/ramsql
356357
[d-sapase]: https://github.com/thda/tds
357358
[d-saphana]: https://github.com/SAP/go-hdb
359+
[d-snowflake]: https://github.com/snowflakedb/gosnowflake
358360
[d-spanner]: https://github.com/googleapis/go-sql-spanner
359361
[d-sqlite3]: https://github.com/mattn/go-sqlite3
360362
[d-sqlserver]: https://github.com/microsoft/go-mssqldb

drivers/snowflake/snowflake.go

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Package snowflake defines and registers usql's Snowflake driver.
2+
//
3+
// See: https://github.com/snowflakedb/gosnowflake
4+
package snowflake
5+
6+
import (
7+
"io"
8+
"strconv"
9+
10+
"github.com/snowflakedb/gosnowflake" // DRIVER
11+
"github.com/xo/tblfmt"
12+
"github.com/xo/usql/drivers"
13+
"github.com/xo/usql/drivers/metadata"
14+
infos "github.com/xo/usql/drivers/metadata/informationschema"
15+
"github.com/xo/usql/env"
16+
)
17+
18+
func init() {
19+
gosnowflake.GetLogger().SetOutput(io.Discard)
20+
newReader := infos.New(
21+
infos.WithPlaceholder(func(int) string { return "?" }),
22+
infos.WithCustomClauses(map[infos.ClauseName]string{
23+
infos.SequenceColumnsIncrement: "''",
24+
}),
25+
infos.WithFunctions(false),
26+
infos.WithIndexes(false),
27+
infos.WithConstraints(false),
28+
infos.WithColumnPrivileges(false),
29+
)
30+
drivers.Register("snowflake", drivers.Driver{
31+
AllowMultilineComments: true,
32+
Err: func(err error) (string, string) {
33+
if e, ok := err.(*gosnowflake.SnowflakeError); ok {
34+
return strconv.Itoa(e.Number), e.Message
35+
}
36+
return "", err.Error()
37+
},
38+
NewMetadataReader: newReader,
39+
NewMetadataWriter: func(db drivers.DB, w io.Writer, opts ...metadata.ReaderOption) metadata.Writer {
40+
writerOpts := []metadata.WriterOption{
41+
metadata.WithListAllDbs(func(pattern string, verbose bool) error {
42+
return listAllDbs(db, w, pattern, verbose)
43+
}),
44+
}
45+
return metadata.NewDefaultWriter(newReader(db, opts...), writerOpts...)(db, w)
46+
},
47+
})
48+
}
49+
50+
func listAllDbs(db drivers.DB, w io.Writer, pattern string, verbose bool) error {
51+
rows, err := db.Query("SHOW databases")
52+
if err != nil {
53+
return err
54+
}
55+
defer rows.Close()
56+
57+
params := env.Pall()
58+
params["title"] = "List of databases"
59+
return tblfmt.EncodeAll(w, rows, params)
60+
}

go.mod

+31-13
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ require (
2525
github.com/datafuselabs/databend-go v0.7.1
2626
github.com/docker/docker v27.3.0+incompatible
2727
github.com/exasol/exasol-driver-go v1.0.10
28-
github.com/go-git/go-billy/v5 v5.5.0
28+
github.com/go-git/go-billy/v5 v5.6.0
2929
github.com/go-sql-driver/mysql v1.8.1
3030
github.com/gocql/gocql v1.7.0
3131
github.com/godror/godror v0.44.8
@@ -51,6 +51,7 @@ require (
5151
github.com/prestodb/presto-go-client v0.0.0-20240426182841-905ac40a1783
5252
github.com/proullon/ramsql v0.1.4
5353
github.com/sijms/go-ora/v2 v2.8.22
54+
github.com/snowflakedb/gosnowflake v1.11.2
5455
github.com/spf13/cobra v1.8.1
5556
github.com/spf13/pflag v1.0.5
5657
github.com/spf13/viper v1.19.0
@@ -63,7 +64,7 @@ require (
6364
github.com/xo/resvg v0.6.0
6465
github.com/xo/tblfmt v0.13.2
6566
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e
66-
github.com/ydb-platform/ydb-go-sdk/v3 v3.84.1
67+
github.com/ydb-platform/ydb-go-sdk/v3 v3.85.3
6768
github.com/yookoala/realpath v1.0.0
6869
github.com/ziutek/mymysql v1.5.4
6970
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c
@@ -75,9 +76,9 @@ require (
7576
)
7677

7778
require (
78-
cel.dev/expr v0.16.2 // indirect
79+
cel.dev/expr v0.17.0 // indirect
7980
cloud.google.com/go v0.116.0 // indirect
80-
cloud.google.com/go/auth v0.9.8 // indirect
81+
cloud.google.com/go/auth v0.9.9 // indirect
8182
cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect
8283
cloud.google.com/go/bigquery v1.63.1 // indirect
8384
cloud.google.com/go/compute/metadata v0.5.2 // indirect
@@ -87,17 +88,21 @@ require (
8788
cloud.google.com/go/spanner v1.70.0 // indirect
8889
dario.cat/mergo v1.0.0 // indirect
8990
filippo.io/edwards25519 v1.1.0 // indirect
91+
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
92+
github.com/99designs/keyring v1.2.2 // indirect
9093
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 // indirect
9194
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.0 // indirect
9295
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
96+
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.4.1 // indirect
9397
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
9498
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
9599
github.com/BurntSushi/toml v1.4.0 // indirect
96-
github.com/ClickHouse/ch-go v0.63.0 // indirect
100+
github.com/ClickHouse/ch-go v0.63.1 // indirect
97101
github.com/DATA-DOG/go-sqlmock v1.5.2 // indirect
98102
github.com/DataDog/zstd v1.5.6 // indirect
99103
github.com/GoogleCloudPlatform/grpc-gcp-go/grpcgcp v1.5.1 // indirect
100104
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.24.3 // indirect
105+
github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c // indirect
101106
github.com/Masterminds/semver v1.5.0 // indirect
102107
github.com/Microsoft/go-winio v0.6.2 // indirect
103108
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
@@ -109,14 +114,21 @@ require (
109114
github.com/avast/retry-go v3.0.0+incompatible // indirect
110115
github.com/aws/aws-sdk-go v1.55.5 // indirect
111116
github.com/aws/aws-sdk-go-v2 v1.32.2 // indirect
117+
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.6 // indirect
112118
github.com/aws/aws-sdk-go-v2/credentials v1.17.41 // indirect
113119
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.15.12 // indirect
120+
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.33 // indirect
114121
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 // indirect
115122
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 // indirect
123+
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.21 // indirect
116124
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.2 // indirect
117125
github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.24.2 // indirect
118126
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 // indirect
127+
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.2 // indirect
119128
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.2 // indirect
129+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.2 // indirect
130+
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.2 // indirect
131+
github.com/aws/aws-sdk-go-v2/service/s3 v1.66.0 // indirect
120132
github.com/aws/smithy-go v1.22.0 // indirect
121133
github.com/beltran/gohive v1.7.0 // indirect
122134
github.com/beltran/gosasl v0.0.0-20241020113154-d984219623d1 // indirect
@@ -146,7 +158,8 @@ require (
146158
github.com/couchbase/go-couchbase v0.1.1 // indirect
147159
github.com/couchbase/gomemcached v0.3.2 // indirect
148160
github.com/couchbase/goutils v0.1.2 // indirect
149-
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
161+
github.com/cyphar/filepath-securejoin v0.2.5 // indirect
162+
github.com/danieljoos/wincred v1.2.2 // indirect
150163
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
151164
github.com/distribution/reference v0.6.0 // indirect
152165
github.com/dlclark/regexp2 v1.11.4 // indirect
@@ -157,15 +170,17 @@ require (
157170
github.com/dop251/goja v0.0.0-20241009100908-5f46f2705ca3 // indirect
158171
github.com/dop251/goja_nodejs v0.0.0-20240728170619-29b559befffc // indirect
159172
github.com/dustin/go-humanize v1.0.1 // indirect
173+
github.com/dvsekhvalnov/jose2go v1.7.0 // indirect
160174
github.com/edsrzf/mmap-go v1.2.0 // indirect
161175
github.com/elastic/go-sysinfo v1.14.2 // indirect
162176
github.com/elastic/go-windows v1.0.2 // indirect
163177
github.com/envoyproxy/go-control-plane v0.13.1 // indirect
164178
github.com/envoyproxy/protoc-gen-validate v1.1.0 // indirect
165179
github.com/exasol/error-reporting-go v0.2.0 // indirect
166-
github.com/fatih/color v1.17.0 // indirect
180+
github.com/fatih/color v1.18.0 // indirect
167181
github.com/felixge/httpsnoop v1.0.4 // indirect
168182
github.com/fsnotify/fsnotify v1.7.0 // indirect
183+
github.com/gabriel-vasile/mimetype v1.4.6 // indirect
169184
github.com/getsentry/sentry-go v0.29.1 // indirect
170185
github.com/go-faster/city v1.0.1 // indirect
171186
github.com/go-faster/errors v0.7.1 // indirect
@@ -177,6 +192,7 @@ require (
177192
github.com/go-sourcemap/sourcemap v2.1.4+incompatible // indirect
178193
github.com/go-zookeeper/zk v1.0.4 // indirect
179194
github.com/goccy/go-json v0.10.3 // indirect
195+
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
180196
github.com/godror/knownpb v0.2.0 // indirect
181197
github.com/gogo/protobuf v1.3.2 // indirect
182198
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
@@ -190,14 +206,15 @@ require (
190206
github.com/golang/snappy v0.0.4 // indirect
191207
github.com/google/flatbuffers/go v0.0.0-20230110200425-62e4d2e5b215 // indirect
192208
github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2 // indirect
193-
github.com/google/pprof v0.0.0-20241017200806-017d972448fc // indirect
209+
github.com/google/pprof v0.0.0-20241021161924-4cf4322d492d // indirect
194210
github.com/google/s2a-go v0.1.8 // indirect
195211
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
196212
github.com/google/uuid v1.6.0 // indirect
197213
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
198214
github.com/googleapis/gax-go/v2 v2.13.0 // indirect
199215
github.com/gorilla/websocket v1.5.3 // indirect
200216
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
217+
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
201218
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
202219
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
203220
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
@@ -244,6 +261,7 @@ require (
244261
github.com/moby/sys/user v0.1.0 // indirect
245262
github.com/moby/sys/userns v0.1.0 // indirect
246263
github.com/moby/term v0.5.0 // indirect
264+
github.com/mtibben/percent v0.2.1 // indirect
247265
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
248266
github.com/nathan-fiscaletti/consolesize-go v0.0.0-20220204101620-317176b6684d // indirect
249267
github.com/ncruces/go-strftime v0.1.9 // indirect
@@ -284,7 +302,7 @@ require (
284302
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
285303
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
286304
github.com/xwb1989/sqlparser v0.0.0-20180606152119-120387863bf2 // indirect
287-
github.com/ydb-platform/ydb-go-genproto v0.0.0-20241002120727-5acc94bcb119 // indirect
305+
github.com/ydb-platform/ydb-go-genproto v0.0.0-20241022174402-dd276c7f197b // indirect
288306
github.com/zeebo/xxh3 v1.0.2 // indirect
289307
gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b // indirect
290308
go.opencensus.io v0.24.0 // indirect
@@ -311,10 +329,10 @@ require (
311329
golang.org/x/time v0.7.0 // indirect
312330
golang.org/x/tools v0.26.0 // indirect
313331
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
314-
google.golang.org/api v0.201.0 // indirect
315-
google.golang.org/genproto v0.0.0-20241015192408-796eee8c2d53 // indirect
316-
google.golang.org/genproto/googleapis/api v0.0.0-20241015192408-796eee8c2d53 // indirect
317-
google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect
332+
google.golang.org/api v0.202.0 // indirect
333+
google.golang.org/genproto v0.0.0-20241021214115-324edc3d5d38 // indirect
334+
google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38 // indirect
335+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 // indirect
318336
google.golang.org/grpc v1.67.1 // indirect
319337
google.golang.org/protobuf v1.35.1 // indirect
320338
gopkg.in/inf.v0 v0.9.1 // indirect

0 commit comments

Comments
 (0)