pass SQL query for all tables and feature classes to geodatabase / arcsde

12-14-2023 10:17 AM
Occasional Contributor II

We've got a database which we can access using this:

Geodatabase geodatabase = new Geodatabase(new DatabaseConnectionFile(new Uri(sde_path)))

if we use the following statement it takes 2 minutes to list the content of the geodatabase

IReadOnlyList<Definition> fc_definitions = geodatabase.GetDefinitions<FeatureClassDefinition>();

thus this option does not work for our purpose at all. we know, that the long waiting time is because of some annoying things that go on behind the scenes and has nothing to do with our database. we are certain of this because a) we can list the content of the geodatabase withing seconds when using a SQL statement in a arcpy script and b) we have timed this command and seen that it is responsible for almost 2000 transactions per second and reading millions of tuples (while there are only a couple hundred datasets in the database). we thought about transfering our SQL statement of the arcpy script to the ArcGIS Pro SDK in order to speed up this datareading process. unfortunately we don't find any documentation on how this should be done. we only find documentation on how to pass a SQL statement to a specific table... 

Does anybody know:

A) is there any option how to modify the GetDefinitions statement (see above) in such a way, that ArcGIS Pro only lists the FeatureClassDefinitions without looping through all the data content itself? or more generally speaking: can we modify ghe GetDefinitions statement in any way? 

B) how to pass a SQL statement using the ArcGIS Pro SDK to the geodatabase of the first snippet, so that it only lists its contained featureclasses and standalone tables? ideally it would also list the geometry type of said featureclasses. 
important: we don't need the list of the features within the feature classes. we only want to know which feature classes (or tables) are in the geodatabase.

Thanks for your help.

Tags (2)
0 Kudos
1 Reply
Esri Regular Contributor


Answer to part of your B question:

There is ExecuteStatement method in ArcGIS Pro API, but no results can be returned.

I have similar case with requirement execute SQL statement and get result from it. I made python tool and called it from add-in. Would it be faster than using ArcGIS Pro API, I don't know, because you need to call geoprocessing which is not so fast itself.

What SQL query can retrieve featureclasses and standalone tables I don't know. You need to explore all system tables created by sde and check for featureclasses and standalone table names.

0 Kudos