Skip to main content
Question

Is there a way to write a tables schema and data type out to a text file?

  • February 15, 2021
  • 3 replies
  • 240 views

darkspatiallord
Forum|alt.badge.img+6
Is there a way to write a tables schema and data type out to a text file?

3 replies

tomf
Contributor
Forum|alt.badge.img+14
  • Contributor
  • February 16, 2021

I'd use the Schema feature from a FeatureReader, exploding the attribute list and then using name (attribute name) and native_data_type to build a text file? This could be done when reading, or add an extra FeatureReader (Schema feature only) after writing out the data.


darkspatiallord
Forum|alt.badge.img+6

thanks Tom. knew there was a way, just couldnt get brain to function!

Will post result for others to use, as this is for metadata population.

 


darkspatiallord
Forum|alt.badge.img+6

Creator > Feature Reader > Attribute Manager > Attribute Trimmer > Text file writer

In Feature Reader set Max features to read to 1.

Change Schema\\Data Feature to be Schema Features

Connect output to <Schema>

Attribute Manager - depends on how you want to expose the values - I used multiple lines and built a new atttribute to populate a text file

$(DATASET)

@Value(fme_feature_type_name)

Attribute_Name Datatype

@Value(attribute{0}.name) @Value(attribute{0}.native_data_type)

@Value(attribute{1}.name) @Value(attribute{1}.native_data_type)

@Value(attribute{2}.name) @Value(attribute{2}.native_data_type)

 

You can list as many attributes as you need, I didnt make mine dynamic but am sure you could.

Through in the attribute Trimmer to remove any excess lines and spaces from the end.

Write out using text_Line and fan out on the dataset using @Value(fme_feature_type_name).txt

 

 

Not to hard after all.

Now just to embed into XML metadata.....


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings