Go GoDoc

Go bindings for ZetaSQL

ZetaSQL can parse all queries related to Cloud Spanner and BigQuery. This functionality is provided from the Go language using cgo.


  • No need to install ZetaSQL library

    • go-zetasql contains all the source code needed to build ZetaSQL and builds at go get github.com/goccy/go-zetasql timing. Therefore, there is no need to install dependent libraries separately.
  • Can create a portable single binary even though it using cgo

    • You can create a static binary even with CGO_ENABLED=1 by specifying the following options at build time: --ldflags '-extldflags "-static"'
  • Can access all the APIs of the ZetaSQL parser

    • The ZetaSQL parser is not publicly available, but it is available in go-zetasql


In the feaatures of ZetaSQL, you can use the functions of the following packages. Will be added sequentially.

Package Supported
parser yes
public partial
analyzer no
scripting no
reference_impl no


go-zetasql uses cgo. Therefore, CGO_ENABLED=1 is required to build. Also, the compiler recommends clang++. Please set CXX=clang++ to install.

Environment Name Value
CGO_ENABLED 1 ( required )
CXX clang++ ( recommended )


go get github.com/goccy/go-zetasql

The first time you run it, it takes time to build all the ZetaSQL code used by go-zetasql.


Apache-2.0 License

Since go-zetasql builds all source code including dependencies at install time, it directly contains the source code of the following libraries. Therefore, the license is set according to the license of the dependent library.


View Github