Solved

How to dynamically read entire schema of SDE Geodatabase

  • 12 August 2021
  • 4 replies
  • 37 views

Badge +2

Hello all.

 

I'm trying to determine the best way to read the schema of an SDE geodatabase. My end goal is to read each table/feature class' attributes and properties (name, data type, length/precision) from a File Geodatabase and compare them to tables/feature classes from an SDE geodatabase. Most are the same but can differ slightly for a quarterly data load of 300+ tables/feature classes. I've managed to use the Schema (Any Format) Reader for the File Geodatabase, but if I use the same reader on the SDE geodatabase, it gives me an error: "An error occurred while attempting to retrieve the connection parameters from the connection file ''". It sort of looks like it can't find the connection file, even though a working .sde connection file is in the "Source Dataset" parameter, and there aren't many other parameter options available.

 

Does anyone have thoughts on how to configure the Schema (Any Format) Reader for an SDE geodatabase, or is there maybe a better way to extract tables/feature classes and their attributes?

 

Thanks!

icon

Best answer by nielsgerrits 13 August 2021, 06:50

View original

4 replies

Badge +2

@timboberoosky​ Under the Reader menu, add an ArcSDE reader using Add Reader as a Resource. Then under the Schema (Any Format) link the Source Dataset parameter to the ArcSDE connection parameter from the Reader Resource.

Badge +2

@timboberoosky​ Under the Reader menu, add an ArcSDE reader using Add Reader as a Resource. Then under the Schema (Any Format) link the Source Dataset parameter to the ArcSDE connection parameter from the Reader Resource.

Thanks @Mark Stoakes​ ! That works to get the Schema Reader actually processing feature types. Now though, I can't seem to find how to dynamically read the entire database, it seems you have to define the Feature Types To Read as a parameter in the ArcSDE Reader, which pass on to the Schema Reader. If I don't know the feature types I want to read (maybe they've changed since the last workspace run), can the ArcSDE Reader dynamically read all feature types in the database? Better yet, I know the schema owner of the data I want to read will always be the same, can I define by that, like a WHERE clause?

Userlevel 6
Badge +31

Thanks @Mark Stoakes​ ! That works to get the Schema Reader actually processing feature types. Now though, I can't seem to find how to dynamically read the entire database, it seems you have to define the Feature Types To Read as a parameter in the ArcSDE Reader, which pass on to the Schema Reader. If I don't know the feature types I want to read (maybe they've changed since the last workspace run), can the ArcSDE Reader dynamically read all feature types in the database? Better yet, I know the schema owner of the data I want to read will always be the same, can I define by that, like a WHERE clause?

I did this using a FeatureReader, setting "Schema/Data Features" to "Schema Features".

 

One way to get all featureclasses you need is to look for the view which shows all tables in the database. The name of this view differs per underlaying database. Use the SqlExecutor to query this view and feed the results to the FeatureReader.

 

You can use a Creator to initiate a proces if you don't have an Initiator feature.

Badge +2

Thanks @Mark Stoakes​ ! That works to get the Schema Reader actually processing feature types. Now though, I can't seem to find how to dynamically read the entire database, it seems you have to define the Feature Types To Read as a parameter in the ArcSDE Reader, which pass on to the Schema Reader. If I don't know the feature types I want to read (maybe they've changed since the last workspace run), can the ArcSDE Reader dynamically read all feature types in the database? Better yet, I know the schema owner of the data I want to read will always be the same, can I define by that, like a WHERE clause?

Thank you @nielsgerrits​ ! I did exactly what you suggested and it worked, so no need to use the Schema (Any Format) Reader at all. Using the SQLExecutor also adds the benefit of being able to use a WHERE clause to limit my table name query results to begin with.

Thanks again.

Reply