How to Run the Scripts for GP2 Dr. Chris Mayfield Department of - - PowerPoint PPT Presentation

how to run the scripts for gp2
SMART_READER_LITE
LIVE PREVIEW

How to Run the Scripts for GP2 Dr. Chris Mayfield Department of - - PowerPoint PPT Presentation

How to Run the Scripts for GP2 Dr. Chris Mayfield Department of Computer Science James Madison University Feb 20, 2020 Part 1: GitHub Review Check out a working copy If you havent done so already: git clone https://github.com/cs374/ group


slide-1
SLIDE 1

How to Run the Scripts for GP2

  • Dr. Chris Mayfield

Department of Computer Science James Madison University

Feb 20, 2020

slide-2
SLIDE 2

Part 1: GitHub Review

slide-3
SLIDE 3

Check out a working copy

If you haven’t done so already: git clone https://github.com/cs374/group.git (replace “group” with your group name) This step is a one-time setup You may clone as many copies as you like! ◮ For example, at school and at home ◮ GitHub will merge changes for you

Feb 20, 2020 How to Run the Scripts for GP2 3 of 8

slide-4
SLIDE 4

Passwords in CS 374

Reminder: JMU e-ID = Database password Which password do I use? ◮ ssh student.cs.jmu.edu ◮ psql -h data.cs.jmu.edu ◮ Password field of pgAdmin ◮ git clone https://... ◮ JMU e-ID ◮ Database ◮ Database ◮ GitHub

Feb 20, 2020 How to Run the Scripts for GP2 4 of 8

slide-5
SLIDE 5

Part 2: Script Files

slide-6
SLIDE 6

Running scripts

If my group name were absent ◮ psql -h data.cs.jmu.edu absent < create.sql ◮ ./copy.sh ◮ psql -h data.cs.jmu.edu absent < stats.sql Optional environment variables ◮ export PGHOST=data.cs.jmu.edu ◮ export PGDATABASE=absent ◮ psql < create.sql ◮ ./copy.sh ◮ psql < stats.sql works until you exit the terminal

Feb 20, 2020 How to Run the Scripts for GP2 6 of 8

slide-7
SLIDE 7

About copy.sh

Make it executable first: ◮ chmod 755 copy.sh ◮ ls -l copy.sh Tip: run copy.sh on the server ◮ ssh student.cs.jmu.edu ◮ cd directory of copy.sh Why is copy.sh so expensive? ◮ psql -c ✬COPY (...) TO STDOUT;✬ vdoe | \

psql -c ✬COPY foo FROM STDIN;✬ absent

Feb 20, 2020 How to Run the Scripts for GP2 7 of 8

slide-8
SLIDE 8

COPY and \copy

◮ COPY – copy data between a file and a table from database server’s point of view ◮ \copy – copy data between a file and a table from the psql client’s point of view https://www.postgresql.org/docs/11/sql-copy.html ◮ “\copy invokes COPY FROM STDIN or COPY TO STDOUT, and then fetches/stores the data in a file accessible to the psql client. Thus, file accessibility and access rights depend on the client rather than the server when \copy is used.”

Feb 20, 2020 How to Run the Scripts for GP2 8 of 8