$npx skillfedfor your agent

python-sql

Library to write SQL queries

Worth itPyPI Python ModulesReleased Apr 2026106.0K downloads / moBSD-3-ClausePure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — python_sql-1.8.1-py3-none-any.whl
v1.8.1 · released 2026-04-03 · Python >=3.9

Yes. python-sql is a lightweight, dependency-free query builder suitable for projects that need programmatic SQL construction without a full ORM. It's actively maintained, production-stable, has no known vulnerabilities, and works with Python 3.9+. Install it if you're building dynamic queries and want type-safe, injection-proof SQL generation; skip it if you prefer raw SQL strings or a heavier ORM like SQLAlchemy.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.9 or later.
  • Low friction: pure Python wheel with no runtime dependencies.
  • Actively maintained with a release 133 days ago and production-stable status.

License · maintenance · safety

BSD-3-Clause (permissive) — BSD-3-Clause permissive license allows commercial and private use with minimal restrictions; attribution required.

last release 2026-04-03 (133 days)

0 known vulnerabilities (OSV.dev, 2026-08-14) · 106,014 downloads/mo, #12,672 on PyPI

Verify before relying

pip install python-sql

from sql import *
user = Table('user')
select = user.select(user.name)
query_string, params = tuple(select)
# ('SELECT "a"."name" FROM "user" AS "a"', ())
  • Whether the package supports all major SQL dialects or only a subset (Flavor configuration hints dialect support but specifics are unclear).
  • Performance characteristics when building very large or deeply nested queries.
  • Integration patterns with specific database drivers (psycopg2, mysql-connector, etc.) beyond parameter tuple generation.
Same gist for agents: .md · .json

What it is and what it does

python-sql is a query builder that lets you write SQL statements as Python objects instead of raw strings. You define tables, columns, and conditions using Python syntax—like `user.select(user.name)` or `user.where(user.active == True)`—and the library generates parameterized SQL and a tuple of bind parameters. This approach prevents SQL injection by separating query structure from values, and makes complex queries (joins, subselects, aggregations, updates, deletes) easier to construct and read.

The library supports SELECT, INSERT, UPDATE, and DELETE operations, with features like joins, GROUP BY, ORDER BY, aggregates, and subqueries. It also provides a Flavor system to adapt output to different SQL dialects (limit/offset styles, parameter markers like `?` or `:0`). With no external dependencies and pure Python implementation, it integrates easily into any project that needs to build queries dynamically without an ORM.

Use it for

  • Build SELECT queries with WHERE, JOIN, GROUP BY, and ORDER BY clauses programmatically without string concatenation.
  • Generate INSERT, UPDATE, and DELETE statements with parameterized values to prevent SQL injection.
  • Construct complex subqueries and nested conditions using Python operators and method chaining.
  • Adapt query output to different SQL dialects (PostgreSQL, MySQL, Oracle, SQLite) via Flavor configuration.
  • Generate parameterized queries for use with database drivers that require separate query strings and parameter tuples.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

python-sql is a lightweight, dependency-free query builder suitable for projects that need programmatic SQL construction without a full ORM. It's actively maintained, production-stable, has no known vulnerabilities, and works with Python 3.9+. Install it if you're building dynamic queries and want type-safe, injection-proof SQL generation; skip it if you prefer raw SQL strings or a heavier ORM like SQLAlchemy.

Install

python-sql on PyPI

Before you install

Low friction: pure Python wheel with no runtime dependencies. Actively maintained with a release 133 days ago and production-stable status.

Requires Python 3.9 or later.

License in practice

BSD-3-Clause permissive license allows commercial and private use with minimal restrictions; attribution required.

Quickstart

pip install python-sql

from sql import *
user = Table('user')
select = user.select(user.name)
query_string, params = tuple(select)
# ('SELECT "a"."name" FROM "user" AS "a"', ())

Verify before relying

  • Whether the package supports all major SQL dialects or only a subset (Flavor configuration hints dialect support but specifics are unclear).
  • Performance characteristics when building very large or deeply nested queries.
  • Integration patterns with specific database drivers (psycopg2, mysql-connector, etc.) beyond parameter tuple generation.

Package facts

LicenseBSD-3-Clause permissive
Python supportSupports the current Python release >=3.9
Install frictionLow. Pure-Python wheel
Runtime dependenciesNone
MaintenanceActively maintained 133 days since the last release
First released
Downloads106,014 / month, #12,672 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableIntended Audience :: DevelopersTopic :: DatabaseTopic :: Software Development :: Libraries :: Python Modules

Evidence: python_sql-1.8.1-py3-none-any.whl

Tags

Capabilities
SQL query builder pythonprogrammatic SQL generationparameterized query constructionpython sql abstractiondynamic query buildingSQL DSL for pythonsafe sql parameter binding
Topics
query-buildersql-generationinjection-safe
PyPI keywords
SQLdatabasequery

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “parameterized query construction”

  • python-sqlConstructs SQL queries programmatically using Python syntax instead…
  • pypika-tortoiseGenerates SQL queries programmatically for Tortoise ORM, providing a…
  • scim2-filter-parserParses SCIM 2.0 filter query strings into abstract syntax trees and…

Give your agent the search over MCP, or paste the wish link into any chat.

More Python Modules packages

idna Worth it
PyPI · Python Modules · released Jun 2026

Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.

Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.

BSD-3-Clausepure Python · 3.9+
1.8Bdownloads / mo
setuptools Worth it
PyPI · Python Modules · released Aug 2026

Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.

MITpure Python · 3.10+
1.6Bdownloads / mo
PyYAML Worth it
PyPI · Python Modules · released Sep 2025

PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.

MITcompiled wheel · 3.8+
1.2Bdownloads / mo
pydantic Worth it
PyPI · Python Modules · released May 2026

Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.

MITpure Python · 3.9+
1.1Bdownloads / mo
annotated-types Worth it
PyPI · Python Modules · released Jul 2026

Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.

Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…

MITpure Python · 3.10+
871.3Mdownloads / mo
typing-inspection Worth it
PyPI · Python Modules · released Aug 2026

Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.

MITpure Python · 3.10+
783.0Mdownloads / mo

See also databricks-sql · sqlparams · gw-dsl-parser · SQLAlchemy · django-query-builder · jinjasql2 · sql-metadata · ipython-sql · sqladmin · jinjasql