Select to view content in your preferred language

ArcGIS Pro Python Script for Update Connection Properties Not Working

509
0
11-04-2019 08:49 PM
TauhidulIslam1
New Contributor

As we need to update the data source for more than 50 maps in ArcGIS Pro we need to run batch update. Previously I use the following code which worked for the Test database.

import arcpy
aprx = arcpy.mp.ArcGISProject(
r'C:\Temp\Administrative Boundaries.aprx')
find_dict = {
'connection_info': {'instance': 'sde:sqlserver:SERVER.name.com',
                                
'server': 'SERVER.name.com'}}

replace_dict = {
'connection_info': {'instance': 'sde:sqlserver:newSERVER.name.com',
                                   
'server': 'newSERVER.name.com', 'authentication_mode': 'OSA'}}
aprx.updateConnectionProperties(find_dict
, replace_dict)
aprx.save()

but in the production database because we have the high availability we made the following changes in the code-

import arcpy
aprx = arcpy.mp.ArcGISProject(
r'C:\Temp\Administrative Boundaries.aprx')
find_dict = {
'connection_info': {'instance': 'sde:sqlserver:SERVER.name.com',
                                
'server': 'SERVER.name.com'}}

replace_dict = {
'connection_info': {'instance': 'sde:sqlserver:newSERVER.name.com;MULTISUBNETFAILOVER=YES',
                                    
'server': 'newSERVER.name.com', 'authentication_mode': 'OSA'}}
aprx.updateConnectionProperties(find_dict
, replace_dict)
aprx.save()

Nothing seems wrong. Anyone have any idea?
Regards,Tauhid

0 Kudos
0 Replies