Select to view content in your preferred language

Scrape AGOL and Populate SDE Feature Classes

396
2
12-18-2023 07:07 AM
kapalczynski
Occasional Contributor III
  1. I have a couple Feature Classes and 9 Tables in AGOL.  The FC are related to the Tables.
  2. I have these 2 FC and Tables in my oracle SDE environment.
  3. I need to grab the data from AGOL and populate the SDE datasets WHILE retaining the GLOBALIDs.

What is the best mechanism to do this?

I do not think you can export a FGDB and retain the GLOBALIDs????

 

0 Kudos
2 Replies
EarlMedina
Esri Regular Contributor

I think I had to do this once. I'm not positive, but I think the process was something like this:

  1. Use Create Replica to download the data
  2. Run Append with the "Preserve Global IDs" environment setting.

The limitation is going to be with #2. I believe eGDB appended to FGDB doesn't work, but not sure about FGDB to eGDB. You may need to experiment with a test case.

0 Kudos
RhettZufelt
MVP Notable Contributor

Have not tried with tables, but for my HFS's, I make a list of the GLOBAL ID's in the HFS, and another list of the GLOBAL ID's in my SDE data.  Then, if the GID is in the HFS, but NOT in the SDE data, add that to a separate list that I can iterate through later.(AddPostList).

I then iterate through that list and append the data from the HFS to my SDE FC making sure to use the preserveGlobalIDs=True.

 

L1Post = r"https://services3.arcgis.com/onlinesource/FeatureServer/1"
Post = r'Database Connections\SignDatabase.sde\SignsDatabase.DBO.Posts'

with arcpy.EnvManager(preserveGlobalIds=True, scratchWorkspace=r"\\pathto\scratch.gdb", workspace=r"\\pathto\Default.gdb"):
       Post = arcpy.management.Append(inputs=[L1Post], target=Post, schema_type="TEST", field_mapping="", subtype="", expression="GlobalID IN ('" + '\',\''.join(AddPostList) + "')")[0]

 

 

This will keep the GLOBALID and the attachments as it copies them into the SDE data.

R_

0 Kudos