- Install Psycopg2 package in Python
pip install psycopg2 or
pipenv install psycopg2 (virtual python environment)
- Install postgresql in Ubuntu
sudo apt update
sudo apt install postgresql postgresql-contrib
- After successfully install postgresql, the default role is postgres. So when you connect postgresql service in your own Ubuntu user, you cannot connect it, reporting the username not in the role. Thus create a role using your own username, and add your username in ROLE of postgres
psql postgres
postgres=# CREATE ROLE ubuntu_username superuser;
postgres=# ALTER ROLE ubuntu_username WITH LOGIN;
- In python, connect postgresql, e.g.
import psycopg2
conn = psycopg2.connect("dbname=test user=user_name")
FEATURED TAGS
AI
Fintech
OpenAI
Generative AI
LLM
Investment
Artificial Intelligence
Startups
AI Agents
AI Safety
AI Governance
Anthropic
Agentic AI
Enterprise AI
Singapore
AI Infrastructure
Open Source AI
AI Research
Quantum Computing
AI Security
Venture Capital
Cybersecurity
Tokenization
China AI
AI Regulation
Stablecoins
Digital Payments
Agentic
Compliance
Payments
Regulation
RWA
AI Policy
US AI
Economy
Banking