Solved

How to search file geodatabase for feature classes containing attributes with names that meet a regular expression?

  • 29 November 2022
  • 2 replies
  • 1 view

Badge +1

I need to scan an existing but unpopulated (i.e. no data) file geodatabase (GDB) and determine which feature classes have attributes whose names match a given regular expression. I then need essentially to extract the pairs of feature_class_name/matching_attribute_name and in some way to use those pairs subsequently in the translation. So:

  1. What transformer would I use to scan an unpopulated GDB for attribute names matching a regex?
  2. How best to configure and to capture information from that transformer to use subsequently in translation?
  3. [Related to the beginnings of a solution idea in my head ...] If I use, say, a FeatureReader to extract schema features from an unpopulated GDB with Ignore Relationship Info unchecked, will the schema features carry format attributes (similar to geodb_feature_has_relationships on data features) indicating feature classes and attributes that participate in relationships?

 

Thanks, all, for your ideas on this.

icon

Best answer by dustin 29 November 2022, 16:37

View original

2 replies

Userlevel 3
Badge +26

I think you are on the right track with the FeatureReader. From the Schema port, you could use a ListExploder on the attribute{} list. The regex could be tested against the resulting name attribute. As for the relationships, I don't know those would show up on the Schema feature. It would however, show on the features. So, you could use a FeatureMerger after reading the data to get that information on the Schema features if you need to.

 

Badge +1

I think you are on the right track with the FeatureReader. From the Schema port, you could use a ListExploder on the attribute{} list. The regex could be tested against the resulting name attribute. As for the relationships, I don't know those would show up on the Schema feature. It would however, show on the features. So, you could use a FeatureMerger after reading the data to get that information on the Schema features if you need to.

 

@ddbrocato -- Thank you. I think the <Schema> port on a FeatureReader will indeed do the trick. In my particular case at hand, the simple presence of an attribute with a name matching the regex will safely indicate which feature classes participate in a relationship, but that might not always be the case in general. (We would like to have the workspace be fairly generic and reusable.) As there are no data features in the GDB being scanned, relationship format attributes remain elusive, but my immediate problem is solved.

Reply