Solved

FeatureReader from Oracle to FeatureWriter, all attributes end up being 200 char

  • 14 September 2017
  • 21 replies
  • 4 views

Badge +1

Hi!

I am trying to download a set of data from my Oracle database. I have created a simple workspace with a Creator, a FeatureReader and a FeatureWriter - connected in that order.

I the reader I connect to my database and select a table. The writer I configure to export to an ESRI Shape file completing only the dataset and the shapefile name.

When I look at the "User attributes" pane in the writer all my attributes from the Oracle database are listed but as CHAR 200 (and they are not all of them supposed to be CHAR):

Why can't the reader and the writer work out the correct attribute configuration?

icon

Best answer by david_r 15 September 2017, 10:08

View original

21 replies

Userlevel 4

You'll need to transfer the schema as well as the data. Connect both the table and the <Schema> outputs from the FeatureReader to the FeatureWriter. Then tell the FeatureWriter to use dynamic schema defintion.

Badge +1

Hi David,

Thank you for looking at this. I have tried your solution and though it make sense to me, I still get CHAR 200's.

Userlevel 4

Also remember to set the User Attributes as Dynamic in the FeatureWriter:

Badge +1

Also remember to set the User Attributes as Dynamic in the FeatureWriter:

 

Hi David, as you can see on my image, I have (FME does it automatically) selected "Dynamic".
Userlevel 4

 

Hi David, as you can see on my image, I have (FME does it automatically) selected "Dynamic".
Did you drop the existing table first?

 

You can also tell FME to drop and recreate it for you each time the translation runs:

 

Badge +1
Did you drop the existing table first?

 

You can also tell FME to drop and recreate it for you each time the translation runs:

 

I can see that you are writing to another Oracle table, I'm writing to an ESRI Shape file. I don't have a "Format Parameters" and the shape file doesn't exist.

 

 

Badge +1

You'll need to transfer the schema as well as the data. Connect both the table and the <Schema> outputs from the FeatureReader to the FeatureWriter. Then tell the FeatureWriter to use dynamic schema defintion.

I haven't accepted this answer. Since I made the question, shouldn't it be me and only me who should be able to accept it? I can see that it has been accepted by "TiaAtSafe" but since the answer hasn't helped me, I think it is misleading. I'm still looking for an answer.

 

 

Userlevel 4

You will have to manually delete all the user attribute definitions first, otherwise they override whatever comes from the dynamic schema.

Userlevel 4
I haven't accepted this answer. Since I made the question, shouldn't it be me and only me who should be able to accept it? I can see that it has been accepted by "TiaAtSafe" but since the answer hasn't helped me, I think it is misleading. I'm still looking for an answer.

 

 

It's your question, so feel free to accept/unaccept just as you want. I'm guessing Tia was a bit trigger-happy. (Quite a few forget to flag an answer as correct, and to try and help those stumbling on a question later there are moderators that try to accept correct replies, but it's not always perfect :-)

 

Userlevel 4

Also remember to set the User Attributes as Dynamic in the FeatureWriter:

Notice how the list below the radio buttons is empty, this is important.
Badge +1

You will have to manually delete all the user attribute definitions first, otherwise they override whatever comes from the dynamic schema.

I haven't made any attribute definitions myself. Anyway I tried deleting all of them, setting it to dynamic and nothing happens. I tried removing all connections to the writer, connected them both to a new "connect input", put a check mark in "Dynamic Schema Definition" and when looking at the user attributes, they are all CHAR 200.

 

 

Badge +1
It's your question, so feel free to accept/unaccept just as you want. I'm guessing Tia was a bit trigger-happy. (Quite a few forget to flag an answer as correct, and to try and help those stumbling on a question later there are moderators that try to accept correct replies, but it's not always perfect :-)

 

But sadly I cannot unaccept it :|

 

 

Userlevel 4
I haven't made any attribute definitions myself. Anyway I tried deleting all of them, setting it to dynamic and nothing happens. I tried removing all connections to the writer, connected them both to a new "connect input", put a check mark in "Dynamic Schema Definition" and when looking at the user attributes, they are all CHAR 200.

 

 

The attribute definitions are probably carried over from when you connected the FeatureWriter the first time, that tends to happen automatically. You will then have to remove them manually when switching to dynamic schema.

 

I just tried here and it works for me. Can you maybe post some updated screenshots?

 

Userlevel 4
But sadly I cannot unaccept it :|

 

 

I was able to unaccept it for you.
Badge +1
Notice how the list below the radio buttons is empty, this is important.
Okay, now something is working but its VERY non-intuitive!

 

  1. I select "Dynamic Schema Definition
  2. I go into "User attributes"
  3. I select "Manual"
  4. I Delete all the attributes.
  5. I set it back to "Dynamic" (with no attributes visible).
  6. I run my workspace and the result looks okay.
Is this really the way it is intended to work?

 

Badge +1
Notice how the list below the radio buttons is empty, this is important.
And David - thanks for taking me on this trip through the Feature Writer :)

 

 

Userlevel 4
And David - thanks for taking me on this trip through the Feature Writer :)

 

 

You're welcome. It's a very powerful transformer, but it can also be somewhat confusing when going beyond the most basic use case, as you've seen...
Userlevel 4
Okay, now something is working but its VERY non-intuitive!

 

  1. I select "Dynamic Schema Definition
  2. I go into "User attributes"
  3. I select "Manual"
  4. I Delete all the attributes.
  5. I set it back to "Dynamic" (with no attributes visible).
  6. I run my workspace and the result looks okay.
Is this really the way it is intended to work?

 

Yes, I agree it's not very intuitive, especially not at first. The thing with the attributes is that it will allow power users to override certain attribute definitions, but I personally find it a bit problematic that FME will pre-populate that list if you're not careful, leading to all the issues you had in understanding what was going on.

 

 

You'll have to ask Safe whether this is as intendend. Personally I think there is still room for improvement.
Badge +1
You're welcome. It's a very powerful transformer, but it can also be somewhat confusing when going beyond the most basic use case, as you've seen...
Well I thought I was doing the most basic thing here :) But yeah I can see how it can be very powerful. But it is very difficult to see from the transformer exactly which attributes are created in the output data set.

 

 

Badge +1
But sadly I cannot unaccept it :|

 

 

To address the concern of "TiaAtSafe", which answer should I accept? I think a combination of all the answers and comments provide exactly the answer I was looking for :)

 

 

Userlevel 4
To address the concern of "TiaAtSafe", which answer should I accept? I think a combination of all the answers and comments provide exactly the answer I was looking for :)

 

 

No need to overthink it, I suspect whoever reads this later will read the entire thrilling episode ;-)

Reply