XRay is an open-source Go library and CLI tool for database schema extraction and query execution. It supports multiple databases and provides a unified interface for developers and data engineers.
- Extracts schema metadata from popular databases.
- Executes SQL queries across different engines.
- Unified API for multiple backends.
- Easy integration into Go projects.
- CLI for quick inspection and automation.
go get github.com/yindia/xray@latest
brew install yindia/homebrew-tap/xray
curl -sL https://raw.githubusercontent.com/yindia/xray/main/install.sh | sudo bash -s -- -b /usr/local/bin
package main
import (
"github.com/yindia/xray"
"github.com/yindia/xray/config"
)
func main() {
cfg := config.Config{
// Fill in your database config here
}
client, err := xray.NewClient(cfg)
if err != nil {
panic(err)
}
schema, err := client.ExtractSchema()
if err != nil {
panic(err)
}
// Use schema metadata
fmt.Println(schema)
}
See example/{database}/main.go for full working examples for each supported database.
- MySQL
- PostgreSQL
- Redshift
- BigQuery
- Snowflake
- MSSQL
- MySQL Integration
- Postgres Integration
- Redshift Integration
- BigQuery Integration
- Snowflake Integration
- MSSQL Integration
See CLI Getting Started for full documentation.
Contributions are welcome! Please open issues or pull requests.
If you find XRay useful, please consider starring the repository on GitHub!