Meta-commands for Postgres
This package provides an API to execute meta-commands (AKA “special”, or “backslash commands”) on PostgreSQL.
Quick Start
This is a python package. It can be installed with:
$ pip install pgspecial
Usage
Once this library is included into your project, you will most likely use the following imports:
from pgspecial.main import PGSpecial
from pgspecial.namedqueries import NamedQueries
Then you will create and use an instance of PGSpecial:
pgspecial = PGSpecial()
for result in pgspecial.execute(cur, sql):
# Do something
If you want to import named queries from an existing config file, it is convenient to initialize and keep around the class variable in NamedQueries:
from configobj import ConfigObj
NamedQueries.instance = NamedQueries.from_config(
ConfigObj('~/.config_file_name'))
Contributions:
If you’re interested in contributing to this project, first of all I would like to extend my heartfelt gratitude. I’ve written a small doc to describe how to get this running in a development setup.
https://github.com/dbcli/pgspecial/blob/master/DEVELOP.rst
Please feel free to file an issue if you need help.
Projects using it:
This library is used by the following projects:
pgcli: A REPL for Postgres.
ipython-sql: %%sql magic for IPython
OmniDB: An web tool for database management
If you find this module useful and include it in your project, I’ll be happy to know about it and list it here.
Metadata
Release files for pgspecial 2.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pgspecial-2.2.1.tar.gz | 50.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pgspecial-2.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 86.1 kB
Release files / pgspecial-2.2.1.tar.gz
| Download URL | pgspecial-2.2.1.tar.gz |
|---|---|
| Size | 50.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da6c7fcc7bef7bb0132dc2046f74ec6513b1fe6f0c80e5528d630d14b7c4849d
|
|
BLAKE2b-256 checksum How to use checksums |
12b3f342d6a9ec37fddff8c30b4f6eb5e83990f5d33135cecf381d3f7a0c1c9c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 28, 2025.
Transparency logRelease files / pgspecial-2.2.1-py3-none-any.whl
| Download URL | pgspecial-2.2.1-py3-none-any.whl |
|---|---|
| Size | 35.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
08d86faaf360603a25850e259efc083bded4c1e8ffd2cfe2950b8ceefdfb4c9c
|
|
BLAKE2b-256 checksum How to use checksums |
849f151c714d38f893d31688c9454646a078a8d884d9d8d39e3b281178f4d8b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 28, 2025.
Transparency log