Registry / database / python-sql

python-sql

JSON →
library1.8.1pypypi✓ verified 86d ago

A library to write SQL queries in pure Python, version 1.8.1, released on 2025-01-08. Maintained by Andereoo, with a stable release cadence (last few releases monthly).

pip install python-sql
INSTALL
IMPORT
SIG · PYTHON-SQL
P
python-sql
databasepythonv1.8.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Table
from sql import Table
Standard import for table definition
Select
from sql import Select
from sqlalchemy import select
This is the python-sql library, not SQLAlchemy

Basic usage: create a Table and run a SELECT query.

from sql import Table, Select, Column table = Table('users') query = Select([Column('id'), Column('name')], from_obj=table) print(str(query)) # Output: SELECT "id", "name" FROM "users"
Debug
Known issues
gotchaDo not confuse python-sql with SQLAlchemy's `sql` module. python-sql is a standalone SQL string builder, not an ORM.
fix
Use `from sql import Select` only after installing python-sql, not for SQLAlchemy.
affects: all
gotchapython-sql does not connect to databases or execute queries; it only generates SQL strings.
fix
Use with a DB driver (e.g., psycopg2) to execute the generated SQL.
affects: all
deprecatedThe `SQL` class (plural) was renamed to `Query` in version 1.5.0. Importing `SQL` now raises a deprecation warning.
fix
Use `from sql import Query` instead of `from sql import SQL`.
affects: >=1.5.0
Errors
Common errors & fixes
ImportError: cannot import name 'Select' from 'sql'
Another library (like SQLAlchemy) shadows the `sql` module, or python-sql is not installed.
fix
Ensure python-sql is installed (`pip install python-sql`) and no other package named `sql` is in your environment.
AttributeError: module 'sql' has no attribute 'Table'
The `sql` module is likely from another package (e.g., SQLAlchemy's `from sqlalchemy import sql`).
fix
Install python-sql and import correctly: `from sql import Table`.
Upgrade
Version history
1.8.1latest on PyPI · released Apr 3, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
6
Amazon
2
Resources

No resource links recorded.

python-sql — pip install python-sql · libregistry