Question

Bulk Renaming of Attributes from External Lookup Table


Badge

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

Userlevel 2
Badge +17

Have a look at the SchemaMapper transformer.

Badge +22

That sounds like a case for the schema mapper. https://knowledge.safe.com/articles/1136/schemamapper-transformer-tutorial.html

Userlevel 2
Badge +17

Have a look at the SchemaMapper transformer.

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

Badge
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.
Userlevel 2
Badge +17
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.

Badge

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.

Userlevel 2
Badge +17

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.

Badge

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.

Userlevel 2
Badge +17

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

Userlevel 6
Badge +32

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

Reply