cursor
Cursor Helper module
Field
¶
Bases: TypedDict
Field Representation
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field_type
|
FieldType
|
The type of the field (required) |
required |
field_precision
|
int
|
The precision (digits) of numeric fields (default: database determined) |
required |
field_scale
|
int
|
The number of decimal places for floating point fields (default: database determined) |
required |
field_length
|
int
|
The maximum character count for |
required |
field_alias
|
str
|
Human readable alias for fields with confusing internal names (optional) |
required |
field_is_nullable
|
bool
|
Allow null values (default: |
required |
field_is_required
|
bool
|
Field requires a value to be set (default: False) |
required |
field_domain
|
str
|
Existing Domain name to bind to field (optional) |
required |
Source code in src/arcpie/cursor.py
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
|
InsertOptions
¶
Bases: TypedDict
Optional parameters for InsertCursors
Source code in src/arcpie/cursor.py
184 185 186 187 |
|
SQLClause
¶
Bases: NamedTuple
Wrapper for Cursor sql_clause attribute,
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prefix
|
str
|
The SQL prefix to be prepended to the |
required |
postfix
|
str
|
The SQL postfix that will be appended to the |
required |
Format
SELECT {prefix} {fields} FROM {table} WHERE {where_clause} {postfix}
Usage
>>> five_longest = SQLClause(prefix='TOP 5', postfix='ORDER BY LENGTH DESC')
>>> fc_result = feature_class.get_tuples(('NAME', 'LENGTH'), sql_clause=five_longest))
>>> print(list(fc_result))
[('foo', 1001), ('bar', 999), ('baz', 567), ('buzz', 345), ('bang', 233)]
Source code in src/arcpie/cursor.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
|
SearchOptions
¶
Bases: TypedDict
Optional parameters for SearchCursors
Parameters:
Name | Type | Description | Default |
---|---|---|---|
where_clause
|
str
|
A SQL query that is inserted after the SQL |
required |
spatial_reference
|
str | int | SpatialReference
|
Perform an on the fly projection of the yielded geometry to this reference |
required |
explode_to_points
|
bool
|
Return a row per vertex in each feature (e.g. |
required |
sql_clause
|
SQLClause
|
A tuple of SQL queries that is inserted after the SQL
|
required |
datum_transformation
|
str
|
The transformation to use during projection if there is a datum difference between the feature projection and the
target SpatialReference (you can use |
required |
spatial_filter
|
Geometry
|
A shape that will be used to test each feature against using the specified |
required |
spatial_relationship
|
SpatialRelationship
|
The type of relationship with the |
required |
search_order
|
SearchOrder
|
Run the |
required |
Returns:
Type | Description |
---|---|
dict
|
A dictionary with the populated keys |
Usage
>>> options = SearchOptions(where_clause='OBJECTID > 10')
>>> not_first_ten = feature_class.get_tuples(['NAME', 'LENGTH'], **options)
>>> print(list(not_first_ten))
[('cleese', 777), ('idle', 222), ('gilliam', 111), ...]
Source code in src/arcpie/cursor.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
|
UpdateOptions
¶
Bases: TypedDict
Optional parameters for UpdateCursors
Source code in src/arcpie/cursor.py
189 190 191 192 193 194 195 196 197 198 199 200 201 |
|
WhereClause
¶
Source code in src/arcpie/cursor.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
__init__(where_clause, skip_validation=False)
¶
Object for storing and validating where clauses
Parameters:
Name | Type | Description | Default |
---|---|---|---|
where_clause
|
str
|
The where clause that you want to pass to a FeatureClass |
required |
skip_validation
|
bool
|
Skip the validation step (default: False) |
False
|
Source code in src/arcpie/cursor.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
get_fields(clause)
¶
Sanitize a where clause by removing whitespace
Source code in src/arcpie/cursor.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
validate(fields)
¶
Check to see if the clause fields are in the fields list
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fields
|
Sequence[str]
|
The fields to check against |
required |
Source code in src/arcpie/cursor.py
113 114 115 116 117 118 119 |
|