pgcli | Postgres CLI with autocompletion and syntax highlighting | Database library
kandi X-RAY | pgcli Summary
kandi X-RAY | pgcli Summary
Postgres CLI with autocompletion and syntax highlighting
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Execute pgclirc
- Return the configuration location
- Connect to the database
- Load a config object
- Returns a candidate column matching the given suggestion
- Unescape a name
- Construct a Candidate instance
- Find matches in text
- Get keywords matching the given suggestion
- Find possible datatypes
- Return a pygments style factory
- Run a query from a file
- Return a list of matching schemas matching the given suggestion
- Refreshes casing
- Read config file
- Get matches for a statement item item
- Change database connection
- Extract column metadata from full text and execute query
- Retrieve all registered functions
- Returns a list of possible joins for the given suggestion
- Generic pgcli magic magic
- Get join condition matches
- Get datatypes
- Refresh the completions
- Returns a list of possible completions
- Register special commands
pgcli Key Features
pgcli Examples and Code Snippets
{
// Use pgcli to for autocomplete? If false, standard sublime autocompletion is used
"pgcli_autocomplete": true,
// List of python directories to add to python path so pgcli can be imported
"pgcli_dirs": [],
// List of python
alembic revision --autogenerate -m "Add person table."
cat migrations/versions/*
alembic upgrade --sql +1
alembic upgrade +1
pgcli -U $DBUSER -h $DBHOST -p $DBPORT $DBNAME
# and then on the pgcli console:
\dt
# and again on the pgcli console:
SEL
source envrc
docker-compose up -d
pgcli -U "${DBUSER}" -h "${DBHOST}" -p "${DBPORT}" "${DBNAME}"
# or
pgcli "${DB_CONNECTION_STRING}"
Community Discussions
Trending Discussions on pgcli
QUESTION
I am using the free subscription at Azure and have successfully created a Ubuntu Server and a Flexible Postgres Database.
Until recently I accessed the DB directly from my Windows 10 desktop. Now I want to route all access through the Ubuntu Server.
For this I have installed Open SSH Client and Open SSH Server on my Windows 10 machine and done the necessary local port forwarding with ssh -L 12345:[DB IP]:5432 my_user@[Ubuntu IP]
The connection works, I confirmed it with pgcli on my desktop with pgcli -h 127.0.0.1 -p 12345 -u my_user -d my_db
But when I am trying to connect via node-pg I receive the following error
...ANSWER
Answered 2021-Sep-07 at 10:40The comment by @jjanes helped me in understanding the issue, thank you.
This edited pg.Client config solved my problem:
QUESTION
I have cloned the following repo from github:
https://github.com/FACed-Off/learn-node-postgres
and am current working on the following commit hash in the master branch:
3785d42e8e8a954a363ee108d5263bb51780a0ea
However I am unable to progress at the point where I run the server, as the init.sql
file does not seem to be recognised. VScode claims there is a syntax error despite the code being correct, however upon running this code on another machine, the expected output occurs which is:
"...a big object logged in your terminal. This is the entire result of our database query. The bit we're actually interested in is the "rows" property. This is an array of each row in the table we're selecting from. Each row is represented as an object, with a key/value entry for each column."
The output I get on this current machine upon running npm run dev
is the "hello world" text at the localhost:3000 endpoint, however I do not get any sort of output from the code in the home function for the db.query method:
ANSWER
Answered 2020-Jul-19 at 11:29After some research, and receiving help from a 3rd party, I came across the solution to my own issues here.
the init.sql file does not seem to be recognised. VScode claims there is a syntax error despite the code being correct
There is an extension in vscode that is suggested when writing sql code called mssql, this does not lint as intented, so disabling this solved the issue.
However, this did not solve the fact that my code was not outputting my database correctly, the solution to this was found here.
The node version I had, v14.5.0 was not compatible with the pg package version v7.18.2. I had to change the package.json file to allow it to upgrade to the latest version of pg when initialising the pg package with npm i. The caret(^) symbol originally used in the package.json file with this dev dependency meant that reinstalling the pg package did not get the v8 versions of pg which would be compatible with the v14.5.0 version of node. More details can be found here
After entirely removing the line "pg": "^7.18.2"
from my package.json and reinitiallising pg, this got the latest version and solved my issue.
Here is a post summarising the issue and solution
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install pgcli
You can use pgcli like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page