Code coverage report Code Health
This is a postgres client that does auto-completion and syntax highlighting.
Home Page: http://mycli.net
screenshots/pgcli.gif screenshots/image01.pngIf you already know how to install python packages, then you can simply do:
$ pip install -U pgcli or $ sudo apt-get install pgcli # Only on Debian based Linux (e.g. Ubuntu, Mint, etc) $ brew install pgcli # Only on macOS
If you don't know how to install python packages, please check the psycopg docs for more information about this and how to force installation from source. psycopg2 2.8 has fixed these problems, and will build from source.
$ pgcli [database_name] or $ pgcli postgresql://[user[:password]@][netloc][:port][/dbname][?extra=value[&other=other-value]]
Examples:
$ pgcli local_database $ pgcli postgres://amjith:pa$$w0rd@example.com:5432/app_db?sslmode=verify-ca&sslrootcert=/myrootcert
For more details:
$ pgcli --help Usage: pgcli [OPTIONS] [DBNAME] [USERNAME] Options: -h, --host TEXT Host address of the postgres database. -p, --port INTEGER Port number at which the postgres instance is listening. -U, --username TEXT Username to connect to the postgres database. -u, --user TEXT Username to connect to the postgres database. -W, --password Force password prompt. -w, --no-password Never prompt for password. --single-connection Do not use a separate connection for completions. -v, --version Version of pgcli. -d, --dbname TEXT database name to connect to. --pgclirc FILE Location of pgclirc file. -D, --dsn TEXT Use DSN configured into the [alias_dsn] section of pgclirc file. --list-dsn list of DSN configured into the [alias_dsn] section of pgclirc file. --row-limit INTEGER Set threshold for row limit prompt. Use 0 to disable prompt. --less-chatty Skip intro on startup and goodbye on exit. --prompt TEXT Prompt format (Default: "\u@\h:\d> "). --prompt-dsn TEXT Prompt format for connections using DSN aliases (Default: "\u@\h:\d> "). -l, --list list available databases, then exit. --auto-vertical-output Automatically switch to vertical output mode if the result is wider than the terminal width. --warn [all|moderate|off] Warn before running a destructive query. --help Show this message and exit.
The pgcli is written using Config
A config file is automatically created at 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. amjith.r@gmail.com, Twitter: Detailed Installation Instructions:
The easiest way to install pgcli is using Homebrew. Done! Alternatively, you can install In depth getting started guide for In depth getting started guide for Pgcli can be run from within Docker. This can be useful to try pgcli without
installing it, or any dependencies, system-wide. To build the image: To create a container from the image: To access postgresql databases listening on localhost, make sure to run the
docker in "host net mode". E.g. to access a database called "foo" on the
postgresql server running on localhost:5432 (the standard port): To connect to a locally running instance over a unix socket, bind the socket to
the docker container: Pgcli can be run from within Thanks:
A special thanks to 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. psycopg for providing a rock solid
interface to Postgres database. Thanks to all the beta testers and contributors for your time and patience. :)pgcli also supports many of the same
Features
~/.config/pgcli/config at first launch.
See the file itself for a description of all available options.
Contributions:
macOS:
$ brew install pgcli
pgcli as a python package using a package
manager called called pip. You will need postgres installed on your system
for this to work.pip - Linux:
pip - Docker
$ docker build -t pgcli .
$ docker run --rm -ti pgcli pgcli <ARGS>
$ docker run --rm -ti --net host pgcli pgcli -h localhost foo
$ docker run --rm -ti -v /var/run/postgres:/var/run/postgres pgcli pgcli foo
IPython
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。