Check if Enterprise Geodatabase is reconcilied in ArcPy

1305
10
01-21-2020 02:01 AM
AlbertoLópez
New Contributor III

Hi;

In a python/arcpy script I have to do a compress database and a regenerate index. I don't have to do a reconcilied version.

But previously I have to validate if users have reconcilied the data in the default version of the enterprise database.

Is there any way to do this with ArcPy?. Maybe doing a query to the sde.version table or other table. But I do not how.

Thanks. Greetings.

0 Kudos
10 Replies
AlbertoLópez
New Contributor III

Hello Dan;

Thanks.

I mean specific arcpy functions, I think.

But I had already read the link. But in it, there are no code to check if the  database is consolidated and my script  code can not do the reconcile because there are conflict that the user has to resolve (not the python script).

I need to do a compres an regenerate index database only  if the users have consolidated the data in the enterprise database.

Regards.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Alberto López‌ I didn't find anything specific and I kept coming back to tools in Arctoolbox.  So if there is a way to do it through a workflow in arctoolbox, then that can be scripted by calling those tools piecewise.  Your best luck is to have someone that has done your workflow before, jump on board.

AlbertoLópez
New Contributor III

Thanks Dan;

I will try to do a query in the  "sde.version" table like this:

if status field contains  3355443X maybe the database is consolidated

 if status field does not contains  3355443X maybe the database is not consolidated

Arcsde 10 - versions table, status 33554433 

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Sharing with Geodatabase

I must admit I am not quite following both what you are trying to do and what issue you seem to be having.  You use the term "consolidate", but that isn't a geodatabase term.  Can you elaborate on what you mean by "users have consolidated data in the enterprise geodatabase"?

Are you looking to do a full compress of the enterprise geodatabase?  Even if an enterprise geodatabase cannot be fully compressed, there are advantages to doing partial compresses, so why not just compress the database whether all the users have reconciled and posted their data or not?

AlbertoLópez
New Contributor III

Thanks Joshua;

When I said "consolidated" I mean that if the users have reconciled and posted their data in the default version of the geodatabase?.

I need to compress all geodatabase.

I can not compress the geodatabase if all users have not  reconciled and posted their data in the default version of the geodatabase, because there are an esri recommendation about it:

"To maintain good performance in a geodatabase containing versions, there are a few key administrative tasks that should be run regularly. A recommended workflow for administrators is to frequently reconcile and post, compress the geodatabase, then run the Analyze Datasets and Rebuild Indexes geoprocessing tools. This sort of routine maintenance can be set up to run nightly as a script or by building a model."

Recommended version administration workflow—ArcGIS Help | ArcGIS Desktop 

I understand that it is better reconciled and posted before that do the database compress, etc

Regards.

0 Kudos
JoeBorgione
MVP Emeritus

Take a look at:  Using Python scripting to batch reconcile and post versions—ArcGIS Help | ArcGIS Desktop 

We have used this approach for some time; seems like I modified ESRI's approach such that once the versions are reconciled and posted I delete them and recreate them at the end.  Sorry, since I recently switched jobs I don't have access to the actual code I wrote anymore.

That should just about do it....
AlbertoLópez
New Contributor III

Thanks Joe;

 

But I had already read the link. In it, there are no code to check if the  users have reconciled and posted versions.

 

I can not do the reconcile because there are conflict that the user has to resolve with ArcMap (not the python script).

 

I need to verify if the users have reconciled and posted versions, in this case I have to compress and regenerate index  database, If the users have not reconciled and posted versions, the script stop (no compress, no regenerate index).

 

Regards.

0 Kudos
JoeBorgione
MVP Emeritus

Okay... Sorry about that.  In our case, each of the editors work in various areas so the likelihood of a conflict is minimized if not eliminated; each of the editors has his/her own version as well.  When it comes to automating the reconciliation process, there comes a point where you need to make a decision how to handle conflicts; we settled on last edit wins; in other words, accept the edit version when it comes to conflicts.

That should just about do it....