Creates a table view from an input table or feature class. The table view that is created is temporary and will not persist after the session ends unless the document is saved.
The input table or feature class.
Table NameThe name of the table view to be created.
ExpressionAn SQL expression used to select a subset of records.
Output WorkspaceThis parameter is not used.
In ArcGIS Desktop , output field names are validated based on this workspace. In ArcGIS Pro , this tool does not support changing the field names because table views do not support field names that differ from the underlying data source.
Field InfoThe fields from the input table that will be included in the output layer. You can remove input fields by setting them to not visible. Renaming fields and the use of split policies are not supported.
arcpy.management.MakeTableView(in_table, out_view, , , )
The input table or feature class.
The name of the table view to be created.
where_clauseAn SQL expression used to select a subset of features. For more information on SQL syntax see the help topic SQL reference for query expressions used in ArcGIS.
This parameter is not used.
In ArcGIS Desktop , output field names are validated based on this workspace. In ArcGIS Pro , this tool does not support changing the field names because table views do not support field names that differ from the underlying data source.
field_infoThe fields from the input table that will be included in the output layer. You can remove input fields by setting them to not visible. Renaming fields and the use of split policies are not supported.
The following Python window script demonstrates how to use the MakeTableView function in immediate mode.
import arcpy arcpy.management.MakeTableView("C:/data/input/crimefrequency.dbf", "crimefreq_tview")
MakeTableView example 2 (stand-alone script)
The following stand-alone script demonstrates how to use MakeTableView with a FieldInfo object to filter fields in the output.
# Name: MakeTableView_Example2.py # Description: Uses a FieldInfo object to select a subset of fields and use with MakeTableView # Import system modules import arcpy # Set data path intable = "C:/data/tables.gdb/crimefreq" # Get the fields from the input fields= arcpy.ListFields(intable) # Create a fieldinfo object fieldinfo = arcpy.FieldInfo() # Iterate through the input fields and add them to fieldinfo for field in fields: if field.name == "CRIME_ADDRESS": # Make the CRIME_ADDRESS field hidden fieldinfo.addField(field.name, field.name, "HIDDEN", "") else: fieldinfo.addField(field.name, field.name, "VISIBLE", "") # The created crime_view layer will have fields as set in fieldinfo object arcpy.management.MakeTableView(intable, "crime_view", "", "", fieldinfo) # Persist the view to a table arcpy.management.CopyRows("crime_view", "C:/data/tables.gdb/crime_copy")