Skip to content

[SYNPY-1859] When creating entity views for Curator, the name column now goes first#1410

Open
andrewelamb wants to merge 6 commits into
developfrom
SYNPY-1859
Open

[SYNPY-1859] When creating entity views for Curator, the name column now goes first#1410
andrewelamb wants to merge 6 commits into
developfrom
SYNPY-1859

Conversation

@andrewelamb

@andrewelamb andrewelamb commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Problem:

When Curator created an entity view (via create_json_schema_entity_view in file_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_column calls so that name is moved to index 0 last and therefore ends up first.

Testing:

  • Updated the existing unit test (unit_test_curator.py) to assert the exact reorder_column call sequence (id, createdBy, name) rather than just asserting each call happened in any order, so the column ordering is now actually verified.
  • Added an integration test (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"].

@andrewelamb andrewelamb requested a review from a team as a code owner June 19, 2026 16:05
@andrewelamb andrewelamb marked this pull request as draft June 19, 2026 16:05
@andrewelamb andrewelamb marked this pull request as ready for review June 19, 2026 16:17
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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, as far as I can tell, currently there is no function that does this in one line for OrderedDicts.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rewrote it to be more readable.

@danlu1 danlu1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

)
assert isinstance(entity, (Folder, Project))
jsb = entity.get_schema()
jsb = entity.get_schema(synapse_client=syn)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: we don't have to do synapse_client=syn here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -0,0 +1,137 @@
"""Integration tests for create_file_based_metadata_task."""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been fixed in the other PR.

@andrewelamb andrewelamb requested a review from linglp June 22, 2026 15:19
@thomasyu888 thomasyu888 requested a review from BryanFauble June 22, 2026 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants