A Go implementation of Google SQL(a.k.a. ZetaSQL) statement separator. Google SQL is the SQL dialect of Cloud Spanner, BigQuery, Apache Beam SQL ZetaSQL dialect, etc.
This is experimental and provided without warranty of any kind.
- Separate statements without syntax parsing.
- Query syntax changes will not break user codes.
- It is conceptually a partial implementation of the Google SQL lexical structure.
- Strip comments to support Cloud Spanner Admin API, which doesn't support comments in DDL.
- (Experimental) Can preserve comments using
SeparateInputPreserveComments
,SeparateInputStringPreserveComments
.
- (Experimental) Can preserve comments using
- (Experimental) Alternative termination characters are customizable.
- It is possible to support spanner-cli style command terminators
\G
.- Example:
SELECT 1\G
- Example:
- It is possible to support spanner-cli style command terminators
The implementation of this package is almost a fork of spanner-cli which is derived from spansql.
Statement separators tend to be reinvented because there are no reusable implementations.
- https://github.com/google/zetasql/blob/master/docs/lexical.md
- https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical
- https://cloud.google.com/spanner/docs/reference/standard-sql/lexical
- https://cloud.google.com/dataflow/docs/reference/sql/lexical
- https://beam.apache.org/documentation/dsls/sql/zetasql/lexical/