Select to view content in your preferred language

Do I need to consider the order in which versions are reconciled if only some are being posted?

549
3
01-31-2023 02:09 PM
BlakeTerhune
MVP Regular Contributor

Our enterprise geodatabase (10.8.1) on Oracle has a variety of versions. Some children of Default, some are grandchildren. We have a Python script that does reconcile, compress, rebuild indexes, and analyze stats operations. When reconciling the versions, I want to post only a few specified versions; all other versions are only reconciled (no post).

Are there any special considerations when doing this? For example, do I need to make sure that the farthest ancestor versions are reconciled first? Do the versions being posted need to be reconciled/posted last, after everything else has been reconciled? Or am I over thinking this and the reconcile tool takes care of all that? The documentation is very simplistic. Before the only example with one reconcile that posts everything, it says that,

This tool is a means to achieve an effective compression, as it allows multiple versions to be reconciled and posted at once in an appropriate order.

I am running the Python script with ArcGIS Pro 3.0.3

0 Kudos
3 Replies
by Anonymous User
Not applicable

This is a deep question... We only go one deep in our versions so I'm not much help but I'd like to know this as well. Does it list all your grandchildren when you run the list versions?

# Get a list of versions to pass into the ReconcileVersions tool.
versionList = arcpy.da.ListVersions('C:\\Projects\\MyProject\\admin.sde')

If it does, maybe spin up a test database and run it to see what happens? 

0 Kudos
BlakeTerhune
MVP Regular Contributor

Thank you for sharing your thoughts. It does indeed list all versions, including grandchild and replica versions. The version objects include the immediate child (not grandchildren), parent version, and ancestors (parent lineage all the way up to default). So it is possible to break up the versions logically.

I did a test where I posted a sample of child versions but only reconciled the rest. The versions were grouped by parent, but that seems unnecessary at the moment. Eventually, we will post all direct children of Default and only reconcile everything else so that's why I have it that way.

versions_to_post = [
    "QAQC_LIS.QAQC_LIS",
    "QAQC_GPS.QAQC_GPS",
    "QAQC_UTILITIES.QAQC_UTILITIES"
]

versions = defaultdict(list)
for v in arcpy.da.ListVersions(sde_egdb_conn):
    if v.name != "SDE.DEFAULT":
        versions[v.parentVersionName].append(v.name)

for version_parent, version_list in versions.items():
    v_to_reconcile = [v for v in version_list if v not in versions_to_post]
    if v_to_reconcile:
        print(f"\nReconcile {len(v_to_reconcile)} versions with {version_parent}")
        arcpy.management.ReconcileVersions(
            input_database=sde_egdb_conn,
            reconcile_mode="ALL_VERSIONS",
            target_version=version_parent,
            edit_versions=v_to_reconcile,
            acquire_locks="NO_LOCK_ACQUIRED",
            abort_if_conflicts="NO_ABORT",
            conflict_definition="BY_OBJECT",
            conflict_resolution="FAVOR_TARGET_VERSION",
            with_post="NO_POST",
            with_delete="KEEP_VERSION"
        )

    # Post
    v_to_post = [v for v in version_list if v in versions_to_post]
    if v_to_post:
        print(f"\nPost {len(v_to_post)} versions to {version_parent}")
        arcpy.management.ReconcileVersions(
            input_database=sde_egdb_conn,
            reconcile_mode="ALL_VERSIONS",
            target_version=version_parent,
            edit_versions=v_to_post,
            acquire_locks="LOCK_ACQUIRED",
            abort_if_conflicts="ABORT_CONFLICTS",
            conflict_definition="BY_OBJECT",
            conflict_resolution="FAVOR_TARGET_VERSION",
            with_post="POST",
            with_delete="KEEP_VERSION"
        ) 

 This was successful and posted changes in a QAQC version to Default.

@Anonymous User, do you have any automated post operations in your organization?

0 Kudos
by Anonymous User
Not applicable

That is cool, thanks for sharing. We don't have any automated reconciliation; those doing the edits are the ones that would QA/QC so it's pretty much one level deep. The only automated thing we do besides general maintenance is replication.

0 Kudos