Run PostgreSQL database - MaastrichtU-IDS/data2services-pipeline GitHub Wiki

Run PostgreSQL

docker run --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=pwd -d -v /data/data2services/:/data postgres

Connect to Postgres and load scripts

# Connect to postgres
docker exec -it postgres psql -U postgres

# Load SQL script
docker exec -it postgres psql -U postgres drugcentral < /data/drugcentral.dump.08262018.sql

# Load SQL script with files in aeolus DB
docker exec -i postgres psql -U postgres my_db < /data/setup_db.sql

PSQL commands

# List databases
\l
# Connect to database
\c my_database
# Create database
CREATE DATABASE my_database;

# List schemas
\dn
# Choose a schema
SET search_path TO schema_name;

# List tables
\dt
# Select from table
SELECT * FROM table_name LIMIT 10;