Skip to main content

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pssq-0.0.2.tar.gz (3.3 kB view details)

Uploaded Source

File details

Details for the file pssq-0.0.2.tar.gz.

File metadata

  • Download URL: pssq-0.0.2.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for pssq-0.0.2.tar.gz
Algorithm Hash digest
SHA256 5c20e8613a26ca72bf110d5359e12b5e9b0cd772524a436c1eedf6e09315998e
MD5 f2d2e7babacf9cfa12418912c5a1418c
BLAKE2b-256 b1a5cc115302b49094aae53d938324feb3438ac4806bef084742f2ae094f6e22

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 file

0.0.1

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page