https://github.com/bytebase/omni
SQL language infrastructure for multiple database engines
https://github.com/bytebase/omni
Last synced: 3 days ago
JSON representation
SQL language infrastructure for multiple database engines
- Host: GitHub
- URL: https://github.com/bytebase/omni
- Owner: bytebase
- License: mit
- Created: 2026-03-13T02:59:55.000Z (25 days ago)
- Default Branch: main
- Last Pushed: 2026-04-03T10:48:41.000Z (4 days ago)
- Last Synced: 2026-04-04T01:48:51.825Z (3 days ago)
- Language: Go
- Size: 7.51 MB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Omni
SQL toolchain for multiple database engines. Each engine provides a parser, AST, and additional components such as catalog simulation and semantic analysis -- all in pure Go with zero dependencies.
## Features
- **Zero dependencies** -- pure Go, no CGo, no generated code at runtime
- **Full AST** -- every parsed statement produces a complete abstract syntax tree
- **Position tracking** -- every AST node carries byte-offset location info
- **Beyond parsing** -- catalog simulation, DDL semantic analysis, and more per engine
## Status
| Engine | Parser | Catalog | Completion |
|--------|--------|---------|------------|
| PostgreSQL | :white_check_mark: | :white_check_mark: | Planned |
| MySQL | :construction: | Planned | Planned |
| SQL Server | :construction: | Planned | Planned |
| Oracle | :construction: | Planned | Planned |
## Quick Start
```bash
go get github.com/bytebase/omni
```
### PostgreSQL
```go
package main
import (
"fmt"
"github.com/bytebase/omni/pg"
"github.com/bytebase/omni/pg/ast"
)
func main() {
stmts, err := pg.Parse("SELECT 1; CREATE TABLE t (id int);")
if err != nil {
panic(err)
}
for _, s := range stmts {
fmt.Printf("%-20T %s\n", s.AST, s.Text)
}
// *ast.SelectStmt SELECT 1;
// *ast.CreateStmt CREATE TABLE t (id int);
}
```
## Architecture
```
omni/
├── pg/ PostgreSQL
│ ├── parse.go Public API: Parse(sql) → []Statement
│ ├── ast/ 210+ AST node types
│ ├── parser/ Recursive descent parser (~29K lines)
│ ├── catalog/ In-memory catalog simulation & DDL analysis
│ ├── parsertest/ 746 test cases
│ └── pgregress/ PostgreSQL regression test compatibility
├── mysql/ MySQL
│ ├── ast/ AST node types
│ ├── parser/ Recursive descent parser
│ └── parsertest/ Test cases
├── mssql/ SQL Server (T-SQL)
│ ├── ast/ AST node types
│ ├── parser/ Recursive descent parser
│ └── parsertest/ Test cases
├── oracle/ Oracle
│ ├── ast/ AST node types
│ └── parser/ Recursive descent parser
└── scripts/ Shared build & audit tooling
```
## Development
```bash
# Run all tests
make test
# Test a specific engine
make test-pg
make test-mysql
make test-mssql
make test-oracle
# Build everything
make build
```
## License
MIT -- see [LICENSE](LICENSE).