PostgreSQL
https://www.postgresql.org/media/img/about/press/elephant.png
:env
code: (bash)
export env=dev
psql -v env=$env
Commands
backup / restore
code: (bash)
username=:put user name:
dumpfile=:put dumpfile name: # ex) dump.sql
# dump
pg_dumpall -U ${username} > ${dumpfile}
# restore
cat ${dumpfile} | psql -U ${username}
SQL
code:(bash)
psql -c "SQL"
code: (python)
from keywoo import app, db
from keywoo.models.sites import Site
from keywoo.models.users import User
site = Site(name=name, url=url, user=user)
db.session.add(site)
db.session.commit()
Memo
Reference