Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Amjith Ramanujam
    Which I think is the right first step.
    Open up the PR and we'll have a discussion.
    Thanks for taking the time to dig into the code. I appreciate it.
    Matthieu Guilbert

    @gma2th Sorry I never got a chance to comment on the issue. I'll take a look at the changes you've made.

    No worries ^^

    From reading the original issue I thought the feature request was that we will start a transaction at the beginning of a session and we won't commit until the user requests.

    This one is done with AUTOCOMMIT.
    There are actually two features:

    • AUTOCOMMIT off, which is done at https://github.com/dbcli/pgcli/compare/master...gma2th:feat/on-error-rollback#diff-8859be39408e4fbeea82b923784d9e65R215 (should be a settings). This is done through psycopg2.
    • ROLLBACK ON ERROR, if I'm correct, this is only implemented in psql, so we should implement it ourselves.

    If the user doesn't request a commit but decides to quit pgcli we will prompt the user that there is an uncommited transaction in progress.

    In my opinion, we should not implement that. Most of the time, you connect to the db and do basic query (SELECT and stuff), then when you quit, you don't care that your transaction is committed or not. (It's done this way in psql)

    Nikita Gladyshev
    sorry guys i am so noobie :) i installed postgresql 10, also have python 3.6 installed. i installed pgcli package for python, so how can i start pgcli? how can i manage my new database? :(
    Abhinav Mehta
    I've successfully added few [named queries] in config, those are some really long ones. Now what I'm looking is -- in console during execution, it prints that query, I want to get it pretty-print, multi-lined, how can I do that?
    I'm okay putting \n or any supported character in [named queries] or also okay with putting it multi-line formatted in configs .. and I tried both the ways, none worked .. any pointers in this direction are appreciated.
    Abhinav Mehta
    I've one more question -- can someone lists all format specifiers available for named-queries? I know only %s.
    hello all, i got 2 questions about mycli usage in windows 7:
    1, how can PowerCmd work with mycli? i trid and it's a mess.
    2, has anyone come accross that whe type 'V' in the keyboard and then it acts just like the key ENTER ?
    thanks for sharing solutions.
    Matthieu Guilbert

    Hey hello, 2 question about contributing.

    1. pep8radius master --docformatter --in-place don't produce any output locally but failed on travis.
    2. When running py.test locally after behave, the following tests failed, any idea why ?
      ============================================= FAILURES ==============================================
      ___ test_pathscompletion __

    completer = <pgcli.pgcompleter.PGCompleter object at 0x104f4fba8>
    complete_event = <Mock id='4378129968'>

    def test_paths_completion(completer, complete_event):
        text = '\i '
        position = len(text)
        result = set(completer.get_completions(
            Document(text=text, cursor_position=position),
      assert result > set([Completion(text="setup.py", start_position=0)])

    E AssertionError: assert {Completion(text='test_main.py', start_position=0), Completion(text='test_plan.wiki', start_position=0), Completion(te...s/'), Completion(text='test_sqlcompletion.py', start_position=0), Completion(text='pytest.ini', start_position=0), ...} > {Completion(text='setup.py', start_position=0)}
    E + where {Completion(text='setup.py', start_position=0)} = set([Completion(text='setup.py', start_position=0)])

    complete_event = <Mock id='4378129968'>
    completer = <pgcli.pgcompleter.PGCompleter object at 0x104f4fba8>
    position = 3
    result = {Completion(text='test_main.py', start_position=0), Completion(text='test_plan.wiki', start_position=0), Completion(te...s/'), Completion(text='test_sqlcompletion.py', start_position=0), Completion(text='pytest.ini', start_position=0), ...}
    text = '\i '

    test_naive_completion.py:65: AssertionError
    ============= 1 failed, 2406 passed, 100 skipped, 1 xfailed, 1 xpassed in 15.90 seconds =============


    Fernando Lucio Canizo
    hello, I've updated my Ubuntu to 18.04 LTS and suddenly my pgcli is broken
    Tried to install again followin the long install instructions: sudo apt install libpq-dev python3-dev; sudo pip3 install pgcli
    $ pgcli postgres
    Command 'pgcli' not found, but can be installed with:
    sudo apt install pgcli
    Ok, don't know why it's not on my $PATH, but I'll try the suggestion anyway, so I issue: ```
    sudo apt install pgcli
    The following packages have unmet dependencies:
     pgcli : Depends: python3-psycopg2 (>= 2.6.2) but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.
    Fernando Lucio Canizo
    I could find a solution about why the pip-installed one doesn't get included in my path, also haven't found a solution for the package-maintaned version
    Has anyone stomped with this?
    Also tried:
    $ python3 -m pgcli
    /usr/bin/python3: No module named pgcli.__main__; 'pgcli' is a package and cannot be directly executed
    Fernando Lucio Canizo
    There's nothing in /usr/local/bin
    Fernando Lucio Canizo
    @jvidin use \copy ...
    It works
    is it possible to save query result set to a file in TSV/CSV format?
    Matthieu Guilbert
    Hey, I created a PR few weeks ago, is anybody able to review it ? dbcli/pgcli#917
    Fernando Lucio Canizo
    Hi all, I still haven't solved my problem with pgcli not running in Ubuntu 18.04 from August (!)
    Today I decided to check on a new machine... I thought: maybe my python installation is screwed on the machines I tested because the dist-upgrade
    So I launched a new VM an noticed pgcli is not even listed on 18.04
    Fernando Lucio Canizo
    Forget what I just wrote: I was missing an update on the new machine, everything works perfect. So my problem on the dist-upgraded machine could be fixed by deploying a new one
    Frank Sheiness
    where does one set a default search_path ?
    Thank you for pgcli
    Nice extention

    @fernandocanizo try 1)pip install --upgrade requests

    2)pip install psycopg2-binary

    3) pip install pgcli --no-binary :all: psycopg2


    Hi Team,

    I am new to pgcli project, just setup my DEV environment on Linux Mint 19 Tara today, when I run py.test, I'm getting same error mentioned by @gma2th


    hi all, just wanna share my setup :

    • set multiline
    • set vi as keybindings
    • use pspg as default pager

    [entering heaven]

    Unmesh K
    Hi - I am new to pgcli. I'm getting errors when trying to install it. Does pgcli work with Python 3 on Windows?
    Error I see on >pip install pgcli:Failed building wheel for setproctitle
    Running setup.py clean for setproctitle
    Failed to build setproctitle
    jupyter-console 5.2.0 has requirement prompt-toolkit<2.0.0,>=1.0.0, but you'll have prompt-toolkit 2.0.7 which is incompatible.
    ipython 6.5.0 has requirement prompt-toolkit<2.0.0,>=1.0.15, but you'll have prompt-toolkit 2.0.7 which is incompatible.
    Adi Nemer
    quick question
    do i have to install postgre to use the cli or can i use it to access remote postgre servers
    Matheus Rosa
    Hello @adinemer
    You don’t need to have PostgreSQL database installed. You can access remote databases. Here is our documentation page:
    Hey guys. I got module 'keyring.errors' has no attribute 'KeyringLocked when running pgcli -D xxx. Any advice?
    hi i have 1 question, can i do some query or something to get CREATE STATMENT for that table, i think i saw it can be done with pg_dump but am asking can i do it while in pgcli
    Hey all. What's the keyboard shortcut to accept the line suggestion with autocomplete?
    Hey there
    question: How can I make pip3 install pgcli use psycopg2-binary instead of building it from source?
    Adam Hopkins
    Anyone seen PQconninfo not available in libpq < 9.3 after installing and trying to sign in?
    I am trying on an installation of Postgres 9.4