Skip to main content
Question

Compare 2 Schemas -> get list of new attributes

  • November 16, 2013
  • 8 replies
  • 603 views

Hi,

 

 

I am using a matcher to compare 2 schemas (2 esri gdb, original and modified one). Result of this match should be a file which lists new attributes (probably a csv).

 

Can you please give me a hint, how to realize this? Do I need more transformers than matcher or do I only have to configure the CSV writer correctly?

 

(I am using FME 2013 and a FME beginner)

 

Thanks in advance,

 

Christin

8 replies

takashi
Influencer
  • November 16, 2013
Hi Chrestin

 

 

The Schema (Any Format) Reader can be used to read schema of a dataset. See this thread. write a list of gdb feature classes to excel http://fmepedia.safe.com/AnswersQuestionDetail?id=906a0000000csUUAAY   After reading two gdb schemas, you can  use the ChangeDetector transformer to compare them.

 

 

Hope this helps.

 

Takashi

  • Author
  • November 16, 2013
Dear Takashi,

 

 

thanks for the anwser. I have already tried using the changeDetector and connected the "added" Port to the CSV Writer. The result is a list of all attributes (of the updated schema). Is it possible to write only the new ones in the file?

takashi
Influencer
  • November 17, 2013
Hi Christin,

 

 

Each feature created by the Schema (Any Format) Reader has a feature class name as an attribute named "fme_feature_type_name", and also it holds the attribute information of the feature class as a comlex list attribute: attribute{}.name   -- attribute names attribute{}.native_data_type  -- data type names in source format attribute{}.fme_data_type  -- data type names in FME   The ListExploder can be used to create features which contain the information of individual attribute.

 

After exploding the list, try using the ChangeDetector to compare "fme_feature_type_name" and "name", like this example.

 

 

If you need to compare data type too, add "native_data_type" to "Selected Attributes" parameter of the ChangeDetector.

 

 

Takashi

  • Author
  • November 17, 2013
Hi Takashi,

 

 

thank you very much for the fast and detailed answers. Everything is working fine now and I can generate a file with the new attributes and learned how to use the Exploder.

 

 

Thanks and best wishes,

 

Christin

jon
Contributor
Forum|alt.badge.img+5
  • Contributor
  • February 7, 2014
Takashi,

 

 

Will your workflow above report attribute changes too?  For example, if an attribute existed in both the original and revised geodatabase with the same name, but the length was modified (i.e. from 10 characters to 15), would this show up in Added or not at all?  If not, is there a way to accomplish this?

 

 

 

Thanks,

 

Jon

  • May 22, 2014
Hi Takashi,

 

 

Thank you for your help. I was able to compare schemas between datasets using your workflow. You are really a great help and resource on FME!

 

 

Jon, you can compare most anything relating to the schema with a bit of playing with the fields you wish to compare. Use what you need from what Takashi suggested: attribute{}.name   -- attribute names attribute{}.native_data_type  -- data type names in source format attribute{}.fme_data_type  -- data type names in FME

 

I needed to compare two datasets to see if they had the same column names and data types and lengths. I used a StringCaseChanger transformer to make the attributes all uppercase as schemas were coming up different if the cases were dissimilar but otherwise had the same name.

 

 

 

 

This is a useful workflow to compare schemas between datasets and I'll now work out how to make this re-usable by getting the two datasets as parameters that are asked for when the workbench is launched.

 

 

Morgan

venu
Contributor
Forum|alt.badge.img+5
  • Contributor
  • January 23, 2021
takashi wrote:
Hi Christin,

 

 

Each feature created by the Schema (Any Format) Reader has a feature class name as an attribute named "fme_feature_type_name", and also it holds the attribute information of the feature class as a comlex list attribute: attribute{}.name   -- attribute names attribute{}.native_data_type  -- data type names in source format attribute{}.fme_data_type  -- data type names in FME   The ListExploder can be used to create features which contain the information of individual attribute.

 

After exploding the list, try using the ChangeDetector to compare "fme_feature_type_name" and "name", like this example.

 

 

If you need to compare data type too, add "native_data_type" to "Selected Attributes" parameter of the ChangeDetector.

 

 

Takashi

What about Domain and subtype comparison?


daraghatsafe
Forum|alt.badge.img
venu wrote:

What about Domain and subtype comparison?

Hey @venu​ 

This post is pretty old, if you like you can post a new question to the community and it will be picked up quicker and may get a better response.

Thanks, Daragh


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