How can I delete an sde file located in my scratch space.
prefixOutputWorkspace = r"C:\scratch\....\ConnectionToSQL.sde"
if arcpy.Exists(prefixOutputWorkspace): delete this sde conection
Recreate sde connection
You can always use 15.1. os.remove() — Miscellaneous operating system interfaces — Python 2.7.17 documentation to remove files on the file system.
Or, if you want to stay within ArcPy modules: Delete—Data Management toolbox | Documentation
Deleting a database connection file does not delete the enterprise database. A database connection file is simply a shortcut to the database.
This is what I did:
# removing the file using the os.remove() method
Retrieving data ...