-
Notifications
You must be signed in to change notification settings - Fork 1
/
notes
28 lines (21 loc) · 879 Bytes
/
notes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# how to create a new db
sudo su - postgres
createuser -h localhost -S -D -R -P hood
createdb -h localhost -E UNICODE -O hood hood
# createlang -h localhost plpgsql hood
psql hood hood < schema/schema.sql
psql hood hood < schema/trigger.sql
# how to dump the db
pg_dump -F c -U hood hood > neighborhood.pgdmp
# how to dump the schema
pg_dump -s -U hood -Fp -f schema/schema.sql hood
# how to export the data to CSV, in psql
\copy tablename TO tablename.csv WITH CSV HEADER
# how to create a new db
dropdb -h localhost hood
createdb -h localhost -E UNICODE -O hood hood
# how to restore from a database dump
pg_restore -h localhost -d hood neighborhood.pgdmp
Before installing PIP on Ubuntu 12.04, you'll need to do one of these so that PIL can find the lib:
sudo ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib
sudo ln -s /usr/lib/i386-linux-gnu/libz.so /usr/lib