sql-smith
sql-smith is an SQL query builder with zero dependencies and a fluent interface.
The sentence above is, beside the name, a copy from the website of the PHP library Latitude, for the simple reason that this Python module is a port of Latitude.
Read the full documentation.
Installation
$ pip install sql-smith
Quick Start
QueryFactory is a factory to create a SELECT, INSERT, UPDATE or DELETE query. Use the fluent interface of the queries to complete the query.
from sql_smith import QueryFactory
from sql_smith.engine import CommonEngine
from sql_smith.functions import field
factory = QueryFactory(CommonEngine())
query = factory \
.select('id', 'username') \
.from_('users') \
.where(field('id').eq(5)) \
.compile()
print(query.sql) # SELECT "id", "username" FROM "users" WHERE "id" = ?
print(query.params) # (5)
When the query is ready, compile it. The return value of compile is a Query class instance with two properties: sql and params. Use these properties to pass the query to a database.
import sqlite3
db = sqlite3.connect('test.db')
cur = db.cursor()
for row in cur.execute(query.sql, query.params):
print(row)
Metadata
Release files for sql-smith 1.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sql_smith-1.1.3.tar.gz | 12.0 kB | Without provenance | Details for sql_smith-1.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sql_smith-1.1.3-py3-none-any.whl | Python 3 | none | any | Details for sql_smith-1.1.3-py3-none-any.whl |
Total release size: 43.9 kB
Release files / sql_smith-1.1.3.tar.gz
| Download URL | sql_smith-1.1.3.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f81fe28ab9958da359fb59385d0ee13197417a12b2f9f7cb648898274b570bc3
|
|
BLAKE2b-256 checksum How to use checksums |
ba221a1ead673a7b23cfb8c6db73f209f6ffbbeb4f0ac88c16ea404b9d9f24c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.5
|
Release files / sql_smith-1.1.3-py3-none-any.whl
| Download URL | sql_smith-1.1.3-py3-none-any.whl |
|---|---|
| Size | 31.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cebda0e31e9219006cd86aeefeb70c6b7bd75d4c9759262f275391bf4206cc09
|
|
BLAKE2b-256 checksum How to use checksums |
ba1325fb523a7e78d5f2366f86ed5d21e4b8684c77392632d1a12230569072c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.5
|
Security for sql-smith 1.1.3
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.