Friday, June 15, 2012

Introducing the Data Access Module (arcpy.da) at 10.1

The data access module also known as arcpy.da is used to manipulate and search data.  It allows control of an edit session, faster and better cursor support, function to convert to and from numpy arrays, and supports versioning, replicas, domains, and subtypes work flows.

The data access module has the following functions:

  • ExtendTable - Joins the content of a numpy array based on a common attribute field.  This is like a table join but more flexible.
  • FeatureClassToNumPyArray - this convert a feature class to a numpy structured array
  • ListDomains - Lists the attribute domains in a geodatabase
  • ListReplicas - Lists replicas in a work space
  • ListSubtypes - returns a dictionary of subtypes for a table or feature class
  • ListVersions - list the versions in the work space
  • NumPyToFeatureClass - converts a numpy array to a point feature class
  • NumPyToTable - converts a numpy array to a table
  • TableToNumPyArray - converts a table to numpy array

The data access classes:

  • Domain - the domain object properties that describes an attribute domain
  • Editor - editor class allows use of edit sessions and operations to manage database transactions.  This means rollbacks, and better error handling!
  • InsertCursor - adds new rows to a table or feature class
  • Replica - contains properties of a replica
  • SearchCursor - read only access to a table or feature class
  • UpdateCursor - allows read/write access to a table or feature class.  This is what you use to update or delete a row.
  • Version - contains properties that describe a version.

I plan on detailing these items in future posts.