ZetaSQL

ZetaSQL -- SQL 的分析框架。「ZetaSQL - Analyzer Framework for SQL」

  • Owner: google/zetasql
  • Platform: Linux, Mac
  • License:: Apache License 2.0
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

ZetaSQL -- SQL的分析框架

ZetaSQL 定义了一种语言(语法、类型、数据模型和语义),以及解析器和分析器。它本身不是数据库或查询引擎。相反,它的目的是让多个引擎使用,以便为所有语义分析、名称解析、类型检查、隐式转换等提供一致的行为。特定的查询引擎可能无法实现 ZetaSQL 语言中的所有特性,如果不支持特定的特性,可能会出现错误。例如,引擎 A 可能不支持任何更新,引擎 B 可能不支持分析函数。

ZetaSQL 语言指南

ZetaSQL ResolvedAST API

项目的状态和路线图

这个代码库正在分多个阶段进行开源。

  1. 解析器和分析器完成
    • 初始版本只包括测试的一个子集
  2. 参考实现 正在进行中
    • 基础能力 完成
    • 函数库 正在进行中
  3. 符合性测试完成
    1. 包括验证任意引擎的合规性的框架
  4. 杂项工具
    • 改进的格式化器 正在进行中

计划对以下平台进行多平台支持:

  • Linux(Ubuntu 1804 是我们的参考平台,但其他平台也可能适用)。
  • MacOS (实验性)
  • Windows (TDB 版本)

在所有这些代码发布之前,我们不能提供任何关于 API 稳定性的保证,也不能接受贡献。我们还将随着时间的推移发布更多的文档,特别是与用这个框架开发引擎有关的文档。关于 语言 本身的文档已经相当完整。

Flags

ZetaSQL 使用 Abseil Flags 库来处理命令行标志。除非另有说明,所有的标志只用于调试目的,并可能在任何时候改变、停止工作或被删除。

如何构建

ZetaSQL 使用 bazel 来构建和解决依赖关系。安装完 bazel(我们保持对 1.0 的支持,但其他版本也可以)后,只需运行。

bazel build ...

如何在 bazel 中添加为依赖项

请看(WORKSPACE)文件,因为它有点不寻常。

使用 docker

TODO:添加 docker 构建脚本。

使用实例

一个非常基本的命令行工具可以用参考实现来运行简单的查询: bazel run //zetasql/tools/execute_query:execute_query -- "select 1 + 1;"

参考实现尚未完全发布,目前只支持一个子集的函数和类型。

差异化隐私

关于 ZetaSQL 实现 Differential Privacy 的问题、文档和例子,请查看(https://github.com/google/differential-privacy)。

版本

ZetaSQL 不保证不同版本的兼容性。破坏性的变化可能会在任何时候进行。我们发布的版本是根据提交的日期来编号的。数字的格式是 YYYY.MM.n,其中 YYYY 是年份,MM是两位数的月份,n是时间段内的一个序列号。

许可证

Apache License 2.0

支持声明

这不是一个官方支持的谷歌产品。


Overview

Name With Ownergoogle/zetasql
Primary LanguageC++
Program languagePython (Language Count: 8)
PlatformLinux, Mac
License:Apache License 2.0
Release Count26
Last Release Name2024.03.1 (Posted on )
First Release Name2019.07.1 (Posted on )
Created At2019-04-16 17:43:46
Pushed At2024-03-04 22:43:41
Last Commit At2024-03-04 11:32:03
Stargazers Count2.1k
Watchers Count62
Fork Count214
Commits Count74
Has Issues Enabled
Issues Count134
Issue Open Count86
Pull Requests Count0
Pull Requests Open Count9
Pull Requests Close Count9
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

ZetaSQL - Analyzer Framework for SQL

ZetaSQL defines a language (grammar, types, data model, and semantics) as well
as a parser and analyzer. It is not itself a database or query engine. Instead
it is intended to be used by multiple engines wanting to provide consistent
behavior for all semantic analysis, name resolution, type checking, implicit
casting, etc. Specific query engines may not implement all features in the
ZetaSQL language and may give errors if specific features are not supported. For
example, engine A may not support any updates and engine B may not support
analytic functions.

ZetaSQL Language Guide

ZetaSQL ResolvedAST API

Status of Project and Roadmap

This codebase is being open sourced in multiple phases:

  1. Parser and Analyzer Complete
    • Initial release includes only a subset of tests
  2. Reference Implementation In Progress
    • Base capability Complete
    • Function library In Progress
  3. Compliance Tests Complete
    • includes framework for validating compliance of arbitrary engines
  4. Misc tooling
    • Improved Formatter In Progress

Multiplatform support is planned for the following platforms:

  • Linux (Ubuntu 1804 is our reference platform, but others may work).
  • MacOS (Experimental)
  • Windows (version TDB)

Until all this code is released, we cannot provide any guarantees of API
stability and cannot accept contributions. We will also be releasing more
documentation over time, particular related to developing engines with this
framework. Documentation on the language itself is fairly
complete.

Flags

ZetaSQL uses the Abseil Flags library
to handle commandline flags. Unless otherwise documented, all flags are for
debugging purposes only and may change, stop working or be removed at any time.

How to Build

ZetaSQL uses bazel for building and dependency
resolution. After installing bazel (we maintain support for 1.0,
but other versions may work), simply run:

bazel build ...

How to add as a Dependency in bazel

See the (WORKSPACE) file, as it is a little unusual.

With docker

TODO: Add docker build script.

Example Usage

A very basic command line tool is available to run simple queries with the
reference implementation:
bazel run //zetasql/tools/execute_query:execute_query -- "select 1 + 1;"

The reference implementation is not yet completely released and currently
supports only a subset of functions and types.

Differential Privacy

For questions, documentation and examples of ZetaSQLs implementation of
Differential Privacy, please check out
(https://github.com/google/differential-privacy).

Versions

ZetaSQL makes no guarantees regarding compatibility between releases.
Breaking changes may be made at any time. Our releases are numbered based
on the date of the commit the release is cut from. The number format is
YYYY.MM.n, where YYYY is the year, MM is the two digit month, and n is a
sequence number within the time period.

License

Apache License 2.0

Support Disclaimer

This is not an officially supported Google product.

To the top