If I am use Arcpy how can I get count feature layer and data count in SDE database connection.
closed as off-topic by Midavalo♦ Oct 27 '17 at 13:58
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions seeking help to debug/write/improve code must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Providing a clear problem statement and evidence of a code attempt will help others to help you. See: How to create a Minimal, Complete, and Verifiable example." – Midavalo
If you want to Count features in a feature class / layer then use Get Count:
Returns the total number of rows for a table.
From the help section of the tool:
# Name: fcCount.py # Purpose: calculate the number of features in a featureclass # Import system modules import arcpy lyrfile = r"C:\data\streets.lyr" result = arcpy.GetCount_management(lyrfile) count = int(result.getOutput(0)) print count
If you want to Count the feature classes instead, then:
import arcpy arcpy.env.workspace = r"Database Connections\test.sde" print len(arcpy.ListFeatureClasses())