Repository navigation
adds support for reference datatype to node value/display value functions - #13071
Merged
Merged
Conversation
ekansa
approved these changes
Oct 27, 2026
ekansa
left a comment
There was a problem hiding this comment.
I think it works! I will need to run the ETL to fully check.
When I create the relational views using this branch nodes with the Arches reference datatype correctly have the PostgreSQL jsonb datatype. The relation views for the models create without error.
|
@robgaston I checked and the this update also works for ETL workflow. I confirmed can |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Types of changes
Description of Change
__arches_get_node_value_sqlhad no mapping for thereferencedatatype, so relational views typed reference nodes astext. Reading a reference node through the view gave a JSON string instead ofjsonb. Writing through the view was worse:__arches_get_json_data_for_viewcallsto_json()on the column, so a value inserted or updated through the view was stored in the tile as a quoted JSON string, not an array.This PR:
referencetojsonbin__arches_get_node_value_sql, which fixes both reading and writing.referencebranch to__arches_get_node_display_value. It returns the item labels joined with,and uses the existing__arches_controlled_lists_get_reference_label_listhelper from the controlled_lists extension (migration 0006). Reference nodes can only exist when that extension is installed, so core only calls the helper for those nodes.13064_reference_datatype_relational_views, generated throughdjango_migrate_sqlfrom the.sqlfiles.Note on display values: the SQL helper looks up the current labels in the list item tables.
ReferenceDataType.get_display_valueuses the copy of the labels saved in the tile data. If a list item is renamed after it has been used in a tile, the two will show different labels.Note on the error in the issue: the
column ... does not existerror came from a local override of__arches_get_node_value_sqlthat still named columns__arches_slugify(node.name). Since #12773, views name their columns by node alias. Projects that override this function to work around the missingreferencemapping should drop the override after upgrading. (@ekansa)Issues Solved
Closes #13064
Checklist
Accessibility Checklist
Developer Guide
Further comments
New tests in
tests/models/relational_data_model_tests.py:test_reference_column_round_trips_as_jsonbchecks that the view column isjsonband that a reference value inserted through the view is stored in the tile as an array.test_reference_display_valuechecks that__arches_get_node_display_valuereturnsFirst, Secondfor two references.Both tests fail against
dev/8.2.xand pass with this change.The fixture node sets
pgDatatype: jsonb, which skips the datatype mapping entirely, so the tests clear the node's config when switching it toreference.