Where Do i get the geodatabases Connection for Python script

126
2
06-27-2019 10:40 AM
DiegoLlamas
Occasional Contributor III

Hello, I am not good with python, I am new. I am trying to synchronize changes from a replica between databases and i want this to run automatically every day with a task scheduler. In esri help i found this sintaxis

Sintaxis

SynchronizeChanges_management (geodatabase_1, in_replica, geodatabase_2, in_direction, conflict_policy, conflict_definition, reconcile)

And I did this script:

message = "Sync replicas CRIMPRDB to cdprdb01...";print message
# Process: Synchronize Changes (80)
arcpy.SynchronizeChanges_management(crim-oradb-01-sde:oracle$crim-oradb-01/cdprdb, "MAPUSER.CD_PARCELAS", cdprdb01-sde:sqlserver:cdprdb01-cdprgis, "FROM_GEODATABASE1_TO_2", "IN_FAVOR_OF_GDB1", "BY_OBJECT", "DO_NOT_RECONCILE")
message = "---Sync de replica CRIMPRDB to cdprdb01 successful";print message

arcpy.AnalyzeDatasets_management(input_database="Database Connections/gisadmin@cdprdb01.sde", include_system="NO_SYSTEM", in_datasets="cdprgis.GISADMIN.Parcelario/cdprgis.GISADMIN.Parcelario;cdprgis.GISADMIN.Parcelario_Web/cdprgis.GISADMIN.ParcelasContactos;cdprgis.GISADMIN.Parcelario_Web/cdprgis.GISADMIN.ParcelasContactos04242019_1", analyze_base="ANALYZE_BASE", analyze_delta="NO_ANALYZE_DELTA", analyze_archive="NO_ANALYZE_ARCHIVE")
arcpy.Compress_management(in_workspace="Database Connections/sde@cdprdb01.sde")
arcpy.RebuildIndexes_management(input_database="Database Connections/gisadmin@cdprdb01.sde", include_system="NO_SYSTEM", in_datasets="cdprgis.GISADMIN.Parcelario/cdprgis.GISADMIN.Parcelario;cdprgis.GISADMIN.Parcelario_Web/cdprgis.GISADMIN.ParcelasContactos;cdprgis.GISADMIN.Parcelario_Web/cdprgis.GISADMIN.ParcelasContactos04242019_1", delta_only="ALL")
print"Indices Reconstruidos para Parcelario"
message = "--Replica Sync Completed Succesfully";print message

My doubt is with geodatabase 1 and 2 part, where do I get the connections? how do I write those?

I found this in my syn changes wizard and I wrote those, Is that correct? 

Thanks for your help!

Diego Llamas

George Thompson

0 Kudos
2 Replies
MichaelVolz
Esteemed Contributor

Have you run the python script?  Did you get any error messages?

0 Kudos
MaliniRamalingam
Esri Contributor

Refer to the web document that also provides a code sample for the Synchronize Changes tool, http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/synchronize-changes.htm

 

The replica_gdb1 and replica_gdb2 local variables in the python script refer to the location of the SDE (.sde) geodatabase connection files. These files have the information to connect to your enterprise geodatabase and are created from the Catalog tree in ArcGIS Desktop (http://desktop.arcgis.com/en/arcmap/latest/manage-data/database-servers/save-connection-to-specific-...). 

 

The Sync Changes wizard is not necessarily pointing to the location of the .sde file, so this information is not enough to run the python script. You will have to make sure the geodatabase_1 and the geodatabase_2 input parameters for the tool, point to the location of the SDE connection files.

 

0 Kudos