Summary
Clears any enterprise geodatabase workspaces from the enterprise geodatabase workspace cache.
Usage
This tool only works with enterprise geodatabase workspaces.
This tool can be used to help disconnect idle enterprise geodatabase connections in a long-running application.
If you run the tool without specifying an Input data element, all enterprise geodatabase workspaces in the enterprise geodatabase workspace cache will be cleared. Specify the specific .sde file associated with the workspace you want to clear in order to clear a specific enterprise geodatabase workspace.
- To clear the workspace cache correctly in a script: The call to ClearWorkspaceCache() should be the last call in your script making sure to remove all references to any objects that may be pointing to the enterprise geodatabase workspace before making the call to ClearWorkspaceCache().
Note:
Clearing an enterprise geodatabase workspace from the enterprise geodatabase workspace cache does not guarantee the connection to the enterprise geodatabase server will be disconnected. It will only ensure the geoprocessor object no longer has any hold on the enterprise geodatabase workspace that has been cleared. If any other process has references to this enterprise geodatabase workspace the connection will be maintained.Syntax
arcpy.management.ClearWorkspaceCache({in_data})
Parameter | Explanation | Data Type |
in_data (Optional) | The enterprise geodatabase database connection file representing the enterprise geodatabase workspace to be removed from the cache. Specify the path to the enterprise geodatabase connection file that was used in running your geoprocessing tools in order to remove the specific enterprise geodatabase workspace from the cache. Passing no input parameter will clear all enterprise geodatabase workspaces from the cache. | Data Element; Layer |
Derived Output
Name | Explanation | Data Type |
out_results | Whether the operation was successful. | Boolean |
Code sample
The following Python window script demonstrates how to use the ClearWorkspaceCache function in immediate mode.
import arcpy
arcpy.env.workspace = "c:/connectionFiles/Connection to gpserver.sde"
arcpy.ClearWorkspaceCache_management()
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes