openego/ego.io

Rename column metadata to meta_data in EgoScenarioInput

Closed this issue · 9 comments

While creating a new version of ego.io I noticed a bug that was already resolved appears again (manually fixed in 0e3a110). I order to avoid it the next time, we should fix it properly at the right place. Do I get it right that we "simply" have to rename the column "metadata" of table "model_draft.ego_scenario_input" to "meta_data" and adjust all references? Please note, when I talk about renaming I mean actual renaming of the database column.

I would appreciate your advice @Ludee @nesnoj

Yes, I guess so. @Ludee did the renaming last time -> related issue in DP: openego/data_processing#102

Ludee commented

I wasn't aware of this scenario_input table yet.
It looks like a good idea.
Can you tell me where and how it is created?
Renaming the column in the database is quite simple:
ALTER TABLE model_draft.ego_scenario_input RENAME COLUMN metadata TO meta_data;

UPDATE: My future me liked the work I did a couple of month ago. But wasn't that good that I remembered right away.

Can you tell me where and how it is created?

Nope, no idea - sorry!

Ludee commented

Found the script. I created it and forgot it ;)

Database table renamed.
Script adjusted.
Pushed to dp/dev.
openego/data_processing@4c08c22

I recreated the defs recently and now we got the same problem in model_draft.scenario_log.
The metadata blames you, @Ludee ;)

Ludee commented

Are you sure about the table model_draft.scenario_log?
There is no column metadata

Perhaps it is still model_draft.ego_scenario_input with columns metadata_reference_date?

Yes it's model_draft.scenario_log, I just checked with pgAdmin..

Ludee commented

Ok, I confused scenario_log for different projects with ego_scenario_log.
Column renamed

cheers!