auxten/postgresql-parser
auxten/postgresql-parser has 317 GitHub stars and 62 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-14 00:12 UTC. Last push 2026-05-30.
可以做什么
- Pure golang implementation
- Almost full support of PostgreSQL (cockroachdb style PostgreSQL)
- For SQL lineage analysis see go-sql-lineage
实测星标增长
- 24小时
- 0
- 7天
- 正在收集历史
- 15天
- 正在收集历史
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
关于
Pure Golang PostgreSQL (SQL:2011, SQL:2008, SQL:2003, SQL:1999, and SQL-92 Standard) Parser
数据README.md
原文What's this
PostgreSQL style Parser splitted from CockroachDB
See: Complex SQL format example
I tried to import github.com/cockroachdb/cockroach/pkg/sql/parser, but the dependencies is too complex to make it work.
To make things easy, I did these things:
- Copy all the
pkg/sql/parser,pkg/sql/lexand simplify the dependencies - Simplify the Makefile to just generate the goyacc stuff
- Add the goyacc generated files in parser and lex to make
go getwork easily, see the.gitignorefiles - Trim the
etcddependency, see thego.mod - Rename all test file except some
pkg/sql/parsertests - Add all necessary imports to vendor
- Remove the
panicof meeting unregistried functions, see the WrapFunction - Other nasty things make the parser just work that I forgot :p
Who is using this
Features
- Pure golang implementation
- Almost full support of PostgreSQL (
cockroachdbstyle PostgreSQL) - For SQL lineage analysis see go-sql-lineage
SQL Standard Compliance
The code is derived from CockroachDB v20.1.11 which supports most of the major features of SQL:2011. See:
How to use
package main
import (
"log"
"github.com/auxten/postgresql-parser/pkg/sql/parser"
"github.com/auxten/postgresql-parser/pkg/walk"
)
func main() {
sql := `select marr
from (select marr_stat_cd AS marr, label AS l
from root_loan_mock_v4
order by root_loan_mock_v4.age desc, l desc
limit 5) as v4
LIMIT 1;`
w := &walk.AstWalker{
Fn: func(ctx interface{}, node interface{}) (stop bool) {
log.Printf("node type %T", node)
return false
},
}
stmts, err := parser.Parse(sql)
if err != nil {
return
}
_, _ = w.Walk(stmts, nil)
return
}
SQL parser
This project contains code that is automatically generated using goyacc.
goyacc reads the SQL expressions (sql.y) and generates a parser which could be used to tokenize a given input.
You could update the generated code using the generate target inside the project's Makefile.
$ make generate
Progress
- 2021-02-16
github.com/auxten/postgresql-parser/pkg/sql/parserUnit tests works now! - 2021-03-08 Add walker package.
- 2022-08-03 Remove vendored dependencies by @mostafa in https://github.com/auxten/postgresql-parser/pull/19
Todo
- Fix more unit tests
- Make built-in function parsing work
探索相关项目
Asabeneh/30-Days-Of-Python
30 Days of Python 编程挑战是一份循序渐进的指南,用于在 30 天内学习 Python 编程语言。这项挑战可能需要超过 100 天。请按自己的节奏进行。这些视频或许也有帮助:https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
78,706 星标grafana/grafana
开放且可组合的可观测性与数据可视化平台。可对来自 Prometheus、Loki、Elasticsearch、InfluxDB、Postgres 等众多数据源的指标、日志和追踪进行可视化。
77,892 星标redis/redis
对于正在构建实时数据驱动应用的开发者而言,Redis 是首选、速度最快且功能最丰富的缓存、数据结构服务器和文档与向量查询引擎。
77,491 星标apache/superset
Apache Superset 是一个数据可视化与数据探索平台
75,520 星标