Skip to main content

psqlparse-rs

CI PyPI Python Versions License: BSD-3-Clause

A fast, drop-in replacement for sqlparse to tokenize, split, parse, and format SQL in Python — up to 97x faster on statement splitting and 25x faster on lexing.

Install

pip install psqlparse-rs

Prebuilt wheels are included for Linux, macOS, and Windows (Python 3.9+, no Rust toolchain needed).

Usage

import psqlparse

# Split a multi-statement SQL script
statements = psqlparse.split("SELECT 1; SELECT 2;")

# Format SQL with familiar sqlparse options
pretty = psqlparse.format("select a, b from users where id = 1", keyword_case="upper", reindent=True)

# Parse into a statement tree
parsed = psqlparse.parse("SELECT id, name FROM users WHERE active = true")

psqlparse mirrors the sqlparse API (parse, parsestream, split, format, tokens, sql, engine, filters, formatter, exceptions) and accepts str, bytes, bytearray, or file-like streams.

Performance

Measured against sqlparse 0.6.1 (benchmarks/bench.py):

Workload sqlparse (x86-64) psqlparse (x86-64) sqlparse (Apple M4) psqlparse (Apple M4)
split (simple) 266.21 µs 2.74 µs (97.1x) 189.65 µs 2.33 µs (81.5x)
split (200 statements) 24,106.30 µs 314.64 µs (76.6x) 17,675.32 µs 212.17 µs (83.3x)
tokenize (simple) 152.38 µs 6.16 µs (24.8x) 133.18 µs 5.21 µs (25.6x)
tokenize (200 statements) 16,515.92 µs 878.75 µs (18.8x) 13,127.40 µs 761.33 µs (17.2x)
parse (simple) 864.84 µs 361.59 µs (2.4x) 562.30 µs 226.41 µs (2.5x)
format (simple) 1,042.42 µs 540.91 µs (1.9x) 689.53 µs 338.25 µs (2.0x)

Under the hood

  • Written in Rust (PyO3) with zero external runtime dependencies and runtime SIMD dispatch (AVX2 / SSE2 / ARM64 NEON)
  • Compact cp39-abi3 wheel (gil_used = false, free-threaded Python ready) with PEP 561 type stubs (py.typed + .pyi stubs)

License

BSD-3-Clause

Metadata

Release files for psqlparse-rs 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for psqlparse-rs 0.1.0
File Size Uploaded Provenance Actions
psqlparse_rs-0.1.0.tar.gz 62.4 kB With provenance Details for psqlparse_rs-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for psqlparse-rs 0.1.0
File Actions
psqlparse_rs-0.1.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for psqlparse_rs-0.1.0-cp39-abi3-win_amd64.whl
psqlparse_rs-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details for psqlparse_rs-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl
psqlparse_rs-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl CPython 3.9 abi3 Linux musl 1.2+ ARM64 Details for psqlparse_rs-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl
psqlparse_rs-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for psqlparse_rs-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
psqlparse_rs-0.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for psqlparse_rs-0.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
psqlparse_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for psqlparse_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
psqlparse_rs-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for psqlparse_rs-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl

Total release size: 2.3 MB

Release files / psqlparse_rs-0.1.0.tar.gz

Download URL psqlparse_rs-0.1.0.tar.gz
Size 62.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8cc59700759b2fc58914042c0a1fa6c9eba46f07746136c3e8fd189dba662d2c
BLAKE2b-256 checksum
How to use checksums
bed1d8c43264b1cfdbc2f83a40c34b2bc3aadf3191889897d6d8e9f5f0f0f089
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / psqlparse_rs-0.1.0-cp39-abi3-win_amd64.whl

Download URL psqlparse_rs-0.1.0-cp39-abi3-win_amd64.whl
Size 193.1 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
53b4d407b003c56c72e3bce0ef90abd5c66b80d0f428bda54578f07bcb1fe97f
BLAKE2b-256 checksum
How to use checksums
5e654e7a49c3c705d19f22ff0ded39ae21d6eb46e86555943db6e8deee3a4720
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / psqlparse_rs-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL psqlparse_rs-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl
Size 417.7 kB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
75637506f17e106f47849f078cbd382a5373a178738fe1bfe28e084783e5cbc5
BLAKE2b-256 checksum
How to use checksums
781b13e6e82beb98c002c15a7dd2d793297309ba007b537aac98e49ec1176ffd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / psqlparse_rs-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL psqlparse_rs-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl
Size 411.0 kB
Tags CPython 3.9 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
4177d8d2aa49e7f0a751aee0f19d28aaee564ad646859e949293b4d560989d23
BLAKE2b-256 checksum
How to use checksums
837b90cf7387a90730d16d7718aec623f3c88856d2fb5b30a238fe8c3728348f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / psqlparse_rs-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL psqlparse_rs-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 312.9 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
4d7ccbf4a45e8285d1056d0c383e4109950ea747efe2a34371140641f6678b1e
BLAKE2b-256 checksum
How to use checksums
c53f0554c945edb14fb921c0c553feb6f9f80d3790c4f6160383d2c93daee484
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / psqlparse_rs-0.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL psqlparse_rs-0.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 316.3 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
fbdd4f099ccd6d7c72f4acdf3adb148b5a634aae96aa6db9cccd4f3243031a31
BLAKE2b-256 checksum
How to use checksums
2cb83a80e1cc9aeeb34945c7bdb119c7ac85afaa130455145863e31c733162ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / psqlparse_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL psqlparse_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
Size 284.9 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
aeee4496cc35b04903163c23874a84281fdf45234d61f981edc8c25f6d4ff632
BLAKE2b-256 checksum
How to use checksums
d0f50b135211b981140bd31caec1b6350368e30522d6e4696c58cecf5dab8b82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / psqlparse_rs-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL psqlparse_rs-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 290.1 kB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
3887de79bb1d8c317a42eebd3070b836ad83b99a168bac6ef866d5cc1a97e343
BLAKE2b-256 checksum
How to use checksums
00635a34a573915ee54329213998f52ea3f768b4051d53731fbdff05049828d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for psqlparse-rs 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 8 files in this release have been uploaded with provenance metadata.

Select from 8 files

Attestation for psqlparse_rs-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

8 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page