TableToArrowTable

Synthèse

Converts a table or feature class to an Apache Arrow table.

Discussion

Apache Arrow is a standard cross-platform in-memory representation of columnar data used to efficiently transport data between analytics systems for big data. For more information, see Apache Arrow in ArcGIS.

Syntaxe

TableToArrowTable (in_table, {field_names}, {where_clause}, {geometry_encoding})
ParamètreExplicationType de données
in_table

The feature class, layer, table, or table view.

String
field_names
[field_names,...]

A list (or tuple) of field names. For a single field, you can use a string instead of a list of strings.

(La valeur par défaut est "")

String
where_clause

An optional expression that limits the records returned. For more information on WHERE clauses and SQL statements, see SQL reference for query expressions used in ArcGIS.

(La valeur par défaut est "")

String
geometry_encoding

Specifies the geometry encoding of the geometry column in the resulting Arrow table.

  • ESRISHAPENative binary geometry encoding
  • ESRIJSONNative JSON format geometry encoding
  • GEOJSONOpen standard JSON format geometry encoding.
  • WKTWell-known text (WKT) geometry encoding.
  • WKBWell-known binary (WKB) geometry encoding
Remarque :

If no geometry field is specified in the field_names argument or the in_table value is a non-spatial table, this argument will be ignored. In both cases, the resulting Arrow table will not contain a geometry column.

(La valeur par défaut est ESRISHAPE)

String
Valeur renvoyée
Type de donnéesExplication
PyArrowTable

The output pyarrow.Table. See the pyarrow.Table object API.

Exemple de code

TableToArrowTable example 1

Convert a feature class to an Arrow table and count the number of counties in the dataset.

import arcpy

input = r'C:\data\usa.gdb\USA\counties'
arrow_table = arcpy.da.TableToArrowTable(input)

# Get the number of counties in the dataset
count = arcpy.management.GetCount(arrow_table)
print(f"Number of US Counties: {count}")
TableToArrowTable example 2

Convert a feature class to an Arrow table with the WKT geometry encoding.

import arcpy

input = r'C:\data\usa.gdb\USA\counties'
arrow_table = arcpy.da.TableToArrowTable(input, geometry_encoding="WKT")

Rubriques connexes