instructions for new users¶
- you should first change your database password:
- go to *phpPgAdmin login*
- log in with your username and temporary password
- go to *phpPgAdmin password change*
- enter your new password twice and click OK
- if applicable, also change your SSH password:
$ ssh username@vegbiendev.nceas.ucsb.edu passwd
- enter your temporary password twice
- enter your new password twice
- follow the instructions for accessing VegBIEN:
accessing VegBIEN¶
if you have a nimoy/vegbankdev SSH account:¶
this applies if you were a member of BIEN2. otherwise, see "if you have a vegbiendev database account" below.
- if you already have the BIEN2
bien_read
password, use that - otherwise:
- forusername
, and when prompted for your password, use your nimoy/vegbankdev login- to get the password to access the main DB:
$ ssh username@vegbiendev.nceas.ucsb.edu "cat /home/bien/config/bien_read_password; echo"
- to get the password to access staging tables: (WARNING: this user has write access!)
$ ssh username@vegbiendev.nceas.ucsb.edu "cat /home/bien/config/bien_password; echo"
- to get the password to access the main DB:
to view the database schema:¶
- go to *phpPgAdmin*
- log in as user
bien_read
with the password you retrieved above
(or to access staging tables, use userbien
) - see steps under once logged in to phpPgAdmin below
to access data:¶
- open Terminal/PuTTY
- run a query:
- you will also be prompted for thebien_read
(orbien
) password$ ssh bien_read@vegbiendev.nceas.ucsb.edu "$(cat <<'eof_ssh' psql --quiet -U bien_read -d vegbien --file=<(cat <<'eof_psql' COPY ( SELECT * FROM "public".table LIMIT 100 ) TO STDOUT CSV HEADER; eof_psql ) eof_ssh )"
- to browse the DB:
$ ssh username@vegbiendev.nceas.ucsb.edu "psql --quiet -U bien_read -d vegbien"
- to export
view_full_occurrence_individual
:$ ssh username@vegbiendev.nceas.ucsb.edu "psql --quiet -U bien_read -d vegbien <<<'COPY (SELECT * FROM view_full_occurrence_individual LIMIT 100) TO STDOUT CSV HEADER;'"
- to export
analytical_stem
:$ ssh username@vegbiendev.nceas.ucsb.edu "psql --quiet -U bien_read -d vegbien <<<'COPY (SELECT * FROM analytical_stem LIMIT 100) TO STDOUT CSV HEADER;'"
- to export main-DB tables:
$ ssh username@vegbiendev.nceas.ucsb.edu "psql --quiet -U bien_read -d vegbien <<<'COPY (SELECT * FROM table LIMIT 100) TO STDOUT CSV HEADER;'"
- to export staging tables:
$ ssh username@vegbiendev.nceas.ucsb.edu "psql --quiet -U bien -d vegbien <<<'COPY (SELECT * FROM \"datasource\".table LIMIT 100) TO STDOUT CSV HEADER;'"
- to browse the DB:
if you have a vegbiendev database account:¶
this applies if you received an account setup e-mail with a temporary password. otherwise, see "if you have a nimoy/vegbankdev SSH account" above.
to view the database schema:¶
- go to *phpPgAdmin*
- log in as your user
- see steps under once logged in to phpPgAdmin below
to access data:¶
- open Terminal
$ sudo apt-get --yes install postgresql-9.3
- run a query:
$ psql --quiet -h vegbiendev.nceas.ucsb.edu -U username -d vegbien <<'eof' COPY ( SELECT * FROM "schema".table LIMIT 100 ) TO STDOUT CSV HEADER; eof
- to browse the DB:
$ psql --quiet -h vegbiendev.nceas.ucsb.edu -U username -d vegbien
- to export
view_full_occurrence_individual
:$ psql --quiet -h vegbiendev.nceas.ucsb.edu -U username -d vegbien <<<'COPY (SELECT * FROM view_full_occurrence_individual LIMIT 100) TO STDOUT CSV HEADER;'
- to export
analytical_stem
:$ psql --quiet -h vegbiendev.nceas.ucsb.edu -U username -d vegbien <<<'COPY (SELECT * FROM analytical_stem LIMIT 100) TO STDOUT CSV HEADER;'
- to export tables:
$ psql --quiet -h vegbiendev.nceas.ucsb.edu -U username -d vegbien <<<'COPY (SELECT * FROM table LIMIT 100) TO STDOUT CSV HEADER;'
- to browse the DB:
once logged in to phpPgAdmin:¶
WARNING: do not use phpPgAdmin to access data, as this will crash the server. instead, use the steps under "to access data" above. phpPgAdmin can still be used to view the database schema.
to browse or configure a table:¶
- In the left sidebar, expand vegbien > Schemas >
public
> Tables - Click a table
- In the main frame, scroll all the way to the bottom and click Browse, Select, etc.
to run a query:¶
- In the left sidebar, click vegbien
- Click SQL in the upper tab bar
- Enter a query, check Paginate results, and click Execute
- To edit your query, scroll to the bottom of the page and click Edit SQL
- To download the results, scroll to the bottom of the page and click Download