How bytebase/omni works
Omni is a pure-Go toolkit for parsing SQL and database query languages across multiple engines, producing location-aware ASTs and, depending on the engine, offering analysis, catalog simulation, completion, validation, or deparsing. The principal workflow is client SQL or query text → an engine parser → an AST; optional engine-specific layers then analyze query structure or model schema changes. The README documents this common package shape and capabilities. Source excerpts show several analysis implementations, but not every engine’s entry-point wiring, so those links are omitted where the evidence is insufficient.
Main entry points: parser/database.go Redshift parser · parser/database.go PostgreSQL parser · parser/storage.go Doris parser · parser/storage.go StarRocks parser
Components 27
SQL engines
- PostgreSQL parser
pg/parser/database.go - PostgreSQL AST
pg/ast/parsenodes.go - MariaDB parser
mariadb/parser - MySQL parser
mysql/parser/create_database.go - Redshift parser
redshift/parser/database.go - Redshift AST
redshift/ast/parsenodes.go - T-SQL parser
mssql/parser/server.go - Oracle parser
oracle/parser/database.go - Doris parser
doris/parser/storage.go - StarRocks parser
starrocks/parser/storage.go - GoogleSQL parser
googlesql/parser/graph_query.go
Specialized engines
- MongoDB parser
mongo/parser - Elasticsearch parser
elasticsearch/parser/parser.go - Cosmos DB parser
cosmosdb/parser - Cassandra parser
cassandra/parser
Query analysis
- Doris query spans
doris/analysis/query_span.go - StarRocks query spans
starrocks/analysis/query_span.go - GoogleSQL query spans
googlesql/analysis/query_span.go - Redshift query spans
redshift/analysis/query_span.go - Trino query spans
trino/analysis/query_span.go - Snowflake query spans
snowflake/analysis/query_span.go - Pipeline analysis
mongo/analysis/pipeline.go
Schema tooling
- PostgreSQL catalog
pg/catalog/query.go - MySQL catalog
mysql/catalog/query.go - MariaDB catalog
mariadb/catalog/query.go - Trino catalog
trino/catalog
Other components
- SQL client
Connections 26
- SQL client → PostgreSQL parser: submits SQL
README.md - PostgreSQL parser → PostgreSQL AST: builds AST
README.md - SQL client → MariaDB parser: submits SQL
README.md - SQL client → MySQL parser: submits SQL
README.md - SQL client → Redshift parser: submits SQL
README.md - Redshift parser → Redshift AST: builds AST
README.md - SQL client → T-SQL parser: submits SQL
README.md - SQL client → Oracle parser: submits SQL
README.md - SQL client → Doris parser: submits SQL
README.md - SQL client → StarRocks parser: submits SQL
README.md - SQL client → GoogleSQL parser: submits SQL
README.md - SQL client → MongoDB parser: submits query
README.md - SQL client → Elasticsearch parser: submits request
README.md - SQL client → Cosmos DB parser: submits query
README.md - SQL client → Cassandra parser: submits CQL
README.md - Doris parser → Doris query spans: analyzes AST
- StarRocks parser → StarRocks query spans: analyzes AST
- GoogleSQL parser → GoogleSQL query spans: analyzes AST
- Redshift parser → Redshift query spans: analyzes query
- SQL client → Trino query spans: requests spans
- SQL client → Snowflake query spans: requests spans
- MongoDB parser → Pipeline analysis: analyzes pipeline
mongo/analysis/pipeline.go - SQL client → PostgreSQL catalog: uses schema tools
- SQL client → MySQL catalog: uses schema tools
- SQL client → MariaDB catalog: uses schema tools
- SQL client → Trino catalog: uses schema tools