trino-sql-validator
Fast Trino SQL syntax validator — a Python library whose core is written in Rust and compiled to a native extension via PyO3 + maturin.
Installable from PyPI:
pip install trino-sql-validator
Quickstart
from trino_sql_validator import validate, validate_file
# A string with one or many statements
result = validate("SELECT 1; SELECT * FROM t WHERE a > 0;")
assert result.valid
assert result.statement_count == 2
# Invalid SQL returns a value, never raises
result = validate("SELECT * FORM t")
assert not result.valid
print(result.error) # e.g. "Expected: end of statement, found: FORM at line 1, column 10"
print(result.error.line) # 1
# Validate a file
result = validate_file("queries.sql", dialect="trino")
Invalid SQL (and files containing it) is returned as a ValidationResult;
it is not raised as an exception. Only genuine misuse (unknown dialect,
unreadable file) raises.
Dialects
"trino"(default) — Trino-flavored with a custom override tuned for Presto/Trino syntax (LIMIT ALL, backslash escapes, etc.)."hive"and"generic"— offered as permissive alternates.
Known limitations
sqlparser-rs (the parser we use) performs syntax validation, not semantic
analysis. It may accept SQL that Trino would reject at analysis time (unknown
columns/tables, duplicate columns), and it can reject exotic Trino-specific DDL.
For the overwhelming majority of SELECT/DDL statements the results are accurate.
See plan/roadmap.md for the path toward stricter Trino fidelity.
Development
See AGENTS.md for setup, internal conventions, and release steps.
Key commands:
python3 -m venv .venv && source .venv/bin/activate
pip install -U pip maturin && pip install -e ".[dev]"
maturin develop # build + install native ext into the venv
cargo test # Rust tests
pytest -q # Python tests
cargo fmt --check # formatting
cargo clippy --all-targets -- -D warnings
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file trino_sql_validator-0.1.0.tar.gz.
File metadata
- Download URL: trino_sql_validator-0.1.0.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc390b5d2d5699be1494ab32391505c2b4238a021fba78bf1586b6f4b687960b
|
|
| MD5 |
8f386b53ad89eeebaa3a9bdcfd5294a0
|
|
| BLAKE2b-256 |
ddf6b4e842896b079e3aee94e54401451fb33abb764fc72ef53fe5f3491f0ccf
|
Provenance
The following attestation bundles were made for trino_sql_validator-0.1.0.tar.gz:
Publisher:
release.yml on ivanshamaev/trino-sql-validator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trino_sql_validator-0.1.0.tar.gz -
Subject digest:
bc390b5d2d5699be1494ab32391505c2b4238a021fba78bf1586b6f4b687960b - Sigstore transparency entry: 2742782444
- Sigstore integration time:
-
Permalink:
ivanshamaev/trino-sql-validator@6335661e4b5f9bc865326b5530c3cbef14308cee -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ivanshamaev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6335661e4b5f9bc865326b5530c3cbef14308cee -
Trigger Event:
push
-
Statement type:
File details
Details for the file trino_sql_validator-0.1.0-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: trino_sql_validator-0.1.0-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
320471ba7006e789acfd25109aff328ae65ef5565375416b1efd6632fa6f269d
|
|
| MD5 |
75b08a50e17a668c7ffc04f419d73ab2
|
|
| BLAKE2b-256 |
96634ac312050450d60baf0f8699308289da6ffcff138ca0d34544e19adf03f7
|
Provenance
The following attestation bundles were made for trino_sql_validator-0.1.0-cp310-abi3-win_amd64.whl:
Publisher:
release.yml on ivanshamaev/trino-sql-validator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trino_sql_validator-0.1.0-cp310-abi3-win_amd64.whl -
Subject digest:
320471ba7006e789acfd25109aff328ae65ef5565375416b1efd6632fa6f269d - Sigstore transparency entry: 2742782487
- Sigstore integration time:
-
Permalink:
ivanshamaev/trino-sql-validator@6335661e4b5f9bc865326b5530c3cbef14308cee -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ivanshamaev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6335661e4b5f9bc865326b5530c3cbef14308cee -
Trigger Event:
push
-
Statement type:
File details
Details for the file trino_sql_validator-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: trino_sql_validator-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bed3448db5b798ce6e7ad1e8d46be10ed1be74a3d3e96ca56a8ee9b00f07714
|
|
| MD5 |
ba1a2aab4b06722b991beb9560a53e3e
|
|
| BLAKE2b-256 |
317b873a8e3e4d43f932a295e468ad49e1ea2ca323ca5f9d1c144c109aba0dc6
|
Provenance
The following attestation bundles were made for trino_sql_validator-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on ivanshamaev/trino-sql-validator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trino_sql_validator-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
5bed3448db5b798ce6e7ad1e8d46be10ed1be74a3d3e96ca56a8ee9b00f07714 - Sigstore transparency entry: 2742782565
- Sigstore integration time:
-
Permalink:
ivanshamaev/trino-sql-validator@6335661e4b5f9bc865326b5530c3cbef14308cee -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ivanshamaev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6335661e4b5f9bc865326b5530c3cbef14308cee -
Trigger Event:
push
-
Statement type:
File details
Details for the file trino_sql_validator-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: trino_sql_validator-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c5ec7a203003a2d4c9316ff4f33cdb9f6654c1118d177d7bf6e1273585e1d43
|
|
| MD5 |
fba8a024e2d5338c6732304676471f0f
|
|
| BLAKE2b-256 |
21081c737004c403edb27fe2350df5f9e0bf16091efdb3853f0b2bf1cbd8729d
|
Provenance
The following attestation bundles were made for trino_sql_validator-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release.yml on ivanshamaev/trino-sql-validator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trino_sql_validator-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
2c5ec7a203003a2d4c9316ff4f33cdb9f6654c1118d177d7bf6e1273585e1d43 - Sigstore transparency entry: 2742782505
- Sigstore integration time:
-
Permalink:
ivanshamaev/trino-sql-validator@6335661e4b5f9bc865326b5530c3cbef14308cee -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ivanshamaev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6335661e4b5f9bc865326b5530c3cbef14308cee -
Trigger Event:
push
-
Statement type:
File details
Details for the file trino_sql_validator-0.1.0-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: trino_sql_validator-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56b330bae1f69f8ff47762685aa3d2e77c6db05ff2396ae6c368940e5f1cfbde
|
|
| MD5 |
6fb5ff4f8ae63b6642e5ee7a2698a8d0
|
|
| BLAKE2b-256 |
b59226844827f4e711a6da474b999168cdd49a990190c9bd156395a11dff4d1a
|
Provenance
The following attestation bundles were made for trino_sql_validator-0.1.0-cp310-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on ivanshamaev/trino-sql-validator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trino_sql_validator-0.1.0-cp310-abi3-macosx_11_0_arm64.whl -
Subject digest:
56b330bae1f69f8ff47762685aa3d2e77c6db05ff2396ae6c368940e5f1cfbde - Sigstore transparency entry: 2742782622
- Sigstore integration time:
-
Permalink:
ivanshamaev/trino-sql-validator@6335661e4b5f9bc865326b5530c3cbef14308cee -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ivanshamaev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6335661e4b5f9bc865326b5530c3cbef14308cee -
Trigger Event:
push
-
Statement type:
File details
Details for the file trino_sql_validator-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: trino_sql_validator-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.10+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
663e8e94d2c0304afdfb37d5a2403f3bc75ecfff7ed7f42903a5f9d27ef32eda
|
|
| MD5 |
931e72a0b55a011e869089d3e55418ef
|
|
| BLAKE2b-256 |
f2bf3c310a1ff2f9de96f25b00451e81c1496108b92ca7bdec0503d60b05ae31
|
Provenance
The following attestation bundles were made for trino_sql_validator-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl:
Publisher:
release.yml on ivanshamaev/trino-sql-validator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trino_sql_validator-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl -
Subject digest:
663e8e94d2c0304afdfb37d5a2403f3bc75ecfff7ed7f42903a5f9d27ef32eda - Sigstore transparency entry: 2742782526
- Sigstore integration time:
-
Permalink:
ivanshamaev/trino-sql-validator@6335661e4b5f9bc865326b5530c3cbef14308cee -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ivanshamaev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6335661e4b5f9bc865326b5530c3cbef14308cee -
Trigger Event:
push
-
Statement type: