2014-10-13 02:19:34 +04:00
|
|
|
A REPL for Postgres
|
|
|
|
-------------------
|
|
|
|
|
2015-01-30 09:49:23 +03:00
|
|
|
|Build Status| |PyPI| |Gitter|
|
2015-01-05 10:34:31 +03:00
|
|
|
|
2014-10-13 02:19:34 +04:00
|
|
|
This is a postgres client that does auto-completion and syntax highlighting.
|
2014-10-13 02:17:39 +04:00
|
|
|
|
2015-07-24 18:51:22 +03:00
|
|
|
Home Page: http://pgcli.com
|
|
|
|
|
2015-04-11 19:26:09 +03:00
|
|
|
MySQL Equivalent: http://mysql-cli.com
|
|
|
|
|
2015-07-24 02:19:14 +03:00
|
|
|
.. image:: screenshots/pgcli.gif
|
2014-12-01 09:02:04 +03:00
|
|
|
.. image:: screenshots/image01.png
|
2014-10-13 02:17:39 +04:00
|
|
|
|
2014-12-01 09:27:18 +03:00
|
|
|
Quick Start
|
|
|
|
-----------
|
|
|
|
|
2015-01-07 04:15:45 +03:00
|
|
|
If you already know how to install python packages, then you can simply do:
|
2014-12-01 09:27:18 +03:00
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
$ pip install pgcli
|
2014-10-13 02:17:39 +04:00
|
|
|
|
2015-01-14 09:25:03 +03:00
|
|
|
or
|
|
|
|
|
|
|
|
$ brew install pgcli # Only on OS X
|
|
|
|
|
2015-01-08 01:20:53 +03:00
|
|
|
If you don't know how to install python packages, please check the
|
2014-12-19 09:32:47 +03:00
|
|
|
`detailed instructions`__.
|
2014-12-01 09:02:04 +03:00
|
|
|
|
2015-04-19 08:54:58 +03:00
|
|
|
__ https://github.com/dbcli/pgcli#detailed-installation-instructions
|
2014-12-01 09:02:04 +03:00
|
|
|
|
2014-12-01 09:27:18 +03:00
|
|
|
Usage
|
|
|
|
-----
|
2014-12-01 09:02:04 +03:00
|
|
|
|
2014-12-01 09:27:18 +03:00
|
|
|
::
|
2014-10-13 02:17:39 +04:00
|
|
|
|
2014-12-01 09:27:18 +03:00
|
|
|
$ pgcli [database_name]
|
|
|
|
|
|
|
|
or
|
|
|
|
|
|
|
|
$ pgcli postgresql://[user[:password]@][netloc][:port][/dbname]
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
$ pgcli local_database
|
|
|
|
|
|
|
|
$ pgcli postgres://amjith:pa$$w0rd@example.com:5432/app_db
|
|
|
|
|
|
|
|
Features
|
|
|
|
--------
|
|
|
|
|
|
|
|
The `pgcli` is written using prompt_toolkit_.
|
|
|
|
|
|
|
|
* Auto-completion as you type for SQL keywords as well as tables and
|
|
|
|
columns in the database.
|
|
|
|
* Syntax highlighting using Pygments.
|
2014-12-19 09:32:47 +03:00
|
|
|
* Smart-completion (enabled by default) will suggest context-sensitive
|
|
|
|
completion.
|
2014-12-01 09:27:18 +03:00
|
|
|
|
2015-01-08 20:26:39 +03:00
|
|
|
- ``SELECT * FROM <tab>`` will only show table names.
|
|
|
|
- ``SELECT * FROM users WHERE <tab>`` will only show column names.
|
2014-12-01 09:02:04 +03:00
|
|
|
|
2015-01-10 04:06:33 +03:00
|
|
|
* Config file is automatically created at ``~/.pgclirc`` at first launch.
|
2015-01-08 20:26:39 +03:00
|
|
|
* Primitive support for ``psql`` back-slash commands.
|
2015-01-07 12:57:46 +03:00
|
|
|
* Pretty prints tabular data.
|
2014-12-01 09:27:18 +03:00
|
|
|
|
|
|
|
.. _prompt_toolkit: https://github.com/jonathanslenders/python-prompt-toolkit
|
2014-12-01 09:02:04 +03:00
|
|
|
|
2014-12-19 11:32:26 +03:00
|
|
|
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.
|
|
|
|
|
2015-04-19 08:54:58 +03:00
|
|
|
https://github.com/dbcli/pgcli/blob/master/DEVELOP.rst
|
2014-12-19 11:32:26 +03:00
|
|
|
|
|
|
|
Please feel free to reach out to me if you need help.
|
|
|
|
My email: amjith.r@gmail.com, Twitter: `@amjithr <http://twitter.com/amjithr>`_
|
|
|
|
|
2014-12-01 09:02:04 +03:00
|
|
|
Detailed Installation Instructions:
|
2014-12-01 09:27:18 +03:00
|
|
|
-----------------------------------
|
2014-12-01 09:02:04 +03:00
|
|
|
|
|
|
|
OS X:
|
2014-12-01 09:27:18 +03:00
|
|
|
=====
|
2014-12-01 09:02:04 +03:00
|
|
|
|
2015-01-23 10:45:44 +03:00
|
|
|
Easiest way to install pgcli is using brew. Please be aware that this will
|
|
|
|
install postgres via brew if it wasn't installed via brew.
|
2015-01-14 09:25:03 +03:00
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
$ brew install pgcli
|
|
|
|
|
|
|
|
Done!
|
|
|
|
|
2015-01-23 10:45:44 +03:00
|
|
|
If you have postgres installed via a different means (such as PostgresApp), you
|
|
|
|
can ``brew install --build-from-source pgcli`` which will skip installing
|
|
|
|
postgres via brew if postgres is available in the path.
|
|
|
|
|
2015-01-14 09:25:03 +03:00
|
|
|
Alternatively, you can install ``pgcli`` as a python package using a package
|
|
|
|
manager called called ``pip``. You will need postgres installed on your system
|
2015-01-27 17:07:41 +03:00
|
|
|
for this to work.
|
|
|
|
|
|
|
|
In depth getting started guide for ``pip`` - https://pip.pypa.io/en/latest/installing.html.
|
2014-12-01 09:02:04 +03:00
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
$ which pip
|
|
|
|
|
|
|
|
If it is installed then you can do:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
$ pip install pgcli
|
|
|
|
|
|
|
|
If that fails due to permission issues, you might need to run the command with
|
|
|
|
sudo permissions.
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
$ sudo pip install pgcli
|
|
|
|
|
|
|
|
If pip is not installed check if easy_install is available on the system.
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
$ which easy_install
|
|
|
|
|
2015-01-07 13:09:30 +03:00
|
|
|
$ sudo easy_install pgcli
|
2014-12-01 09:02:04 +03:00
|
|
|
|
|
|
|
Linux:
|
2014-12-01 09:27:18 +03:00
|
|
|
======
|
2014-12-01 09:02:04 +03:00
|
|
|
|
2015-01-27 17:07:41 +03:00
|
|
|
In depth getting started guide for ``pip`` - https://pip.pypa.io/en/latest/installing.html.
|
|
|
|
|
2014-12-01 09:14:08 +03:00
|
|
|
Check if pip is already available in your system.
|
2014-12-01 09:02:04 +03:00
|
|
|
|
2014-12-01 09:14:08 +03:00
|
|
|
::
|
|
|
|
|
|
|
|
$ which pip
|
|
|
|
|
2014-12-19 09:32:47 +03:00
|
|
|
If it doesn't exist, use your linux package manager to install `pip`. This
|
|
|
|
might look something like:
|
2014-12-01 09:14:08 +03:00
|
|
|
|
|
|
|
::
|
|
|
|
|
2015-01-14 09:25:03 +03:00
|
|
|
$ sudo apt-get install python-pip # Debian, Ubuntu, Mint etc
|
2014-12-01 09:14:08 +03:00
|
|
|
|
|
|
|
or
|
|
|
|
|
2015-01-14 09:25:03 +03:00
|
|
|
$ sudo yum install python-pip # RHEL, Centos, Fedora etc
|
|
|
|
|
|
|
|
``pgcli`` requires python-dev, libpq-dev and libevent-dev packages. You can
|
|
|
|
install these via your operating system package manager.
|
|
|
|
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
$ sudo apt-get install python-dev libpq-dev libevent-dev
|
|
|
|
|
|
|
|
or
|
|
|
|
|
|
|
|
$ sudo yum install python-devel postgresql-devel
|
2014-12-01 09:14:08 +03:00
|
|
|
|
|
|
|
Then you can install pgcli:
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
$ sudo pip install pgcli
|
2014-12-01 09:02:04 +03:00
|
|
|
|
|
|
|
|
2014-12-11 11:51:38 +03:00
|
|
|
Thanks:
|
2014-12-19 11:32:26 +03:00
|
|
|
-------
|
2014-12-08 11:43:21 +03:00
|
|
|
|
2014-12-11 21:10:26 +03:00
|
|
|
A special thanks to `Jonathan Slenders <https://twitter.com/jonathan_s>`_ for
|
2014-12-19 09:32:47 +03:00
|
|
|
creating `Python Prompt Toolkit <http://github.com/jonathanslenders/python-prompt-toolkit>`_,
|
|
|
|
which is quite literally the backbone library, that made this app possible.
|
|
|
|
Jonathan has also provided valuable feedback and support during the development
|
|
|
|
of this app.
|
2014-12-08 11:43:21 +03:00
|
|
|
|
2014-12-19 09:32:47 +03:00
|
|
|
This app includes the awesome `tabulate <https://pypi.python.org/pypi/tabulate>`_
|
2015-01-07 12:57:46 +03:00
|
|
|
library for pretty printing the output of tables. The reason for vendoring this
|
2014-12-19 09:32:47 +03:00
|
|
|
library rather than listing it as a dependency in setup.py, is because I had to
|
|
|
|
make a change to the table format which is merged back into the original repo,
|
2015-01-08 18:15:12 +03:00
|
|
|
but not yet released in PyPI.
|
2014-12-08 11:43:21 +03:00
|
|
|
|
2014-12-19 09:32:47 +03:00
|
|
|
`Click <http://click.pocoo.org/3/>`_ is used for command line option parsing
|
|
|
|
and printing error messages.
|
2014-12-08 11:43:21 +03:00
|
|
|
|
2014-12-19 09:32:47 +03:00
|
|
|
Thanks to `psycopg <http://initd.org/psycopg/>`_ for providing a rock solid
|
2015-01-08 01:20:53 +03:00
|
|
|
interface to Postgres database.
|
2014-12-19 09:32:47 +03:00
|
|
|
|
|
|
|
Thanks to all the beta testers and contributors for your time and patience. :)
|
2015-01-05 10:34:31 +03:00
|
|
|
|
|
|
|
|
2015-04-19 08:54:58 +03:00
|
|
|
.. |Build Status| image:: https://api.travis-ci.org/dbcli/pgcli.svg?branch=master
|
|
|
|
:target: https://travis-ci.org/dbcli/pgcli
|
2015-01-05 10:34:31 +03:00
|
|
|
|
|
|
|
.. |PyPI| image:: https://pypip.in/version/pgcli/badge.svg
|
|
|
|
:target: https://pypi.python.org/pypi/pgcli/
|
|
|
|
:alt: Latest Version
|
2015-01-30 09:49:23 +03:00
|
|
|
|
|
|
|
.. |Gitter| image:: https://badges.gitter.im/Join%20Chat.svg
|
2015-04-19 08:54:58 +03:00
|
|
|
:target: https://gitter.im/dbcli/pgcli?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
|
2015-01-30 09:49:23 +03:00
|
|
|
:alt: Gitter Chat
|