Skip to main content
Solved

In what order feature are read through a reader in FME 2016 ?


Forum|alt.badge.img

I have a script with one database (PostGIS, Oracle or SQL Server) reader and with a PythonCaller which depends on the order of the features. I run my script with FME 2016 and noticed that the order of features is different.

So i wonder if something change deliberately or the order depend on something that FME can't control ? I didn't see a related subject in the changelog of the 2016 release.

Best answer by redgeographics

Usually it's the order in which the features (records) are returned by the database. And that's either the order in which they're stored or in which they're ordered by an SQL query (SELECT * FROM bla ORDER BY something). So yes, it might be out of FME's control.

If you run the workpace with 2015 and 2016 right after eachother, do you see different results?

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

5 replies

redgeographics
Celebrity
Forum|alt.badge.img+47
  • Celebrity
  • Best Answer
  • April 19, 2016

Usually it's the order in which the features (records) are returned by the database. And that's either the order in which they're stored or in which they're ordered by an SQL query (SELECT * FROM bla ORDER BY something). So yes, it might be out of FME's control.

If you run the workpace with 2015 and 2016 right after eachother, do you see different results?


erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • April 19, 2016

The order of reader could be controlled previous to FME 2016 (is the order in which the readers appear in the Navigation window), but not the order of the feature types.

This has changed in FME 2016.1.

The order of reading feature type can be controlled in that version too (see the recorded webinar).


ravenkopelman
Safer
Forum|alt.badge.img+1
redgeographics wrote:

Usually it's the order in which the features (records) are returned by the database. And that's either the order in which they're stored or in which they're ordered by an SQL query (SELECT * FROM bla ORDER BY something). So yes, it might be out of FME's control.

If you run the workpace with 2015 and 2016 right after eachother, do you see different results?

Without an ORDER BY databases are free to return rows in any order, with no guarantee of the same ordering even for back-to-back invocations of the same query. (In practice you'll usually get a predictable order, just don't count on it.)

Either writing custom SQL with an ORDER BY or adding a Sorter transformer could give the needed stability.


erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • April 19, 2016
erik_jan wrote:

The order of reader could be controlled previous to FME 2016 (is the order in which the readers appear in the Navigation window), but not the order of the feature types.

This has changed in FME 2016.1.

The order of reading feature type can be controlled in that version too (see the recorded webinar).

Sorry, I did not read as well as I should.

The order of features read depend on the SQL statement.

If you want change that you can add the ORDER BY clause in the WHERE Clause parameter of the reader or the feature type.

Alternatively you could use the SQLCreator as a reader and create your specific SQL statement.


Forum|alt.badge.img

Thank you all for your answers.

redgeographics: Yes I see a difference when i run a workspace with 2015 and 2016. So maybe the reader use a different SQL query to retrieve features, because my database use its indexes to return rows so the order do not change if there is no modification, moreover running my script with 2015 give me the same result everytime.

Anyway I still have to order features myself if I want a script which create the same result on all FME versions.


Reply


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