FAQ

These are some questions that the author wishes everyone would ask, since he
knows the answers for them.

Why does pgcli exist?

I'm a huge fan of CLIs. Especially REPLs. When I first encountered
BPython, I fell in love with it. BPython is a Python REPL that has
auto-completion, syntax-highlighting and displays the docstring of functions
as you type. Once you get used to that level of pampering, all other REPLs
start to look like Dumb Terminals.

When I started using psql for interacting with my Postgres database, I
yearned for a BPython equivalent for psql.

One fine day I got a twitter DM from Jonathan Slenders asking me if I'd
be interested in trying a new Python library that he's working on called
Python-Prompt-Toolkit. This library provided a way to write CLIs without
having to deal with curses and had the requisite tools for doing
auto-completion and syntax-highlighting. So I jumped at the opportunity to
try it out. After I got myself familiarized, I started writing pgcli to
scratch my own itch.

So this app exists because Jonathan was kind enough to request my feedback.

Does pgcli work on Windows?

Yes! It does. One of our prominent core developers is a Windows user and he
tests the releases in Windows. A few caveats, if you don't have less.exe
installed on your system it uses more by default which is not very
feature full. It is also advisable to use cmder instead of cmd.exe.

I don't have time to write an SQLite version. But if you're
interested in doing it, I'd be happy to help you. Please get in touch.

What's the difference between Smart Completion and Naive Completion?

Naive Completion is a collection of all the keywords, functions, table names
and column names. As you start typing this collection will be narrowed down
based on the text that has been types so far.

Smart Completion tries to do context sensitive completion. For eg: 'SELECT *
FROM ' knows that the only items relevant after the FROM keyword is a table
name, so it only suggests items from a collection of table names.

How 'smart' is the Smart Completion?

Smart Completion uses the Sqlparse library to tokenize the sql statement and
uses heuristics to suggest context sensitive completion. It can handle
nearly 80% of scenarios (in my testing). But there are still some corner
cases where it will suggest only keywords when you might be looking for
columns or tables. So it could get frustrating when it refuses to provide
completions from a different category. In those scenarios, I tend to turn it
off (using the F2 key) and switch to Naive completion which suggests words
from all categories.

The code itself is not my proudest work. Writing auto-completion libraries
are inherently difficult since you're dealing with incomplete input. So the
parser can't work effectively in many scenarios. So the code has to
compensate for those corner cases. Which resulted in a lot of testing and
patching those cases with one off 'if-conditions'.

Whoopsie Daisies! I'm sorry you encountered a bug. Please file a bug on
Github Issues for this project. I'll fix it asap.

I have a feature request, what do I do?

Sweet! Open a new item on Github Issues. Alternatively, you can take a stab
at implementing the new feature yourself. If you'd like some guidance, I'm
just an email away. Don't hesitate to contact me.

I want to contribute to this project, how do I do that?

Awesome! I thought you'd never ask. Here's a developer guide that provides basic info on getting
started with local development. You're also welcome to contact me, if you
need some help getting started.

What's your favorite cuisine?

What's the point in having an FAQ if I don't include at least one frequently
asked question. So here it goes: