Skip to main content
Open

Introduce New Transformer to Modify Schema Easily

Related products:Transformers

takashi
Contributor
Since the FeatureReader has been enhanced in FME 2015.1 (the <Schema> port added), dynamic schema configuration has become more flexible than before.
To expand the application range, I would suggest a new transformer which allows users to modify schema contents - attribute names and data types stored in the "attribute{}" list easily.
The transformer receives schema features, modifies the contents, and then outputs resulting schema features. Required functionalities should be:
- rename attributes (string replace, regex replace)
- add a common prefix/suffix to attributes matching specified condition (or all)
- remove specified prefix/suffix from attributes matching specified condition (or all)
- change case of attributes matching specified condition (or all)
- remove attributes matching specified condition (exact match, starting with, ending with, regex match)
- replace data type of attributes matching specified condition (name and/or original data type)
- add attributes (pairs of name and data type)
more?

The important thing is that the transformer should be a feature-based one. Since every schema feature read by the FeatureReader will have to arrive in the dynamic writer feature type (Schema Sources: "Schema from first feature") before any data feature belonging to the same feature type. If it wasn't so, the worth would be a half.
If the "all in one" would be too complicated, divide the functionalities into 2 - 3 parts, and multiple transformers may be defined for each part.

20 replies

david_r
Evangelist
  • November 6, 2015
Great idea. I'll tack on a rather similar suggestion I sent to Safe earlier this year, after some support issues with this functionality:

 

 

"How about a transformer, e.g. the SchemaCreator, that lets you define the contents of the attribute{} list via the GUI? You could reuse parts of the dialog used for feature type user attributes, e.g.

 

 

'

 

 

For the example above, the transformer would output the following attributes (overwriting any existing attribute{}-list):

 

 

attribute{0}.name = 'objectid'

 

attribute{0}.fme_data_type = 'fme_uint32'

 

attribute{1}.name = 'mystring'

 

attribute{1}.fme_data_type = 'fme_char(255)'

 

attribute{2}.name = 'somevalue'

 

attribute{2}.fme_data_type = 'fme_decimal(10,3)'

 

attribute{3}.name = 'when'

 

attribute{3}.fme_data_type = 'fme_datetime'

 

 

You could even add a column with the incoming attributes to rename to the newly created schema attributes (think built-in AttributeRenamer)."

 

 


takashi
Contributor
Forum|alt.badge.img+22
  • Author
  • Contributor
  • November 7, 2015

Good suggestion. I also wish a transformer that can be used to create schema definition easily. I often use scripts to create or modify the attribute{} list. Guess you do so too. If there were transformers to do those easily, would bring all users great benefit.


fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • November 7, 2015
We agree!

Forum|alt.badge.img+2
  • November 12, 2015
Not sure if I missed the point here but isn't the existing SchemaSetter custom transformer doing this?

david_r
Evangelist
  • November 12, 2015

Hi Mark

The SchemaSetter will take an incoming feature and create a corresponding list attribute. What is being proposed, is how to enable users to define (create and/or modify) this list manually without needing any incoming features, and preferrably with a user friendly interface.

David


takashi
Contributor
Forum|alt.badge.img+22
  • Author
  • Contributor
  • November 13, 2015

Hi @mark_1spatial, my primary intention is to allow users to edit easily existing attribute{} list contained by schema features which have been read by the FeatureReader (<Schema> port, 2015.1+) or Schema (Any Format) reader. A potential use case I most recently found is:

Read dynamic (from sde) and write to dynamic (mapinfo)

Regarding the SchemaSetter, I believe it would be still useful but there are cases where it cannot satisfy user's requirement because it has some limitations, e.g.

- doesn't support some data types such as decimal, date, datetime,

- users cannot control width of character string type,

- will not generate schema definition of missing attributes in the input feature,

and so on.

These limitations cannot be avoided, since the transformer generates schema definition from the input data feature (not schema feature) and a data feature doesn't have enough information for configuring complete schema. The expected transformer might also complement such limitations.


geolassi
Contributor
Forum|alt.badge.img+5
  • Contributor
  • December 8, 2016
Has there been progress with this? Just today users were asking in a training, how to change the attribute list easily. I didn't want to say use Python.

david_r
Evangelist
  • October 20, 2017
Agree, it would be great to get some traction on this old, but very popular idea!

fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • October 21, 2017
Well, bumping it like this is good. And 19 votes gets it into contention. Vote early and vote often. I'd love to see us do some work here and love the suggestions in this old (but very good) thread.

 

 


bruceharold
Contributor
Forum|alt.badge.img+17
  • Contributor
  • October 23, 2017

At last, a way to make GML useful :-)


jkr_wrk
Influencer
Forum|alt.badge.img+28
  • May 30, 2018

This would help a lot in converting to usefull formats.


basm
Contributor
Forum|alt.badge.img+3
  • Contributor
  • July 30, 2018

I agree, very useful tool indeed


david_r
Evangelist
  • April 16, 2019

Two major releases later and it's currently sitting at 46 votes, plus this associated idea with 18 votes:

https://knowledge.safe.com/idea/48070/attributeremover-etc-to-work-with-schema-features.html

It would be fantastic to see something come out from all this enthusiasm :-)


chriswilson
Supporter
Forum|alt.badge.img+11
  • Supporter
  • April 26, 2019

Bump, yes please. Schema setter is good as a custom transformer, but I'm sure more could be done in this space.


davidrasner5
Contributor
Forum|alt.badge.img+4
  • Contributor
  • November 28, 2019

Yes, please. I finally managed to climb the FME learning mountain, step by step.

And now I'm a bit stuck, changing feature types and managing schema for dynamic output is really hard.


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • November 28, 2019

Agree, I had to learn python to get round this!


mmccart
Contributor
Forum|alt.badge.img+16
  • Contributor
  • December 5, 2019

Bump. Maybe add the ability to order attributes based on supplied sort order?


chriswilson
Supporter
Forum|alt.badge.img+11
  • Supporter
  • December 9, 2019

@daleatsafe how about now with 64 votes? :D


chriswilson
Supporter
Forum|alt.badge.img+11
  • Supporter
  • December 9, 2019

SchemaManager?


geogaard
Contributor
Forum|alt.badge.img+15
  • Contributor
  • December 16, 2021

This would be so useful for me right now :)


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