Question

Compare 2 Schemas -> get list of new attributes

  • 16 November 2013
  • 8 replies
  • 97 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

Userlevel 3
Badge +17
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
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?
Userlevel 3
Badge +17
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
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
Badge +5
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
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
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?

Badge

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

Reply