Use a SQL expression inside a Python or Arcade field calculation

229
0
04-24-2023 08:23 AM
Status: Open
Labels (1)
Bud
by
Notable Contributor

ArcGIS Pro 3.1.1

  • Mobile geodatabase,
  • File geodatabase,
  • Or enterprise geodatabase that is registered as versioned; option to move edits to base (SQL field calculations not supported on versioned data):

For cases where we would rather use SQL than Python or Arcade:
Could functionality be added so that we can generate a value using a SQL expression -- that would be returned back to the Field Calculator geoprocessing tool?

 

Bud_0-1682349649755.png


For example, if I already have a complex SQL CASE expression written from a different use case, I don't want to re-write it in Python or Arcade. I'd rather just use the SQL as-is instead, to save time and avoid mistakes.

I'm aware that it's possible to create a SQL database view, join it to the FC attribute table, and do a field calculation to bring in the joined field value. But that's pretty cumbersome for a one-off calculation. So I'm wondering if we could use the SQL expression directly in a Python or Arcade field calculation instead.

 

Related ideas: