Skip to main content

Meta-commands for Postgres

Build Status Latest Version

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)

Source distribution for pgspecial 2.2.1
File Size Uploaded
pgspecial-2.2.1.tar.gz 50.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pgspecial 2.2.1
File Interpreter ABI Platform
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 log

Release 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

Release history Release notifications | RSS feed

This release

2.2.1 This release

2 release files

2.2.0

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.13.1

2 release files

1.13.0

2 release files

1.12.1

2 release files

1.12.0

2 release files

1.11.9

1 release file

1.11.8

1 release file

1.11.7

1 release file

1.11.6

1 release file

1.11.5

1 release file

1.11.4

1 release file

1.11.3

1 release file

1.11.2

1 release file

1.11.1

1 release file

1.11.0

1 release file

1.10.0

1 release file

1.9.0

1 release file

1.8.0

1 release file

1.7.0

1 release file

1.6.0

1 release file

1.5.0

1 release file

1.4.0

1 release file

1.3.0

1 release file

1.2.0

1 release file

1.1.0

1 release file

1.0.0

1 release file

0.0.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page