docker run --name dbc -p 54321:5432 -e POSTGRES_PASSWORD=1234 -d postgres docker exec -it dbc psql -U postgres \l CREATE DATABASE hyudb \c hyudb CREATE TABLE students ( sid CHAR(20) NOT NULL, name CHAR(20) NOT NULL, login CHAR(10) NOT NULL, age INT NOT NULL, gpa REAL NULL, PRIMARY KEY (sid) ); ALTER TABLE enrolled ADD PRIMARY KEY (sid, cid) ALTER TABLE enrolled ADD FOREIGN KEY (sid) REFERENCES students; #ALTER TABLE enrolled ADD CONSTRAINT cid_grade_unique UNIQUE (cid, grade) \d+ students
nmap -Pnv -p 5432 ec2-54-251-188-3.ap-southeast-1.compute.amazonaws.com
Get tables
with pg.connect(connect_string) as conn: with conn.cursor() as cur: cur.execute("""SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'""") for table in cur.fetchall(): print(table)
CREATE TABLE public.volunteer ( id SERIAL PRIMARY KEY, email character varying(100) COLLATE pg_catalog."default", password character varying(100) COLLATE pg_catalog."default" NOT NULL, name character varying(100) COLLATE pg_catalog."default" NOT NULL, CONSTRAINT volunteer_email_key UNIQUE (email) )
sqlalchemy
flask-sqlacodegen --flask --outfile tc.py "postgres://postgres: - -@c2s2.hanyang.ac.kr:5432/jaunt" --tables "tc_devices,volunteer"
$ git remote add upstream https://github.com/[Original Owner Username]/[Original Repository].git $ git fetch upstream $ git checkout master $ git merge upstream/master $ git push
First install the extension CREATE EXTENSION tsm_system_rows; Then your query, SELECT * FROM table TABLESAMPLE SYSTEM_ROWS(1000);