Skip to main content

Hi list.

We're importing data from customers on a daily basis, and we utilize the strategy of creating a new schema for the new data with the date included, e.g. "Fiber20200602" (with yesterday's data still in schema "Fiber20200601"). The tables and views in each "day-schema" is identical.

I want to have FME read tables from the latest schema, and I use an SQLExecutor the generate the wanted schema name. But how do I utilize it in FeatureReader ?

I added two tables under "Feature Types to Read" (by point and click). This worked very nicely.

Using the text editor I then changed the hardcoded schema name to be my variable. This removed my two output ports, even though my "Output Ports" was set to "One per Feature Type".

I then tried to change the setting to "Specified", and added the two tables as fixed schema. This regenerated the output ports, but the read input data was output on the "Generic" port nonetheless.

I then copied my setting from "Feature Types to read" into "Specified", but that deleted my two output ports.

Is it completely impossible to have FeatureReader read from a variable schema in the database and handle them in an orderly fashion ?

Alternatively, is it possible to utilize the two schema features also output to filter data from the "Generic" port ?

Cheers.

Hi @lifalin2016, if you read required table names with the SQLExecutor one by one, I thinks this workflow works as expected.

FeatureReader parameters


Hi @lifalin2016, if you read required table names with the SQLExecutor one by one, I thinks this workflow works as expected.

FeatureReader parameters

Thanks Takashi, but it's unfortunately a little too simple for my use. And I definitely don't want to output the input structure directly as-is, I need to do a lot of schema mapping before that.

I want/need to read very many tables , and don't want a huge number of FeatureReaders, and I need to support varying schemas only. So my "Feature Types to read" looks more like this:

@Value(s_name).Elkabel @Value(s_name).Foringsroer @Value(s_name).Fremmed_kabel @Value(s_name).Jordtraad @Value(s_name).Lyslederkabel @Value(s_name).Signalkabel @Value(s_name).Styreledning

It works as such, but I need to have the FeatureReader generate an output port per feature type. And my question is how ?

If everything is output via the Generic port, I need to hardcode everything afterwards, so it looks like pest or cholera at this point, since FeatureReader won't play ball.


Hi @lifalin2016, if you read required table names with the SQLExecutor one by one, I thinks this workflow works as expected.

FeatureReader parameters

I don't think there is any way to add output ports dynamically to the FeatureReader according to table names that will be determined at run-time.

However, if suffixes of table names are fixed as described (i.e. ".Elkabel", ".Foringsroer", ".Fremmed_kabel" ...), you can read every feature type with the option "Single Output Port", then divide the workflow into multiple streams for each feature type with the TestFilter (Test Condition: fme_feature_type Ends With .Elkabel, and so on)

Isn't it suitable to your requirement?


Reply