-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Kathryn Paradis edited this page Jan 6, 2018
·
6 revisions
- Once you have a CSV containing the missing data, you will need to reformat it to be able to upload it to the database.
- Open the CSV in Excel
- Delete any unnecessary columns
- Type in the purpose ID as the header for one of the columns
- Select the cell directly beneath the purpose ID and go to the Tableau menu, and click the "Reshape data" button (if you haven't installed this add-on you will need to)
- Click ok
- A new worksheet should pop up with your reshaped data, so delete the original worksheet. (When you go to save the CSV it only saves the 1st worksheet.)
- Order the columns as they appear in the table you wish to insert the data into.
- Save the file
- Open SQL shell
- Press enter to get into LocalHost
- Type the database name
- Enter the port number from Local Forwarding.
- Type in your Putty username
- Use the \copy command to upload your CSV (see example below):
\copy tablename (column1, column2, column3) from 'C:\Users\Kat\Desktop\filename.csv' CSV HEADER;
- Your file is now uploaded to the database!
- Open winSCP
- Find the folder that you want to put your file in, and place your file in the folder(?).
- Once the file is in the folder, copy the file address to use in the \copy command that you will use in the next steps [You can right click the file, mouse over File Names, and select "Copy to Clipboard (include paths)"]
- Putty into the server
- Type the following: psql databasename (type the name of the database that you want to upload the data to)
- Paste the following (*make sure the file address that you previously copied is from the SERVER, NOT your computer):
\copy tablename (column1, column2, column3) from '/home/kathryn/practice_upload/filename.csv' CSV HEADER;
- Your file is now uploaded to the database!
- Add user to role
- Create role with NOINHERIT (so it can be granted to other users without inheriting from anything else)
- Alter permissions table-wise:
- Alter default permissions table-wise: