Python – Define Workspace for SDE Connection

One of the possiblilities is to provide the full path to the sde connection file. You can check it creating the connection in ArcCatalog then right clicking and selecting Properties.


C:\Python26\ArcGIS10.0>python
Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import arcpy
>>> arcpy.env.workspace="C:\Users\osedok\AppData\Roaming\ESRI\
Desktop10.0\Arc
Catalog\PABLO to TEST_SDE_SERVER.sde"
>>> dataset_list=arcpy.ListDatasets()
>>> for feature_dataset in dataset_list:
...     print feature_dataset
...
MASTERMAP.ITN_Network
PABLO.Administrative
PABLO.Default_Blank_Dataset
PABLO.Default_Dataset
PABLO.Development
>>>