Thank you for your interest in contributing to sqlglot-rust! This document provides guidelines and instructions for contributing.
-
Fork the repository on GitHub
-
Clone your fork locally:
git clone https://github.com/<your-username>/sql-glot-rust.git cd sql-glot-rust
-
Create a branch for your changes:
git checkout -b my-feature
- Rust (edition 2024)
- Cargo (included with Rust)
cargo buildcargo testBefore submitting a pull request, ensure your code passes all checks:
cargo fmt # Format code
cargo clippy # Run linter
cargo test # Run all testscargo benchTo generate a Software Bill of Materials in SPDX 2.3 JSON format:
cargo install cargo-sbom # one-time setup
make sbomThe output is written to target/sbom/sqlglot-rust.spdx.json.
When releasing a new version, use the Makefile target to keep the version
consistent across Cargo.toml and all documentation:
make bump-version VERSION=1.0.0This updates Cargo.toml, README.md, docs/installation.md, and regenerates
Cargo.lock. Always use a full semantic version (e.g. 1.0.0).
src/ast/— AST node definitionssrc/parser/— SQL tokenizer and parsersrc/generator/— SQL code generation from ASTsrc/dialects/— Dialect-specific parsing and generation rulessrc/optimizer/— Query optimization passessrc/tokens/— Token definitions and tokenizersrc/errors/— Error typestests/— Integration testsbenches/— Benchmarks
- Use
thiserrorfor error types - Use
serdefor AST serialization - Use
#[must_use]on pure functions returning values - Write unit tests alongside modules
- Follow Rust API guidelines
- Commit your changes with a clear, descriptive commit message
- Push your branch to your fork
- Open a pull request against the
masterbranch - Describe your changes and the problem they solve in the PR description
If you find a bug or have a feature request, please open an issue on GitHub with:
- A clear description of the problem or feature
- Steps to reproduce (for bugs)
- Expected vs actual behavior (for bugs)
- SQL examples if applicable
By contributing, you agree that your contributions will be licensed under the MIT License.