Look at this existing tutorial https://lerryws.xyz/posts/PyQGIS-in-Jupyter-Notebook
| # Note: this script is designed to run with Python 3 and ArcGIS Pro ArcPy | |
| # import modules | |
| # arcpy => provides access to Esri ArcGIS Pro | |
| # os => provides convient way to construct file paths | |
| # sys => provides way to capture errors | |
| # re => used for snake case helper function (taken from https://www.30secondsofcode.org/python/s/snake) | |
| import arcpy, os, sys | |
| from re import sub |
The connection failed because by default psql connects over UNIX sockets using peer authentication, that requires the current UNIX user to have the same user name as psql. So you will have to create the UNIX user postgres and then login as postgres or use sudo -u postgres psql database-name for accessing the database (and psql should not ask for a password).
If you cannot or do not want to create the UNIX user, like if you just want to connect to your database for ad hoc queries, forcing a socket connection using psql --host=localhost --dbname=database-name --username=postgres (as pointed out by @meyerson answer) will solve your immediate problem.
But if you intend to force password authentication over Unix sockets instead of the peer method, try changing the following pg_hba.conf* line:
from
| COUNTYFIPS | NAME | STATEPLANEFIPS | EPSG | |
|---|---|---|---|---|
| 16079 | Shoshone County | 1103 | 26970 | |
| 16073 | Owyhee County | 1103 | 26970 | |
| 16071 | Oneida County | 1101 | 26968 | |
| 16077 | Power County | 1101 | 26968 | |
| 16075 | Payette County | 1103 | 26970 | |
| 06115 | Yuba County | 0402 | 26942 | |
| 06111 | Ventura County | 0405 | 26945 | |
| 06113 | Yolo County | 0402 | 26942 | |
| 31177 | Washington County | 2600 | 32104 |
| license: gpl-3.0 | |
| redirect: https://observablehq.com/@d3/vector-tiles |