Running Queries in the repl

We can perform any queries as you would normally perform on the query tool in the pgadmin panel. If you want a simple guide on getting started with Postgres commands and queries, you can check this article.

For example, let us run a simple SELECT query in a particular database.  

 

So, as we can we were able to execute SQL queries in the python package which is a CLI for interacting with the postgres server as a query tool. 

PGCLI: Python package for a interactive Postgres CLI

PGCLI is a Python package that is used as an interactive command-line interface for the PostgreSQL database server. For following with the article, make sure you have PostgreSQL installed and set up in your local system. You can follow the guide for Windows, Linux and macOS from the guide.

Also for performing any operations or testing out the package, create a simple database of your choice, There should be enough data for you to work with as it is just a REPL for running queries in a Postgres database.

Similar Reads

Installation

As pgcli is a python package, it can be installed with pip....

Connecting to a database

Now, you can select a particular database that you want to work with. It should at least contain some tables(at least one) to work with. As we will perform reading records and other operations from pgcli....

Get a List of all the databases for a user

We can obtain the list of all the databases in the postgres for a specific user using the list option....

Running Queries in the repl

We can perform any queries as you would normally perform on the query tool in the pgadmin panel. If you want a simple guide on getting started with Postgres commands and queries, you can check this article....

Remote Database

We can even connect to a remote postgres database using some parameters or the URL itself....

Contact Us