Hi Julie, can you try the following script:
#create a new sde connection
#List all featureclasses in a geodatabase, including any within feature datasets
import arcpy,os
from arcpy import env
arcpy.env.overwriteOutput = True
arcpy.CreateDatabaseConnection_management(out_folder_path="Database Connections",
out_name="GIS winauth to gis-server.sde",
database_platform="SQL_SERVER",
instance="gis-server",
account_authentication="OPERATING_SYSTEM_AUTH",
database="GIS",
version_type="TRANSACTIONAL",
version="dbo.DEFAULT")
arcpy.env.workspace = r"Database Connections\GIS winauth to gis-server.sde"
datasets = arcpy.ListDatasets(feature_type='feature')
datasets = [''] + datasets if datasets is not None else []
for ds in datasets:
for fc in arcpy.ListFeatureClasses(feature_dataset=ds):
path = os.path.join(arcpy.env.workspace, ds, fc)
print path
I believe the problem with the previous script was that the parameters were looking for the data in the following order:
(out_folder_path, out_name, database_platform, instance, {account_authentication}, {username}, {password}, {save_user_pass}, {database}, {schema}, {version_type}, {version}, {date})
Although they are optional parameters, arcpy is expecting a variable there. So another way to complete this is to specify the dictionary parameters for arcpy.CreateDatabaseConnection_management()