Builds PostgreSQL queries for execution in more useful Pythonic way. Not ORM.
>>> from pssq import Q
>>> Q.select().from_("foo").where(a=5).end()
('SELECT * from "foo" where "a"=$1', (5,))
>>> Q.insert("foo").set(a=5, b=7).end()
('INSERT INTO "foo" ("a", "b") VALUES ($1, $2)', (5, 7))
>>> Q.insert("foo").set(q=Q.unsafe("4"), w=Q.unsafe("now()"), a=5).end()
('INSERT INTO "foo" ("q", "w", "a") VALUES (4, now(), $1)', (5,))
Install
pip3 install pssq
Motivation
Originally written for asyncpg service without ORM. Because writing bind variables for raw PostgreSQL is hard.
Tests
pip3 install pytest
PYTHONPATH=src py.test -s tests
Release files for pssq 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pssq-0.0.2.tar.gz | 3.3 kB | Details |
Release files / pssq-0.0.2.tar.gz
| Download URL | pssq-0.0.2.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c20e8613a26ca72bf110d5359e12b5e9b0cd772524a436c1eedf6e09315998e
|
|
BLAKE2b-256 checksum How to use checksums |
b1a5cc115302b49094aae53d938324feb3438ac4806bef084742f2ae094f6e22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.4
|