Postgres

Download Postgres: PostgreSQL: Downloads

Set up database credentials

postgres=# \password new_name
postgres=# CREATE DATABASE db_name;

Connection

from psycopg2 import sql

conn = psycopg2.connect(
    user = "new_name",
    password="password",
    host="127.0.0.1",
    port="port_number",
    database="db_name"
)
cursor = conn.cursor()

Commit Changes

conn.commit()

Create Table

Insert

Update

Select

Get value in row

Rollbacks

Convert Postgres Database to CSV

Last updated

Was this helpful?