com.esri.arcgis.geoprocessing.tools.datamanagementtools
Class MakeQueryTable
java.lang.Object
com.esri.arcgis.geoprocessing.AbstractGPTool
com.esri.arcgis.geoprocessing.tools.datamanagementtools.MakeQueryTable
- All Implemented Interfaces:
- GPTool
public class MakeQueryTable
- extends AbstractGPTool
This tool applies an SQL query to a database and the results are represented in a layer or table view. The query can be used to join several tables or return a subset of columns or rows from the original data in the database.
The Make Query Table tool is contained in the Data Management Tools tool box.
Usage tips:
- The layer that is created by the tool is temporary and will not persist after the session ends unless the document is saved.
- All input feature classes or tables must be from the same input workspace.
- If a Shape column is added to the field list, the result is a layer; otherwise, it is a table view.
- If the output result is a layer, it may be persisted to a layer file using the tool or to a feature class using the tool.
- The order of the fields in the field list indicates the order the fields will appear in the output layer or table view.
- The tool allows you to provide a key field option and key fields list. This information defines how rows are uniquely identified and is used to add a dynamically generated ObjectID column to the data. Without an ObjectID column, selections will not be supported.
- The key fields list lets you choose several columns if the combination of these columns is needed to define unique values.
- If an SQL expression is used but returns no matching records, the output feature class will be empty.
- Feature classes can be joined, but the fields list must contain at most one field of type geometry. If you add more than one geometry column, the tool will display an error when you click OK and execution will stop.
- For details on the syntax for the Expression parameter, see or .
- The Fields and Key Fields parameters' Add Field button is used only in ModelBuilder. In ModelBuilder, where the preceding tool has not been run, or its derived data does not exist, the Fields and Key Fields parameters may not be populated with field names. The Add Field button allows you to add expected field(s) so you can complete the Make Query Table dialog box and continue to build your model.
- When input tables are from a file geodatabase, tables generally join in the order listed in the Input Tables parameter. For example, if Table1 is listed before Table2, Table2 will be joined by getting a row from Table1, then getting matching rows from Table2. However, if this would result in querying Table2 on an nonindexed field, and reversing the order would result in querying Table1 on an indexed field, the order will be reversed in an attempt to maximize performance. This is the sole query optimization logic at work when you're using file geodatabase data with this tool. In general, joins in file geodatabases perform best when they are one-to-many and one-to-one.
Constructor Summary |
MakeQueryTable()
Creates the Make Query Table tool with defaults. |
MakeQueryTable(java.lang.Object inTable,
java.lang.Object outTable,
java.lang.String inKeyFieldOption)
Creates the Make Query Table tool with the required parameters. |
Method Summary |
java.lang.Object |
getInField()
Returns the Fields parameter of this tool . |
java.lang.Object |
getInKeyField()
Returns the Key Fields parameter of this tool . |
java.lang.String |
getInKeyFieldOption()
Returns the Key Field Options parameter of this tool . |
java.lang.Object |
getInTable()
Returns the Input Tables parameter of this tool . |
java.lang.Object |
getOutTable()
Returns the Table Name parameter of this tool . |
java.lang.String |
getToolboxAlias()
Returns the alias of the tool box containing this tool. |
java.lang.String |
getToolboxName()
Returns the name of the tool box containing this tool. |
java.lang.String |
getToolName()
Returns the name of this tool. |
java.lang.Object |
getWhereClause()
Returns the Expression parameter of this tool . |
void |
setInField(java.lang.Object inField)
Sets the Fields parameter of this tool . |
void |
setInKeyField(java.lang.Object inKeyField)
Sets the Key Fields parameter of this tool . |
void |
setInKeyFieldOption(java.lang.String inKeyFieldOption)
Sets the Key Field Options parameter of this tool . |
void |
setInTable(java.lang.Object inTable)
Sets the Input Tables parameter of this tool . |
void |
setOutTable(java.lang.Object outTable)
Sets the Table Name parameter of this tool . |
void |
setWhereClause(java.lang.Object whereClause)
Sets the Expression parameter of this tool . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
MakeQueryTable
public MakeQueryTable()
- Creates the Make Query Table tool with defaults.
Initializes the array of tool parameters with the default values specified when the tool was created.
MakeQueryTable
public MakeQueryTable(java.lang.Object inTable,
java.lang.Object outTable,
java.lang.String inKeyFieldOption)
- Creates the Make Query Table tool with the required parameters.
Initializes the array of tool parameters with the values as specified for the required parameters and with the default values for the other parameters.
- Parameters:
inTable
- the name of the table or tables to be used in the query. If several tables are listed, the Expression parameter can be used to define how they are to be joined. the input table can be from an ArcSDE geodatabase, a file geodatabase, a personal geodatabase, or an OLE DB connection.outTable
- the name of the layer or table view that will be created by the tool.inKeyFieldOption
- indicates how an ObjectID field will be generated, if at all, for the query. The default is USE_KEY_FIELDS.
getInTable
public java.lang.Object getInTable()
- Returns the Input Tables parameter of this tool .
This parameter is the name of the table or tables to be used in the query. If several tables are listed, the Expression parameter can be used to define how they are to be joined. the input table can be from an ArcSDE geodatabase, a file geodatabase, a personal geodatabase, or an OLE DB connection.
This is a required parameter.
- Returns:
- the Input Tables
setInTable
public void setInTable(java.lang.Object inTable)
- Sets the Input Tables parameter of this tool .
This parameter is the name of the table or tables to be used in the query. If several tables are listed, the Expression parameter can be used to define how they are to be joined. the input table can be from an ArcSDE geodatabase, a file geodatabase, a personal geodatabase, or an OLE DB connection.
This is a required parameter.
- Parameters:
inTable
- the name of the table or tables to be used in the query. If several tables are listed, the Expression parameter can be used to define how they are to be joined. the input table can be from an ArcSDE geodatabase, a file geodatabase, a personal geodatabase, or an OLE DB connection.
getOutTable
public java.lang.Object getOutTable()
- Returns the Table Name parameter of this tool .
This parameter is the name of the layer or table view that will be created by the tool.
This is a required parameter.
- Returns:
- the Table Name
setOutTable
public void setOutTable(java.lang.Object outTable)
- Sets the Table Name parameter of this tool .
This parameter is the name of the layer or table view that will be created by the tool.
This is a required parameter.
- Parameters:
outTable
- the name of the layer or table view that will be created by the tool.
getInKeyFieldOption
public java.lang.String getInKeyFieldOption()
- Returns the Key Field Options parameter of this tool .
This parameter is indicates how an ObjectID field will be generated, if at all, for the query. The default is USE_KEY_FIELDS.
This is a required parameter.
- Returns:
- the Key Field Options
setInKeyFieldOption
public void setInKeyFieldOption(java.lang.String inKeyFieldOption)
- Sets the Key Field Options parameter of this tool .
This parameter is indicates how an ObjectID field will be generated, if at all, for the query. The default is USE_KEY_FIELDS.
This is a required parameter.
- Parameters:
inKeyFieldOption
- indicates how an ObjectID field will be generated, if at all, for the query. The default is USE_KEY_FIELDS.
getInKeyField
public java.lang.Object getInKeyField()
- Returns the Key Fields parameter of this tool .
This parameter is specifies a field or combination of fields that can be used to uniquely identify a row in the query. This parameter is used only when the USE_KEY_FIELDS option is set. the Add Field button, which is used only in ModelBuilder, allows you to add expected field(s) so you can complete the dialog and continue to build your model.
This is an optional parameter.
- Returns:
- the Key Fields
setInKeyField
public void setInKeyField(java.lang.Object inKeyField)
- Sets the Key Fields parameter of this tool .
This parameter is specifies a field or combination of fields that can be used to uniquely identify a row in the query. This parameter is used only when the USE_KEY_FIELDS option is set. the Add Field button, which is used only in ModelBuilder, allows you to add expected field(s) so you can complete the dialog and continue to build your model.
This is an optional parameter.
- Parameters:
inKeyField
- specifies a field or combination of fields that can be used to uniquely identify a row in the query. This parameter is used only when the USE_KEY_FIELDS option is set. the Add Field button, which is used only in ModelBuilder, allows you to add expected field(s) so you can complete the dialog and continue to build your model.
getInField
public java.lang.Object getInField()
- Returns the Fields parameter of this tool .
This parameter is the fields to include in the layer or table view. If an alias is set for a field, this is the name that appears. If no fields are specified, all fields from all tables are included.
This is an optional parameter.
- Returns:
- the Fields
setInField
public void setInField(java.lang.Object inField)
- Sets the Fields parameter of this tool .
This parameter is the fields to include in the layer or table view. If an alias is set for a field, this is the name that appears. If no fields are specified, all fields from all tables are included.
This is an optional parameter.
- Parameters:
inField
- the fields to include in the layer or table view. If an alias is set for a field, this is the name that appears. If no fields are specified, all fields from all tables are included.
getWhereClause
public java.lang.Object getWhereClause()
- Returns the Expression parameter of this tool .
This parameter is an SQL expression used to select a subset of records. The syntax for the expression differs slightly depending on the data source. For example, if you're querying file or ArcSDE geodatabases, shapefiles, coverages, dBase, or INFO tables, enclose field names in double quotes: "MY_FIELD" if you're querying personal geodatabases, enclose fields in square brackets: [MY_FIELD] in the Python Window enclose the {where_clause} in parentheses to ensure the spaces (which are delimiters between parameters) are correctly interpreted. for more information on SQL syntax and how it differs between data sources, see SQL Reference.
This is an optional parameter.
- Returns:
- the Expression
setWhereClause
public void setWhereClause(java.lang.Object whereClause)
- Sets the Expression parameter of this tool .
This parameter is an SQL expression used to select a subset of records. The syntax for the expression differs slightly depending on the data source. For example, if you're querying file or ArcSDE geodatabases, shapefiles, coverages, dBase, or INFO tables, enclose field names in double quotes: "MY_FIELD" if you're querying personal geodatabases, enclose fields in square brackets: [MY_FIELD] in the Python Window enclose the {where_clause} in parentheses to ensure the spaces (which are delimiters between parameters) are correctly interpreted. for more information on SQL syntax and how it differs between data sources, see SQL Reference.
This is an optional parameter.
- Parameters:
whereClause
- an SQL expression used to select a subset of records. The syntax for the expression differs slightly depending on the data source. For example, if you're querying file or ArcSDE geodatabases, shapefiles, coverages, dBase, or INFO tables, enclose field names in double quotes: "MY_FIELD" if you're querying personal geodatabases, enclose fields in square brackets: [MY_FIELD] in the Python Window enclose the {where_clause} in parentheses to ensure the spaces (which are delimiters between parameters) are correctly interpreted. for more information on SQL syntax and how it differs between data sources, see SQL Reference.
getToolName
public java.lang.String getToolName()
- Returns the name of this tool.
- Returns:
- the tool name
getToolboxName
public java.lang.String getToolboxName()
- Returns the name of the tool box containing this tool.
- Returns:
- the tool box name
getToolboxAlias
public java.lang.String getToolboxAlias()
- Returns the alias of the tool box containing this tool.
- Returns:
- the tool box alias