Esri / data-assistant

ArcGIS Pro Add-in that assists in emergency management, local government and state government data aggregation workflows.
Apache License 2.0
23 stars 8 forks source link

Error if you do not establish an initial connection #126

Closed previnWong closed 7 years ago

previnWong commented 7 years ago

If you open the Pro project and it contains data in an enterprise geodatabase, you need to establish a connection via the sde connection before you can create an DA config file.

If you open the pro project and try to make a config file right away, you get the following error:

Running script SourceTargetMapping...
Source: Transformer
Target: Electric Device
File: C:\Users\Win10\Downloads\UN_SampleData\DataAssistantFIles_EGDB\test.xml
Used data source property
Transformer
Used data source property
Electric Device
Failed script SourceTargetMapping...
Traceback (most recent call last):  File "C:\Users\Win10\AppData\Local\ESRI\ArcGISPro\AssemblyCache\{28142961-b645-420f-ba2a-72bcf8212558}\GPTools\arcpy\dlaCreateSourceTarget.py", line 331, in <module>    main()  File "C:\Users\Win10\AppData\Local\ESRI\ArcGISPro\AssemblyCache\{28142961-b645-420f-ba2a-72bcf8212558}\GPTools\arcpy\dlaCreateSourceTarget.py", line 72, in main    createDlaFile(source,target,xmlFileName)  File "C:\Users\Win10\AppData\Local\ESRI\ArcGISPro\AssemblyCache\{28142961-b645-420f-ba2a-72bcf8212558}\GPTools\arcpy\dlaCreateSourceTarget.py", line 83, in createDlaFile    targetPath = dla.getLayerPath(target)  File "C:\Users\Win10\AppData\Local\ESRI\ArcGISPro\AssemblyCache\{28142961-b645-420f-ba2a-72bcf8212558}\GPTools\arcpy\dla.py", line 798, in getLayerPath    pth = repairLayerSourceUrl(pth,layer)  File "C:\Users\Win10\AppData\Local\ESRI\ArcGISPro\AssemblyCache\{28142961-b645-420f-ba2a-72bcf8212558}\GPTools\arcpy\dla.py", line 870, in repairLayerSourceUrl    connfile = getConnectionFile(lyr.connectionProperties)  File "C:\Users\Win10\AppData\Local\ESRI\ArcGISPro\AssemblyCache\{28142961-b645-420f-ba2a-72bcf8212558}\GPTools\arcpy\dla.py", line 1001, in getConnectionFile    date=getcp(cp,'date'))  File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\management.py", line 17073, in CreateDatabaseConnection    raise e  File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\management.py", line 17070, in CreateDatabaseConnection    retval = convertArcObjectToPythonObject(gp.CreateDatabaseConnection_management(*gp_fixargs((out_folder_path, out_name, database_platform, instance, account_authentication, username, password, save_user_pass, database, schema, version_type, version, date), True)))  File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\geoprocessing\_base.py", line 506, in <lambda>    return lambda *args: val(*gp_fixargs(args, True))arcgisscripting.ExecuteError:  ERROR 999999: Error executing function.Failed to execute (CreateDatabaseConnection).
Failed to execute (SourceTargetMapping).
SteveGrise commented 7 years ago

I don't understand what 'you need to establish a connection via the sde connection' means. I'm having a hard time reading through these issues to figure out what the actual issue is and how to reproduce it.

previnWong commented 7 years ago

If you are making a new data assistant config file. If one of your target or source is an connection to an enterprise database through an SDE connection, you have to make sure you double click the connection to establish a connection to the enterprise DB before you run the command to create a data assistance config file otherwise you get the error pasted above.

SteveGrise commented 7 years ago

I do not experience that problem. This is related to a question that I asked for some help on - auto-creating .sde files and/or using the CIM Workspace properties through python. The result I currently experience is: image

previnWong commented 7 years ago

No longer seeing this issue. Verified.

previnWong commented 7 years ago

Behavior occurred again. open Pro project with data coming from a enterprise database (layers unchecked). Create a new config file command. Choose an enterprise gdb layer as a target from the drop down list. press Run. get the following error. image

Now, go to the project panel, Databases node and double click the sde connection to make a connection. Next, run make a new config again. This time to creates it fine. image

SteveGrise commented 7 years ago

Since this is intermittent I suggest we call this a known issue and see if there are any product bugs or plans to address this in the core software. I don't think there is anything I can do in DA to address this.

previnWong commented 7 years ago

Documenting it as a known behavior. limitation of Pro.

MikeMillerGIS commented 7 years ago

I can repo pretty easily. @previnWong can you create a very simple python script as a repo case we can send Dev. Looks like Steve is just get the connection properties from the layer, dissecting them, and calling createEnterpriseGDBConnection.

MikeMillerGIS commented 7 years ago

Can we change getCP to default to None? maybe exclude Date also?

SteveGrise commented 7 years ago

I'm going to drop items from the argument list if they do not exist in the connection properties.

On Wed, Mar 22, 2017 at 3:27 PM, Michael Miller notifications@github.com wrote:

Can we change getCP to default to None? maybe exclude Date also?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Esri/data-assistant/issues/126#issuecomment-288512211, or mute the thread https://github.com/notifications/unsubscribe-auth/AEh3BM66qXNxeGrp9L3Yz_a4l2HuY2CKks5roXYzgaJpZM4MQXwt .

previnWong commented 7 years ago

Adding note to establish a connection first before running tools to the wiki. https://github.com/Esri/data-assistant/wiki/Ensure-Database-Connections-Before-Running-Tools