If you navigate to the feature class in question in the catalog window of ArcMap or in ArcCatalog, the "Location:" field should contain the valid full path for the feature class that you can copy and paste into your script. But in general for data stored in an SDE database, Feature Datasets and Feature Classes will have a full name of Database.Schema.Dataset
Example:
If you had a database called MyDatabase and it used the SDE schema, the path may look like
fc = r'C:\Folder\Subfolder\MyDatabase.sde\MyDatabase.OwnerSchema.FeatureDatasetName\MyDatabase.OwnerSchema.FeatureClassName'
or, since the database is a property of the connection,
fc = r'C:\Folder\Subfolder\MyDatabase.sde\OwnerSchema.FeatureDatasetName\OwnerSchema.FeatureClassName'
Feature classes outside a feature dataset would be one of:
fc1 = r'C:\Folder\Subfolder\MyDatabase.sde\MyDatabase.OwnerSchema.FeatureClassName'
fc2 = r'C:\Folder\Subfolder\MyDatabase.sde\OwnerSchema.FeatureClassName'
fc3 = r'C:\Folder\Subfolder\MyDatabase.sde\FeatureClassName'
(the last only valid if the connection user is the owning schema)
Similarly, if you used the DBO schema with SQL Server, it may look like:
fc1 = r'C:\Folder\Subfolder\MyDatabase.sde\MyDatabase.DBO.FeatureDatasetName\MyDatabase.DBO.FeatureClassName'
fc2 = r'C:\Folder\Subfolder\MyDatabase.sde\DBO.FeatureDatasetName\DBO.FeatureClassName'
fc3 = r'C:\Folder\Subfolder\MyDatabase.sde\MyDatabase.DBO.FeatureClassName'
fc4 = r'C:\Folder\Subfolder\MyDatabase.sde\DBO.FeatureClassName'
Also, when using a file path in Python, you have a few options for how you format the path.
- You can flip the slash one for one (change \ to / ) as you appear to have done in your example. Except, after my.sde you doubled them up, and they should still be single forward slashes.
- You can double up backslashes (ex:
C:\\Folder\\Subfolder\\File.txt
)
- Or you can use the full path, exactly as is, and just denote it as a raw string by preceding it with r. Ex:
r'C\Folder\Subfolder\File.txt'