Solved

writing table with featurereader / featurewriter produces inconsistent results in FME 2018


Badge

I am using a FeatureReader to read a data source (e.g. SHP file) and then immediately writing it to postGIS using a FeatureWriter. Because the input is supposed to be agnostic as to the exact data being uploaded, I am using the "single output port" option and outputting the results via the Generic port, which is being directly fed into the FeatureReader.

In FME 2017 this worked. In 2018 I am having a problem - the writer only works correctly if the destination table already exists (i.e. with the "Use Existing" option).If I use the "Drop and Create" option in the writer, all I get is the geometry column in the destination table. The other columns don't come across.

I saw a forum post where a user was advised to use a dynamic writer and to pass the schema in like this:

https://knowledge.safe.com/questions/46483/generic-attribute-from-featurereader.html

This works, but has one major annoyance - I lose control of the name of the output table - I have to use the fme_feature_type attribute as the table name (and in the case of uploading a CSV file, the destination table is always going to be called "CSV"). I might want to reference the destination table later in code, so not knowing what it's called is a problem.

As I say, writing directly to the table and dropping and creating it seemed to work in FME 2017, but stopped working as soon as I upgraded to 2018. I'm not sure if it is a bug or if the behaviour of the writer has been deliberately changed. Can anyone clarify this?

icon

Best answer by nielsgerrits 4 May 2018, 08:16

View original

5 replies

Userlevel 6
Badge +32
@rohan I can reproduce this behavior of only getting a geometry column (FeatureReader Generic / FeatureWriter, Table Name = fme_feature_type, Attribute Definition = Automatic, Table Handling = Drop and Create) in both 2018.0.0.1 and 2017.1.2.0... So I wonder what you mean exactly? Can you share the 2017 workbench this worked with?
Userlevel 6
Badge +32

You can edit the fme_feature_type_name in the schema feature and fme_feature_type in the data features if you want, this gives you control of the target table name. Works in 2018.0.0.1, just tested.

Userlevel 2
Badge +17

Regarding feature type name (fme_feature_type) of CSV features, you can also derive that from source file names by changing the default behavior in the CSV reader parameters dialog, if necessary. I have saved From File Name(s) as my default, and have never used "CSV" as feature type name so far.

Badge

You can edit the fme_feature_type_name in the schema feature and fme_feature_type in the data features if you want, this gives you control of the target table name. Works in 2018.0.0.1, just tested.

Thanks for that. Sorry I didn't respond earlier, but I got called away on a different project, and my FME licence expired.

 

 

Badge

Regarding feature type name (fme_feature_type) of CSV features, you can also derive that from source file names by changing the default behavior in the CSV reader parameters dialog, if necessary. I have saved From File Name(s) as my default, and have never used "CSV" as feature type name so far.

Thanks for pointing that out.

 

 

Reply