arcpy to edit *.sde files

3095
5
Jump to solution
05-16-2016 10:58 AM
MichaelKnapp
Occasional Contributor

Hi there -

Is it possible to, using arcpy, to edit the content of an *.sde connection file (or files) directly?

Based on some initial research, it seems this is not possible and that the closest I might be able to get would be to use CreateArcSDEConnectionFile_management to generate multiple new files at once.

Thanks.

0 Kudos
1 Solution

Accepted Solutions
NeilAyres
MVP Alum

Once you have the original, you can make a connection to it.

env.workspace = "path and name of connection file . sde"

Then you can recover the properties of that connection file using Describe.

View solution in original post

5 Replies
NeilAyres
MVP Alum

What are your requirements to edit a connection file?

I think you are correct, you could read a connection file, create a new one, then overwrite the original.

MichaelKnapp
Occasional Contributor

All that's needed is to swap out the server domain name in the *.sde files, but there are lots of *.sde files to update.

What would be the best arcpy function to use to read properties of the existing *.sde files?

Thanks so much for your quick reply.

0 Kudos
NeilAyres
MVP Alum

Once you have the original, you can make a connection to it.

env.workspace = "path and name of connection file . sde"

Then you can recover the properties of that connection file using Describe.

MichaelKnapp
Occasional Contributor

Great, thanks again for all the information.

0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

Hi Mike,

Kim at dec was asking the same question via email to me.  Haven't made contact yet.  Is thus related?  I mentioned you just asked the question here.

just FYI, for finding and updating other broken link, I had an addin Python addin for data inventory and “broken-link” repair.​   Not 100%, and haven't had time to keep working on it, but may help fix other issues in the future.

0 Kudos