Skip to main content

My goal is to read a directory of SDE connection files and then list out the database name and all the feature class names, tables, geometry types, etc. associated with each connection file.

 

I've reviewed the articles below and can't figure out how to set the Feature Types to Read parameter since it only shows tables/feature classes from the one Reader as a Resource SDE connection. This isn't an issue if there is only one database but when there are multiple (like what I'm trying to do), it doesn't seem to work. Is this possible or is there another way to get this info?

 

Here are the articles I've been using:

https://community.safe.com/s/article/how-to-read-all-feature-classes-from-multiple-esri

 

https://community.safe.com/s/question/0D54Q000080hHCASA2/read-multiple-sde-connect-file

 

https://community.safe.com/s/question/0D54Q00008qzlJhSAI/how-to-dynamically-read-entire-schema-of-sde-geodatabase

 

 

 

The way i'd approach it is using a FeatureReader with the directory being c:\\temp\\*.sde (read all files ending in SDE in that folder) then set the FeatureReader to only read the schema and process the output schema from there into the required format


@hkingsbury​ if I use the FeatureReader like you suggested, you have to set the Format to something.  I tried the Schema (Any Format) option but results in this:

Generic Reader: Unable to guess a valid reader name from dataset '<name of SDE connection file>.sde'. A NULL reader will be used instead.

If you set the Format to SDE, then you can only set it to 1 SDE connection file AND you have to set the Feature Types to Read.

 

Any other ideas?


@hkingsbury​ if I use the FeatureReader like you suggested, you have to set the Format to something.  I tried the Schema (Any Format) option but results in this:

Generic Reader: Unable to guess a valid reader name from dataset '<name of SDE connection file>.sde'. A NULL reader will be used instead.

If you set the Format to SDE, then you can only set it to 1 SDE connection file AND you have to set the Feature Types to Read.

 

Any other ideas?

You'll still need to set the FeatureReader as SDE, but just enable the read only schema optionimage.png 

As I think more about this problem I realise that you can't then use a wild card as a feature type to read in the feature classes.

 

Attached is an example workspace that firstly uses ArcPy to get all the FCs in the SDE connection, then passes them through to a FeatureReader(SDE) to get the schema. You could also achieve the same with and SQLExecuter, but unsure if you have direct SQL access to the underlying DB

 


You'll still need to set the FeatureReader as SDE, but just enable the read only schema optionimage.png 

As I think more about this problem I realise that you can't then use a wild card as a feature type to read in the feature classes.

 

Attached is an example workspace that firstly uses ArcPy to get all the FCs in the SDE connection, then passes them through to a FeatureReader(SDE) to get the schema. You could also achieve the same with and SQLExecuter, but unsure if you have direct SQL access to the underlying DB

 

Thanks for the workbench. This works for 1 SDE connection but I'm trying to run an entire folder of them. The current Connection File user parameter only allows 1 selection - is there a way to use a wildcard like  c:\\temp\\*.sde instead?


You'll still need to set the FeatureReader as SDE, but just enable the read only schema optionimage.png 

As I think more about this problem I realise that you can't then use a wild card as a feature type to read in the feature classes.

 

Attached is an example workspace that firstly uses ArcPy to get all the FCs in the SDE connection, then passes them through to a FeatureReader(SDE) to get the schema. You could also achieve the same with and SQLExecuter, but unsure if you have direct SQL access to the underlying DB

 

Hello ,

thanks for ur workspace .

i have used it but I have found that the output of Python caller has not all feature classes .

could I ask if there is a reason for that ? Why did it read most of feature classes but not all of them ?


Reply