Skip to main content
Question

Bulk Renaming of Attributes from External Lookup Table


Forum|alt.badge.img+3

Hi- I have a lookup table I'd love to FeatureJoin in somehow, to rename the original columns to what's shown in my external lookup table. Unfortunately there is no predictable pattern to the renaming, so I can't realistically use BulkAttributeRenamer to do a pattern/rules-based renaming. . and at 118 columns, am hoping not to have to use AttributeManager or AttributeRenamer addressing each column manually. Any suggestions for using an external lookup table to do this? Thanks in advance!

10 replies

takashi
Influencer
  • May 14, 2019

Have a look at the SchemaMapper transformer.


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • May 14, 2019

takashi
Influencer
  • May 14, 2019
takashi wrote:

Have a look at the SchemaMapper transformer.

See also this article: https://knowledge.safe.com/articles/1162/attribute-mapping-schemamapper.html


Forum|alt.badge.img+3
Thanks all for the replies! But looks like SchemaMapper needs no spaces in the original/destination column-names. . when I do have spaces in both.

takashi
Influencer
  • May 14, 2019
fme_fan_mike wrote:
Thanks all for the replies! But looks like SchemaMapper needs no spaces in the original/destination column-names. . when I do have spaces in both.

I believe that the SchemaMapper can be used even if the source/destination attribute names contain spaces. If it didn't work because of the spaces within attribute names, I would say it's a bug on the transformer.


Forum|alt.badge.img+3
takashi wrote:

I believe that the SchemaMapper can be used even if the source/destination attribute names contain spaces. If it didn't work because of the spaces within attribute names, I would say it's a bug on the transformer.

Ok thanks Takashi! Just for proof-of-concept I did some testing on very simple data. . and I still cannot get the SchemaMapper to rename the columns despite everything being setup just like what's shown in the https://knowledge.safe.com/articles/1162/attribute-mapping-schemamapper.html example. See screenshot below showing workspace, and the 'Create New Attribute' settings for SchemaMapper. It looks like SchemaMapper regonizes what I'd like to do, but 'NEWCOL1' and 'NEWCOL2' don't appear at my writer. I sure appreciate the help.


takashi
Influencer
  • May 14, 2019
takashi wrote:

I believe that the SchemaMapper can be used even if the source/destination attribute names contain spaces. If it didn't work because of the spaces within attribute names, I would say it's a bug on the transformer.

The SchemaMapper won't expose the destination attribute names automatically. You will have to configure the User Attributes in the writer feature type with Manual mode.


Forum|alt.badge.img+3
takashi wrote:

The SchemaMapper won't expose the destination attribute names automatically. You will have to configure the User Attributes in the writer feature type with Manual mode.

Any guidance on what to do there would be appreciated, as it's not covered in the article. I hope that doesn't mean I have to enter the new renamed columns in manually. Thanks again.


takashi
Influencer
  • May 14, 2019

If you create an external lookup table that contains not only source attribute and destination attribute columns but also feature type name and data type columns, the table can be used to configure both the SchemaMapper and dynamic writer feature type. If you do so, you don't need to expose destination attribute names any longer.

See here to learn how to configure dynamic writer feature type with a lookup table: Dynamic Workflows: Destination Schema is Derived from a Lookup Table


nielsgerrits
VIP
Forum|alt.badge.img+54
fme_fan_mike wrote:

Any guidance on what to do there would be appreciated, as it's not covered in the article. I hope that doesn't mean I have to enter the new renamed columns in manually. Thanks again.

You could use a SchemaSetter to create a Schema Feature and use this with the data features to write your data dynamic.

dynamicmapping2019.fmwt


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