0

I use ArcPy's MakeXYEventLayer_management and FeatureClassToFeatureClass_conversion tools to generate a feature class from a CSV file.

I host this layer on a SQL Server Enterprise Geodatabase, and I typically just delete the old feature class and import the new feature class manually using Catalog.

I am wondering about the recommended practices when writing a model or script.

Would it be preferable to use arcpy.management.DeleteFeatures for the existing feature class, then arcpy.conversion.FeatureClassToGeodatabase to reload the new feature?

4
  • I generally try to avoid all the processing overhead, and just load the CSV into a table directly (arcpy.da.InsertCursor). If there's a need for continuous access, I load the data into a second table, use SQL to distinguish between inserted, updated, and deleted rows, then apply the changes to the original table. in a single transaction. This way I don't have six-digit ID vales in SDE.sde_table_registry. If the feature class can support down time, then TruncateTable and Append can be used to good effect.
    – Vince
    Dec 28, 2021 at 19:28
  • What happened when you tried the alternative method?
    – PolyGeo
    Dec 28, 2021 at 20:24
  • @Vince Using (arcpy.da.InsertCursor) wouldn't update the geometry of the feature class though right? Dec 29, 2021 at 17:00
  • InsertCursor doesn't "update" anything, it only INSERTs. Constructing geometries from that which would be an event layer is barely more than a single line of code.
    – Vince
    Dec 29, 2021 at 17:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.