Select to view content in your preferred language

Is there a tool or application in AGOL to schedule backups periodically of a hosted feature layer

286
5
08-29-2024 06:54 AM
SanchezNuñez
Frequent Contributor

Good morning

Is there a tool or application in AGOL to schedule backups periodically of a hosted feature layer?

I would like to backup daily 3 hosted feature layers.

Thanks

 

0 Kudos
5 Replies
MobiusSnake
MVP Regular Contributor

I use a notebook to do this, it's scheduled to run daily.  It writes all of the backup FGDBs to a single folder, and during each run it scans that folder for backups older than a certain number of days and deletes them.

0 Kudos
SanchezNuñez
Frequent Contributor

Thank you @MobiusSnake 

Is there a way you  can share your Notebook code?

Thank you

0 Kudos
MobiusSnake
MVP Regular Contributor

Not really unfortunately, but at a high level it does this:

  • I have a hosted feature layer with a table that acts as a backup list, each hosted feature layer to be backed up has a row in this table with the layer's Item ID (this could also be achieved by a list in the code)
  • The notebook reads this configuration table to find all the Item IDs
  • For each Item ID, it gets the item from the content manager and then calls export()

For logging, I use another hosted feature layer table with a string field and a timestamp.  (I also have a dashboard for displaying/filtering logs, as well as email notifications for any errors above a certain severity, but those parts are nice-to-haves, not really necessary.)

0 Kudos
RhettZufelt
MVP Notable Contributor

I use the code that @Tom_Laue posted here.

I like it as it only backs up HFS's that have the appropriate tag so I have more control of what gets backed up.

I also use the JSON backup script from the same post for certain items.

R_

0 Kudos
PeterKnoop
MVP Regular Contributor

As others have noted, an ArcGIS Notebook is an easy way to automate backups of hosted feature layers as file geodatabases.

Depending on your requirements, you might want to backup your data to an external system, so that you have a backup, should something happen to ArcGIS Online. For example, you could backup your hosted feature layers to Dropbox, as illustrated in this example Notebook: Backup to Dropbox. You could just as easily use Google Drive, Microsoft OneDrive, or another storage option, by substituting the appropriate code for your preferred storage solution.

0 Kudos