pgspecial

Meta-commands handler for Postgres Database.

BSD 35 个版本 Python >=3.9
安装
pip install pgspecial
poetry add pgspecial
pipenv install pgspecial
conda install pgspecial
描述

Meta-commands for Postgres

|Build Status| |PyPI|

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:

.. code-block:: python

from pgspecial.main import PGSpecial
from pgspecial.namedqueries import NamedQueries

Then you will create and use an instance of PGSpecial:

.. code-block:: python

    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:

.. code-block:: python

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.

.. |Build Status| image:: https://github.com/dbcli/pgspecial/workflows/pgspecial/badge.svg :target: https://github.com/dbcli/pgspecial/actions?query=workflow%3Apgspecial

.. |PyPI| image:: https://badge.fury.io/py/pgspecial.svg :target: https://pypi.python.org/pypi/pgspecial/ :alt: Latest Version

.. _pgcli: https://github.com/dbcli/pgcli .. _ipython-sql: https://github.com/catherinedevlin/ipython-sql .. _OmniDB: https://github.com/OmniDB/OmniDB

版本列表
2.2.1 2025-04-28
2.2.0 2025-04-27
2.1.3 2024-11-26
2.1.2 2024-05-15
2.1.1 2023-10-29
2.1.0 2023-03-31
2.0.1 2022-06-17
2.0.0 2022-06-03
1.13.1 2022-02-28
1.13.0 2021-05-21
1.12.1 2021-02-13
1.12.0 2021-02-12
1.11.10 2020-04-24
1.11.9 2019-12-09
1.11.8 2019-12-03
1.11.7 2019-09-02
1.11.6 2019-08-30
1.11.5 2018-12-15
1.11.4 2018-11-27
1.11.3 2018-11-19
1.11.2 2018-07-27
1.11.1 2018-07-26
1.11.0 2018-05-21
1.10.0 2018-03-02
1.9.0 2017-10-27
1.8.0 2017-05-06
1.7.0 2016-12-20
1.6.0 2016-08-12
1.5.0 2016-07-01
1.4.0 2016-06-21
1.3.0 2016-03-24
1.2.0 2015-10-25
1.1.0 2015-09-25
1.0.0 2015-09-23