Skip to content

Models

archibald.models.QueryResult dataclass

Aggregated features and metadata from a query operation.

Provides access to raw features and field definitions, plus conversion methods to DataFrame and GeoDataFrame. The fields attribute carries both field names and ESRI type metadata for the fields returned by the query (filtered to only those that were requested).

to_frame(*, parse_dtypes=False)

Return attributes only as a pandas DataFrame.

Parameters:

Name Type Description Default
parse_dtypes bool

If True, convert columns to their appropriate pandas types based on the ESRI field type metadata. Dates become UTC-aware datetimes, integer fields become nullable integer types, etc. Defaults to False.

False

Returns:

Type Description
DataFrame

DataFrame with one row per feature, columns from attributes.

to_geodataframe(*, parse_dtypes=False)

Return attributes + geometry as a geopandas GeoDataFrame.

Parameters:

Name Type Description Default
parse_dtypes bool

If True, convert attribute columns to their appropriate pandas types based on the ESRI field type metadata. The geometry column is always preserved unchanged. Defaults to False.

False

Returns:

Type Description
GeoDataFrame

GeoDataFrame with one row per feature.

Raises:

Type Description
MissingGeometryError

If the query returned no geometries.

archibald.models.FieldsResult dataclass

Layer field definitions and metadata from ESRI response.

Provides access to field names (all or editable-only) and field definitions as a DataFrame.

domain_maps property

Return code↔name lookup tables for all coded-value domain fields.

Returns a dict keyed by field name. Each value contains: - "to_name": maps raw domain codes to human-readable names. - "to_code": maps human-readable names back to raw codes.

Fields without a codedValue domain are omitted.

field_type_map property

Mapping of field names to their ESRI type strings.

names property

All field names in definition order.

filter(*, names=None, types=None, editable=None, nullable=None)

Return a new FieldsResult matching all supplied criteria.

names and types are mutually exclusive. Boolean filters (editable, nullable) may be combined with either.

Parameters:

Name Type Description Default
names list[str] | None

Retain only fields whose name is in this list.

None
types list[str] | str | None

Retain only fields whose ESRI type matches. Accepts a single type string or a list of type strings. Types align with ESRI field types from the REST API, e.g. "esriFieldTypeString", "esriFieldTypeInteger", etc.

None
editable bool | None

If True, retain only editable fields; if False, only non-editable.

None
nullable bool | None

If True, retain only nullable fields; if False, only non-nullable. Fields without a nullable key are treated as nullable.

None

Returns:

Type Description
FieldsResult

A new FieldsResult containing only the fields that satisfy every

FieldsResult

supplied criterion.

Raises:

Type Description
InvalidParameterError

If both names and types are provided.

InvalidParameterError

If any value in types is not a valid ESRI field type.

to_frame()

Return field definitions as a DataFrame (one row per field).

archibald.models.ApplyEditsResult dataclass

Aggregated add/update/delete results across all applyEdits batches.

Per-feature errors are captured in result items rather than raised as exceptions. Inspect has_failures and failed_* properties to detect partial failures without iterating manually.

failed_adds property

Add results where success=False.

failed_deletes property

Delete results where success=False.

failed_updates property

Update results where success=False.

has_failures property

True if any add, update, or delete result reports success=False.

from_esri_response(body) classmethod

Parse a single synchronous applyEdits response body.

Parameters:

Name Type Description Default
body dict

Parsed JSON response dict from the applyEdits endpoint.

required

Returns:

Type Description
ApplyEditsResult

ApplyEditsResult populated from addResults, updateResults, deleteResults.

merge(results) classmethod

Merge multiple per-batch ApplyEditsResults into one aggregate.

Parameters:

Name Type Description Default
results list[ApplyEditsResult]

List of per-batch results in posting order.

required

Returns:

Type Description
ApplyEditsResult

Single ApplyEditsResult with all items concatenated in order.

archibald.models.EditResultItem dataclass

Single per-feature result from an applyEdits operation.