Good morning,
I am looking for a source code in arcpy python to append specific records from one source feature class in SDE or FGDB to a target hosted feature class in AGOL.
The hosted feature class has more fields that the source.
Thanks
You can use ArcPy and the Append tool for this. See docs here.
Your target is the URL to the Feature Layer in AGOL.
You can either use field mapping to map fields or you can set to NO_TEST. NO_TEST will append in where fields match from source to target and skip fields with no match.
I would recommend performing on a test feature layer first to see it in action.
You could also setup to use the Append tool manually in ArcGIS Pro and then use the Copy Python Command option (dropdown arrow attached to the Run button) and copy the code snippet into a script to see the syntax in use. This is also a good way to grab the code if you have setup the Field Matches.