Skip to content

Commit

Permalink
Merge pull request #136 from Sage-Bionetworks/GEN-1415-update-table-fix
Browse files Browse the repository at this point in the history
[GEN-1415] Update code to use pandas.concat
  • Loading branch information
thomasyu888 authored Jul 11, 2024
2 parents c202980 + a3f760f commit 2ee2d4a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions scripts/table_updates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Installation and Setup
### Python version
Make sure you have Python 3.8 installed


### Install the required packages
(sudo) pip install -r requirements.txt

Expand All @@ -17,6 +18,15 @@ Please make sure you have the [.synapseConfig file](https://help.synapse.org/doc
### Service catalog instance
Use a t3.2xlarge ec2 instance for large memory requirement.

Putting it all together.

```
# Make sure you have anaconda installed
conda create -n genie-table-update python=3.8
conda activate genie-table-update
pip install -r requirements.txt
```

Usage
-----
### Prepare the Synapse tables to be updated
Expand Down
2 changes: 1 addition & 1 deletion scripts/table_updates/update_table_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _update_table_schema(syn, form, curated_data_element, logger, dry_run):
current_cols = syn.getColumns(row['id'])
current_cols = pandas.DataFrame(current_cols)
current_cols['table_id'] = row['id']
current_cols_df = current_cols_df.append(current_cols)
current_cols_df = pandas.concat([current_cols_df, current_cols])
# get the table id with the least columns
tbl_with_least_cols = current_cols_df['table_id'].value_counts()
tbl_with_least_cols_id = tbl_with_least_cols.idxmin()
Expand Down

0 comments on commit 2ee2d4a

Please sign in to comment.