Open
Conversation
Implements feature-gated Python interop layer that exposes pgrsql's SQL parsing, optimization, analysis, and EXPLAIN plan parsing to Python. The bindings are compiled only when the `python` feature flag is enabled, keeping the core Rust crate unaffected. Key additions: - src/python.rs: PyO3 module with parse_sql, format_sql, analyze_query, parse_explain, and is_explain_query functions - pyproject.toml: maturin build configuration for wheel distribution - python/pgrsql/__init__.py: Python package wrapper for clean imports - src/lib.rs: Library crate exposing all modules publicly - Feature-gated with `python = ["pyo3"]` in Cargo.toml Build: `maturin develop` for local dev, `maturin build --release` for wheels Install: `pip install pgrsql` (once published) Closes #45 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add #[allow(ambiguous_glob_reexports)] for conflicting SQL_FUNCTIONS re-exports - Add Default impl for ConnectionManager and App (new_without_default) - Add #[allow(clippy::should_implement_trait)] for QueryHistory::next() - Run cargo fmt for consistent formatting Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Run cargo fmt for consistent code formatting in python.rs and main.rs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements an optional Python interoperability layer for pgrsql using PyO3 and maturin, enabling SQL parsing, optimization, and analysis from Python.
--features python, keeping the core Rust crate unaffectedsrc/python.rs): 5 Python-callable functions exposing the Rust SQL enginepyproject.toml): Build wheels for macOS, Linux, and Windows withmaturin build --releasepython/pgrsql/__init__.py): Cleanimport pgrsqlinterface with re-exportssrc/lib.rs): Exposes all modules publicly for external consumptionPython API
Building
Files Changed
src/python.rssrc/lib.rssrc/main.rspgrsql::pathsCargo.tomlpyo3optional dep,[features],[lib]sectionpyproject.tomlpython/pgrsql/__init__.pyTest plan
cargo buildpassescargo test— all 225 tests passmaturin developbuilds wheel andimport pgrsqlworksCloses #45
🤖 Generated with Claude Code