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 |
None
|
Returns:
| Type | Description |
|---|---|
FieldsResult
|
A new FieldsResult containing only the fields that satisfy every |
FieldsResult
|
supplied criterion. |
Raises:
| Type | Description |
|---|---|
InvalidParameterError
|
If both |
InvalidParameterError
|
If any value in |
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.
Built only by applyEdits: _merge sets every item's kind and
position (its row in that kind's input frame), and the operation
stores each kind's input frame in _inputs (in adds, updates, deletes
order). _inputs is excluded
from equality and repr.
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.
filter(*, kinds=None, statuses=None)
Return a new ApplyEditsResult keeping only items matching all criteria.
The input frames are carried over, so the filtered result still maps its items back to their input rows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kinds
|
EditKind | list[EditKind] | None
|
Keep only these kinds ( |
None
|
statuses
|
EditStatus | list[EditStatus] | None
|
Keep only items with these statuses ( |
None
|
Returns:
| Type | Description |
|---|---|
ApplyEditsResult
|
A new ApplyEditsResult; kinds that are filtered out have no items. |
Raises:
| Type | Description |
|---|---|
InvalidParameterError
|
If any kind or status is not a valid value. |
from_esri_response(body)
classmethod
Parse a single synchronous applyEdits response body.
.. deprecated::
Internal to applyEdits; will be removed in 2.0. Results come from
FeatureLayer edit methods.
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.
.. deprecated:: Internal to applyEdits batching; will be removed in 2.0.
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. |
to_frame(*, include_input=True, include_metadata=True, metadata_prefix='_edit_')
Return one row per edit, in adds, updates, deletes order.
With include_input, each row is the input row the edit came from,
with its original index: for append / upsert / sync, rows
of the df passed in (upsert / sync updates also carry the
matched OBJECTID); for apply_edits, rows of adds / updates
/ deletes. Deletes given as OBJECTIDs are rows of a one-column
OBJECTID frame; sync deletes hold the OBJECTID and key fields.
Combine with filter to get some rows, e.g.
result.filter(statuses="failed").to_frame().
Metadata columns: kind and status (categoricals of the
EditKind / EditStatus values), object_id (-1 when ESRI
reports none, e.g. a failed add), global_id, position (the
row's position in its input frame), then each error dict flattened
into error_<snake_case_key> columns. error_code,
error_description, error_exception, error_outcome_unknown,
and error_status_url are always present; other keys (e.g.
extendedCode, message, details from a rolled-back batch)
add columns as they appear. error_description holds readable text
for every failure: when ESRI sent none, message and details
joined.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include_input
|
bool
|
Include the input row of each edit. |
True
|
include_metadata
|
bool
|
Include the metadata columns. Alongside input
rows they are prefixed with |
True
|
metadata_prefix
|
str
|
Prefix for metadata columns when
|
'_edit_'
|
Returns:
| Type | Description |
|---|---|
DataFrame | GeoDataFrame
|
The DataFrame described above; a GeoDataFrame when an input frame |
DataFrame | GeoDataFrame
|
is one (rows without geometry, such as deletes, get null |
DataFrame | GeoDataFrame
|
geometry). |
Raises:
| Type | Description |
|---|---|
InvalidParameterError
|
If both |
archibald.models.EditResultItem
dataclass
Single per-feature result from an applyEdits or addAttachment operation.
Attributes:
| Name | Type | Description |
|---|---|---|
object_id |
int
|
OBJECTID ESRI reported, or -1 when there is none (e.g. a failed add). |
global_id |
str | None
|
GlobalID ESRI reported, if any. |
success |
bool
|
Whether the edit succeeded. |
error |
dict | None
|
Raw ESRI error dict when |
kind |
EditKind | None
|
Which applyEdits list the item belongs to; None for attachment results. |
position |
int | None
|
Row position of the item's source row in the input frame for its kind; None for attachment results. |
status
property
"succeeded", "unknown" when the server may have applied it anyway,
else "failed".
Failures carrying an ESRI error dict have no outcome_unknown key and
are therefore "failed": the server definitively rejected them.
archibald.models.EditKind = Literal['adds', 'updates', 'deletes']
module-attribute
Kind of edit an applyEdits result item belongs to.
archibald.models.EditStatus = Literal['succeeded', 'failed', 'unknown']
module-attribute
Outcome of a single edit, derived from success and error.