VForWaTer / metacatalog

Modular metadata management platform for environmental data.
https://vforwater.github.io/metacatalog
GNU General Public License v3.0
3 stars 1 forks source link

Added the EntryGroup "Split Dataset" #123

Closed AlexDo1 closed 3 years ago

codecov[bot] commented 3 years ago

Codecov Report

Merging #123 (4898b35) into master (ba048b6) will increase coverage by 0.01%. The diff coverage is 60.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #123      +/-   ##
==========================================
+ Coverage   56.08%   56.10%   +0.01%     
==========================================
  Files          56       57       +1     
  Lines        2578     2588      +10     
==========================================
+ Hits         1446     1452       +6     
- Misses       1132     1136       +4     
Flag Coverage Δ
e2e 56.10% <60.00%> (+0.01%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
metacatalog/db/revisions/__init__.py 100.00% <ø> (ø)
metacatalog/models/entrygroup.py 70.73% <ø> (ø)
metacatalog/db/revisions/rev4.py 60.00% <60.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ba048b6...4898b35. Read the comment docs.

AlexDo1 commented 3 years ago

I would like to try this, but I am not sure what to do.

I need to create a new file "rev4" and write some code for UPGRADE_SQL and DONWGRADE_SQL, right? Which table would I have to change in metacatalog for the new EntryGroup?

The table entrygroup_types already looks (?): image

mmaelicke commented 3 years ago

I would like to try this, but I am not sure what to do.

I need to create a new file "rev4" and write some code for UPGRADE_SQL and DONWGRADE_SQL, right?

Yeah. But you also need to import and add the new file in the /db/revisions/__init__.py file. It's easier to use the metacatalog CLI for this:

python -m metacatalog migrate revision

That will include and add all needed files and you just need to update the file.

Which table would I have to change in metacatalog for the new EntryGroup?

For this revision, you don't change any Table. You need to add a new entry. Have a look at rev3.py, where Person.uuid is updated. This is how you can add a new entry. Alternatively, you can write the plain SQL and execute it. The SQL for adding is similar to:

INSERT into entrygroup_types (name, description) values ('Split dataset', 'Lorem Ipsum ..')

The downgrade command should remove this entry again:

DELETE FROM entrygroup_types where name='Split dataset';

Best,

mmaelicke commented 3 years ago

Perfect! I just merged this

mmaelicke commented 3 years ago

BTW.: It's really important to implement the SQL like you did it and not to rely on id fields. They are usually autofilled, and differ on the different systems. You can run the python -m metacatalog migrate downgrade and then the python -m metacatalog migrate upgrade command. After that, the new entry has another id... Just to give you some background.