Make Table View (Data Management)

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.

Usage

Parameters

Input Table

The input table or feature class.

Table Name

The name of the table view to be created.

Expression

An SQL expression used to select a subset of records.

Output Workspace

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 Info

The 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_clause

An 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_info

The 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.

Code sample

MakeTableView example 1 ( Python window)

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")

Environments

Licensing information