Skip to content

Commit

Permalink
update db upload documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreyMinucci committed Jan 31, 2025
1 parent ef3e61d commit 926fc29
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions database/DATA_INITIALIZATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ The four steps listed below are required to initialize the database and configur

# Table Creation
The application is currently set up to work with a PostGreSQL database. Run the DDL in _ms1_batch_search_table_ddl.sql_
to create the table and properly index it.
to create the table and properly index it. If the table already exists be sure to back it up somewhere.

$ psql -h %host -p $port --dbname %databaseName --user %username < ms1_batch_search_table_ddl.sql

Expand All @@ -17,10 +17,16 @@ associated with the %username input in the command. If you would like the data
$ mysql -h mysql-ip-m.epa.gov -u %username -p prod_dsstox <data_extraction.sql> ms1_data.tsv

# Data Upload
Login into PostGreSQL instance that will be used to service the nta_flask application. Run the following command at
Login into PostGreSQL instance that will be used to service the nta_flask application.

Run the following command at
postgres command line prompt while in the database intended for use.

# \COPY ms1_batch_search (msr_dsstox_compound_id, msr_monoisotopic_mass,msr_smiles,msr_mol_formula, dsstox_substance_id,preferred_name,casrn,jchem_inchi_key,acd_iupac_name,mol_formula,monoisotopic_mass,total_median,expocast_comptox_link,nhanes_comptox_link,assay_count_active,assay_count_total) from '%path2File' with delimiter E'\t' null as 'NULL' csv header
# \COPY ms1_batch_search (msr_dsstox_compound_id, msr_monoisotopic_mass,msr_smiles,msr_mol_formula, dsstox_substance_id,preferred_name,casrn,jchem_inchi_key,acd_iupac_name,mol_formula,monoisotopic_mass,total_median,expocast_comptox_link,nhanes_comptox_link,assay_count_active,assay_count_total,data_sources) from '%path2File' with delimiter E'\t' null as 'NA' csv header

Then grant the 'ntauser' read-only access to the new table.

GRANT SELECT ON ms1_batch_search to ntauser;



Expand Down
2 changes: 1 addition & 1 deletion database/ms1_batch_search_table_ddl.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CREATE TABLE ms1_batch_search (
msr_smiles TEXT NULL,
msr_mol_formula VARCHAR(255) NULL,
dsstox_substance_id VARCHAR(45) NULL,
preferred_name VARCHAR(255) NULL,
preferred_name TEXT NULL,
casrn VARCHAR(45) NULL,
jchem_inchi_key VARCHAR(45) NULL,
acd_iupac_name TEXT NULL,
Expand Down

0 comments on commit 926fc29

Please sign in to comment.