yum install gcc
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-6-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo yum install -y postgresql10-server
sudo service postgresql-10 initdb
sudo chkconfig postgresql-10 on
sudo service postgresql-10 start
#config pg 10 #change to postgres user balabala, createdb, create table, create new user, alter use password
su – postgres
pgsql
/var/lib/pgsql/10/data/pg_hba.conf #peer -> md5
service postgresql-10 restart
curl https://bootstrap.pypa.io/2.6/get-pip.py > get-pip.py
python get-pip.py
yum install python-devel
yum install postgresql10-devel
curl "https://files.pythonhosted.org/packages/fd/ae/98cb7a0cbb1d748ee547b058b14604bd0e9bf285a8e0cc5d148f8a8a952e/psycopg2-2.8.6.tar.gz" > psycopg2-2.8.6.tar.gz
export PATH=$PATH:/usr/pgsql-10/bin
pip install psycopg2-2.8.6.tar.gz
pip wheel psycopg2-2.7.7.tar.gz
curl 'https://files.pythonhosted.org/packages/c2/f6/11fcc1ce19a7cb81b1c9377f4e27ce3813265611922e355905e57c44d164/SQLAlchemy-1.1.15.tar.gz' > sql.tar.gz
pip install sql.tar.gz
from sqlalchemy import create_engine
db_string = "postgres://zdb:new_password@localhost/zdb?host=/var/run/postgresql"
db = create_engine(db_string)
result_set = db.execute("SELECT * FROM playground")
for r in result_set:
print(r)