Skip to main content

Hi,

I have the following scenario:

I extract a list of xlsx filenames from a database table and I want to perform a check on their schema (i.e. column names and data types). I feed the output of a database reader to a FeatureReader initiator so that for every input feature a different file is read.

In the FeatureReader I only read the schema. I expected to obtain a different schema for each record of the database but in fact I only get a single schema.

Is there something I am missing?

Difficult to say without seeing what's actually sent to the FeatureReader.

Can you connect an Inspector to the last transformer before the FeatureReader and post a screenshot here? A screenshot of the FeatureReader settings would also be helpful.


Here is a proof of concept I made using two csv files and a creator:

here is the AttributeCreator output:

here the FeatureReader output:

As you can the schema port only outputs one feature. The two csv files have a different schema.

here are the FeatureReader settings:


If you set the "Feature type name(s)" parameter in the CSV settings to "From File Name(s)" it will create a schema feature for every individual filename.


If you set the "Feature type name(s)" parameter in the CSV settings to "From File Name(s)" it will create a schema feature for every individual filename.

Indeed it is a solution when reading csv files, unfortunately I used csvs in the example but I am using xlsx in the real case and in this case there is no such an option in the Excel reader parameters. Any suggestions?

 

 


Indeed it is a solution when reading csv files, unfortunately I used csvs in the example but I am using xlsx in the real case and in this case there is no such an option in the Excel reader parameters. Any suggestions?

 

 

Yes, same workspace but instead of setting the FeatureReader to read Excel, tell it to read Schema (Any format). Then connect the <Generic> output port, that's where the schema features will come out.

 

 


If you set the "Feature type name(s)" parameter in the CSV settings to "From File Name(s)" it will create a schema feature for every individual filename.

Tried the generic schema reader and it works fine. Only a minor note, on the generic port I get twice the amount of the input features. The duplicate features are empty geometry features having attribute fme_feature_type_name='ESRI_MAPINFO_SHEET' so they can be easily filtered out

 

 

Thank you

 

 

 


Tried the generic schema reader and it works fine. Only a minor note, on the generic port I get twice the amount of the input features. The duplicate features are empty geometry features having attribute fme_feature_type_name='ESRI_MAPINFO_SHEET' so they can be easily filtered out

 

 

Thank you

 

 

 

Could it be that your Excel files have 2 worksheets each? Every worksheet is a feature type to FME so would result in 1 schema feature in the Schema reader.

 

 


If you set the "Feature type name(s)" parameter in the CSV settings to "From File Name(s)" it will create a schema feature for every individual filename.

Hello @lliberti

Just wanted to say thanks for raising this question and to @redgeographics for the solution. I was grappling with the same type of problem and stumbled across this answer and solution for my situation as well. Much appreciated.

Thanks

Jamie


Reply