Select to view content in your preferred language

How to Preserve Editor Tracking Info when uploading FL via Python

169
1
Jump to solution
08-02-2024 02:46 AM
JosephHilliard94
Occasional Contributor

Hi there,

I have been adding a geodatabase to ArcGIS Online using the ArcGIS API for Python as my geodatabase is too large to publish via out of the box tools in Pro. Then I am publishing using that geodatabase item via the API. I need to be able to retain all the editor tracking info (which you can do out of the box in Pro) but I cannot work out what you have to specify in the publish parameters. I have seen other threads in the community such as this one - Solved: Publishing to AGOL overwrites editor tracking data - Esri Community but I cannot get this line of code to work (as it only seems to be available as in the response in the API documentation):

pub_params = {"editorTrackingInfo" : {"enableEditorTracking":'true', "preserveEditUsersAndTimestamps":'true'}}

 

Any help would be greatly appreciated! 

Joe

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JosephHilliard94
Occasional Contributor

I worked this out myself, process below if it helps anyone: 

Limitations of current methods for large feature services:

  • ArcGIS Pro – Publish will timeout.
  • Using ArcGIS API for Python Add & Publish – Cannot retain editor tracking information or symbology.

 

New Method

Step 1

  • Add feature classes/tables from geodatabase to ArcGIS Pro.
  • Apply symbology required for Feature Service.
  • Publish but Save as SD locally.

 

Step 2

Option 1:

  • Add SD using Add Item in ArcGIS Online.
  • Takes around 2 hours to upload so can timeout.

 

Option 2:

  • Add using ArcGIS API for Python:

 

item_props = {"type":"Service Definition",

                   "title":"Insert",

                   "tags":"Insert",

                   "description":"Insert",

                    "commentsEnabled" : False}         

 

uploaded_sd = gis.content.add(item_properties=item_props,data=sd_path,folder="insert")

 

Step 3

Using ArcGIS API for Python

  • Access the SD
  • Publish using the below parameters:

 

pub_params = {"editorTrackingInfo" : {"enableEditorTracking":'true', "preserveEditUsersAndTimestamps":'true'}}

 

source_sd.publish(publish_parameters=pub_params, overwrite="true")

 

View solution in original post

0 Kudos
1 Reply
JosephHilliard94
Occasional Contributor

I worked this out myself, process below if it helps anyone: 

Limitations of current methods for large feature services:

  • ArcGIS Pro – Publish will timeout.
  • Using ArcGIS API for Python Add & Publish – Cannot retain editor tracking information or symbology.

 

New Method

Step 1

  • Add feature classes/tables from geodatabase to ArcGIS Pro.
  • Apply symbology required for Feature Service.
  • Publish but Save as SD locally.

 

Step 2

Option 1:

  • Add SD using Add Item in ArcGIS Online.
  • Takes around 2 hours to upload so can timeout.

 

Option 2:

  • Add using ArcGIS API for Python:

 

item_props = {"type":"Service Definition",

                   "title":"Insert",

                   "tags":"Insert",

                   "description":"Insert",

                    "commentsEnabled" : False}         

 

uploaded_sd = gis.content.add(item_properties=item_props,data=sd_path,folder="insert")

 

Step 3

Using ArcGIS API for Python

  • Access the SD
  • Publish using the below parameters:

 

pub_params = {"editorTrackingInfo" : {"enableEditorTracking":'true', "preserveEditUsersAndTimestamps":'true'}}

 

source_sd.publish(publish_parameters=pub_params, overwrite="true")

 

0 Kudos