skillfed

sqlvalidator

SQL queries formatting, syntactic and semantic validation

sqlvalidator v0.0.20 162.1K downloads/30d#10,615 on PyPI74
Permissive license MIT DORMANT released

What it is and what it does

sqlvalidator is a Python tool for formatting and validating SQL SELECT statements. It offers both a command-line interface and a Python API to reformat SQL code to a consistent style, check whether files conform to that style (useful in CI/CD), and validate SELECT queries for semantic correctness—such as detecting missing columns, invalid function calls, and type mismatches in expressions. The validation is schemaless, meaning it does not require a live database connection or schema definition.

The package has no runtime dependencies and installs easily, but it is in Alpha and has been dormant since its latest release. It only handles SELECT statements; INSERT, UPDATE, DELETE, and other SQL operations are out of scope. The author has stated they want to retain full control over the project direction and do not guarantee acceptance of pull requests, so community-driven improvements are unlikely.

Use it for:

  • Enforce consistent SQL formatting in Python codebases that embed SQL strings, using the CLI in pre-commit hooks or CI pipelines.
  • Catch common SQL errors (missing columns, invalid aggregations, type mismatches) in SELECT queries without needing a live database.
  • Reformat ad-hoc or poorly formatted SQL strings in Python code to a standard style for readability.
  • Validate SQL queries in data-processing scripts or ETL tools before execution.
  • Integrate SQL validation into linting workflows for projects that generate or manipulate SELECT statements programmatically.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Formats, validates, and checks SQL SELECT statements for syntactic and semantic correctness, with command-line and Python API interfaces.

Yes, if you need lightweight SELECT-only SQL formatting and basic semantic validation in a Python project and can accept that the package is dormant. No, if you need support for INSERT/UPDATE/DELETE, expect regular maintenance, or require validation of complex or dialect-specific SQL. The low install friction and permissive license make it low-risk to try, but the Alpha status and dormant maintenance mean you should not rely on it for critical workflows.

Install

sqlvalidator on PyPI

pip

pip install sqlvalidator

uv

uv add sqlvalidator

poetry

poetry add sqlvalidator

Installing sqlvalidator

Before you install

Low install friction with no runtime dependencies. Maintenance is dormant—last release was 2022-12-25 and last commit 2024-03-14. The project is marked Alpha and the author explicitly reserves control over contributions, so expect limited updates.

License in practice

MIT license permits unrestricted use, modification, and distribution with minimal obligations—suitable for both open-source and proprietary projects.

Quickstart

pip install sqlvalidator

import sqlvalidator

formatted = sqlvalidator.format_sql("SELECT * FROM table")
sql_query = sqlvalidator.parse("SELECT col FROM table")
if not sql_query.is_valid():
    print(sql_query.errors)

Only SELECT statements are supported; INSERT, UPDATE, DELETE, and other statement types will not parse or validate.

Verify before relying

  • Whether validation rules (missing columns, function existence, aggregation correctness) work reliably on complex queries or only simple cases.
  • How well the formatter handles edge cases, dialect-specific syntax, or non-standard SQL extensions.
  • Whether the package will receive bug fixes or security updates given the dormant maintenance status.

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance dormant — 1,328 days since the last release
Last repo commit
First released
Downloads 162,127/month — #10,615 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: sqlvalidator-0.0.20-py3-none-any.whl

Keywords: python, sql, format, formatter, formatting, validation, validator, validate, automation

Development Status :: 3 - AlphaIntended Audience :: DevelopersProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

sql formattersql validatorsql syntax checkerformat sql queriesvalidate sql statementssql lintersql code style
sql-formattingquery-validationpre-commit-hook

More Quality Assurance packages