I am wondering if anyone here has guidance on best practices for updating schemas/domains for hosted feature services with views. This is the kind of thing that seems to change constantly as the platform shifts.
Context: I have a feature service that has two 'traditional' views and one joined view. In my case I'd just like to add one additional value to a single field's domain. What's the the 'correct' way to do this these days? I can think of two methods:
Any thoughts would be appreciated.
Edit: the joined view is the issue here. You have options through the GUI with traditional views but not with joined views.
Solved! Go to Solution.
Edit: If you're trying this for the first time, you should create a new service and joined view that are set up identically to the ones you're intending to modify, and experiment with that first. You can absolutely mess up your service playing around with the definition. That said, offering "redo everything" as the only workflow seems extreme to me.
@SFM_TravisBott, it looks like you may have assumed I was talking only about regular views and not joined views. I've edited my post to clarify this.
Here's my workflow for "opening up" the schema to add a new domain value to a parent layer. I'm copying it directly from a Word doc intended for my coworkers, so the formatting is a bit off but still sequential. This is for a regular, hosted, non-offline-enabled layer.
--------------------------------
After creating the joined view, you’ll notice that if you go to the Data tab of either of your source layers, the pencil icon (that indicates you can edit) is no longer there.
Updating domains in ArcGIS Online works best with a safe, step-by-step approach.
First, export schema as backup.
Then test domain edits on a copy or staging layer.
When ready, apply changes to the live layer ArcGIS will keep existing values valid, but watch out when removing codes that are still in use.
For repeatability, you can also handle updates with the ArcGIS API for Python.
Keeping a backup and testing first helps avoid surprises.
Regards,
Venkat
I may be incorrect, but I thought that overwriting services with joined AGOL views is not supported. The poster mentioned having 2 traditional views and 1 joined view. As a result, I haven't looked into joined views much at all due to some of the limitations I believe I saw.
@Tiff I think you're the only one here to read and understood the post.
There are options in the GUI to update fields for traditional views. Joined views lock everything up considerably worse.
@SFM_TravisBott - Let's break it down.
If you add a new domain then it should instantly be available in the on Feature Layer and any views you might have created from the feature layer.
If you add a new field then that involves a couple of more steps.
1) Add the new field and it will instantly become available in the feature layer.
2) This new field is also available for all the views you have created but you might need to edit the view to make this field visible.
It seems pretty low risk if you making additive change and not removing domain values or fields.
Edit - You will also need to account for Map configuration - pop-ups, etc.
@gis_KIWI4 This is not correct. The option to add fields and domains is not available with a joined view. I will edit my post to provide some emphasis.
@SFM_TravisBott, I use the second option (and very frequently, actually) to just update something like domain values for the parent layers of joined views. It feels much more efficient than breaking and re-creating views and re-sourcing whatever uses those views. I use the GUI. You can even add new fields this way, although it's trickier and I've only ever experimented (never on a live, production service).
Edit: I should say that I'm pretty sure the long way is what Esri advocates as the official workflow, though I'm not sure if that's down to just accommodating for nuances, or what the deal is.
Edit: If you're trying this for the first time, you should create a new service and joined view that are set up identically to the ones you're intending to modify, and experiment with that first. You can absolutely mess up your service playing around with the definition. That said, offering "redo everything" as the only workflow seems extreme to me.
@SFM_TravisBott, it looks like you may have assumed I was talking only about regular views and not joined views. I've edited my post to clarify this.
Here's my workflow for "opening up" the schema to add a new domain value to a parent layer. I'm copying it directly from a Word doc intended for my coworkers, so the formatting is a bit off but still sequential. This is for a regular, hosted, non-offline-enabled layer.
--------------------------------
After creating the joined view, you’ll notice that if you go to the Data tab of either of your source layers, the pencil icon (that indicates you can edit) is no longer there.
@NicoleJohnson Well shoot dang! You're right that I didn't read carefully - you specifically mention joined views in your post.
I used your technique and it worked perfectly. Previously I've done it by going through the REST endpoint for the parent layer, and I had never come at it from the view itself. Seems to have worked fine. Thank you!
An additional edit - Below is from Esri support services:
It was a pleasure speaking with you earlier, and I understand you need assistance with joined view layers in ArcGIS Online. I have included a brief recap of what we have discussed during our screen share session:
- You created a joined view layer using a left join in ArcGIS Online and successfully published the view.
- Upon attempting to edit data via the Data tab, you found that there was no option to edit fields.
- This is expected behavior, as editing is disabled by default for joined view layers in ArcGIS Online.
- Additionally, fields from the joined (right) layer are read-only by design and cannot be edited.
- You attempted to work around this by accessing the REST endpoint of the view layer.
- You used the Update Definition operation to change sourceSchemaChangesAllowed from false to true.
I just reviewed the workaround on my end, and I wanted to share that updating the service definition in this way is not a recommended approach. While it may be technically possible to make this change, there are several important risks and limitations to consider:
- Joined views are not designed for editing, and forcing edits can lead to unexpected behavior, such as broken relationships or schema mismatches.
- In ArcGIS Online, joined hosted feature layer views can prevent schema modification of the underlying feature layers. This means you can't add or remove fields, or alter domains, in the source layers while the view exists. This ensures data integrity
- If issues arise as a result of this modification, technical support may be limited, as the workaround involves changing internal service properties that are not officially supported.
- Alternative Suggestion: If schema changes are required, a safer approach would be to temporarily delete the joined view, apply the necessary schema updates to the source layers, and then recreate the join view afterward.
Please let me know if you'd like help exploring this option or if you have any further questions.
A note to Esri - Consider a) providing a warning when creating a joined view that your schema will be locked; b) make it possible to update a joined view. I bet you could if you really put your mind to it.