Skip to main content
Solved

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


chau
Contributor
Forum|alt.badge.img+3
  • Contributor

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?

Best answer by david_r

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

View original
Did this help you find an answer to your question?

21 replies

david_r
Evangelist
  • September 14, 2017

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.


chau
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • September 15, 2017

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.


david_r
Evangelist
  • Best Answer
  • September 15, 2017

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


chau
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • September 15, 2017
david_r wrote:

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".

david_r
Evangelist
  • September 15, 2017
chau wrote:

 

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:

 


chau
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • September 15, 2017
david_r wrote:
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.

 

 


chau
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • September 15, 2017
david_r wrote:

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.

 

 


david_r
Evangelist
  • September 15, 2017

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


david_r
Evangelist
  • September 15, 2017
chau wrote:
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 :-)

 


david_r
Evangelist
  • September 15, 2017
david_r wrote:

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.

chau
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • September 15, 2017
david_r wrote:

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.

 

 


chau
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • September 15, 2017
david_r wrote:
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 :|

 

 


david_r
Evangelist
  • September 15, 2017
chau wrote:
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?

 


david_r
Evangelist
  • September 15, 2017
chau wrote:
But sadly I cannot unaccept it :|

 

 

I was able to unaccept it for you.

chau
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • September 15, 2017
david_r wrote:
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?

 


chau
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • September 15, 2017
david_r wrote:
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 :)

 

 


david_r
Evangelist
  • September 15, 2017
chau wrote:
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...

david_r
Evangelist
  • September 15, 2017
chau wrote:
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.

chau
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • September 15, 2017
david_r wrote:
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.

 

 


chau
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • September 15, 2017
chau wrote:
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 :)

 

 


david_r
Evangelist
  • September 15, 2017
chau wrote:
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 ;-)

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings