[SYNPY-1859] When creating entity views for Curator, the name column now goes first#1410
[SYNPY-1859] When creating entity views for Curator, the name column now goes first#1410andrewelamb wants to merge 6 commits into
Conversation
| view.reorder_column(name="name", index=0) | ||
| view.reorder_column(name="id", index=0) | ||
| view.reorder_column(name="name", index=0) | ||
| view.store(synapse_client=syn) |
There was a problem hiding this comment.
Is it possible to set the first three columns all at once? As the code, it seems the name,id and createdBy are the first three columns.
There was a problem hiding this comment.
Can we try what Dan suggested? Also, if this pattern comes up more often, I would recommend adding a function so that we could change the column order in bulk rather than calling reorder_column and changing the order one at a time
There was a problem hiding this comment.
So, as far as I can tell, currently there is no function that does this in one line for OrderedDicts.
There was a problem hiding this comment.
I rewrote it to be more readable.
| ) | ||
| assert isinstance(entity, (Folder, Project)) | ||
| jsb = entity.get_schema() | ||
| jsb = entity.get_schema(synapse_client=syn) |
There was a problem hiding this comment.
Nit: we don't have to do synapse_client=syn here?
There was a problem hiding this comment.
| @@ -0,0 +1,137 @@ | |||
| """Integration tests for create_file_based_metadata_task.""" | |||
There was a problem hiding this comment.
There was a problem hiding this comment.
This has been fixed in the other PR.
Problem:
When Curator created an entity view (via
create_json_schema_entity_viewinfile_based_metadata_task.py), the columns were reordered so that ["id", "name", "createdBy"] were the first columns. It has been requested that "name" go first.Solution:
Changed the order of the
reorder_columncalls so thatnameis moved to index 0 last and therefore ends up first.Testing:
unit_test_curator.py) to assert the exactreorder_columncall sequence (id,createdBy,name) rather than just asserting each call happened in any order, so the column ordering is now actually verified.tests/integration/.../test_file_based_metadata_task.py) that creates a real JSON schema, folder, and file-based metadata task, then asserts that the resulting EntityView and CurationTask are created and that the leading columns are ordered["name", "createdBy", "id"].