How to read data from hosted feature layer programmatically

98
2
08-14-2022 02:34 AM
StephenKaranja
New Contributor III

Hello,

I'd like to read the data in a hosted feature layer and store it in an external SQL database table. I'd like to do this programmatically through the use of a script. How should I go about doing this?

Thanks.

Tags (1)
0 Kudos
2 Replies
GeoJosh
Esri Contributor

Hi Stephen! The ArcGIS API for Python would be great for this use case. Here's a rough outline of how you'd read the data: 

  1. Get the hosted feature layer by item ID (gis.content.get)
  2. Query the hosted feature layer and return the query results in a spatial data frame. (arcgis.features.FeatureLayer.query)
  3. Store in your enterprise geodatabase.

You can see the Python API in action in these sample notebooks.

0 Kudos
StephenKaranja
New Contributor III

Thanks a lot for your response. I'll look into the ArcGIS API for Python to determine whether it will solve the problem I have.

0 Kudos