Skip to main content
Solved

Duplicate records from sqlexecutor

  • November 27, 2019
  • 5 replies
  • 49 views

Forum|alt.badge.img

 

Hi all

I have a simple IFC file which has just 8 IFCWalls and 2 IFCSpaces. When I run a simple query for retrieving all records for IFCSpace elements ( select * from "public"."IfcSpace"; ) , SQLExecutor duplicates all records. For instance, I have 2 records for IFCSpace but after running the query, I'll get 4 records. How can I avoid duplication? (I use PostGIS)

Best answer by oscard

The SQLExecutor has 2 features as input, so he transformer runs two times. That's why you have double the results.

 

Add a Sampler before the SQLExecuttor to get just one feature.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

oscard
Influencer
Forum|alt.badge.img+22
  • Influencer
  • Best Answer
  • November 27, 2019

The SQLExecutor has 2 features as input, so he transformer runs two times. That's why you have double the results.

 

Add a Sampler before the SQLExecuttor to get just one feature.


Forum|alt.badge.img
  • Author
  • November 27, 2019

Thank you @oscard for your response, but I reckon you meant adding sampler after SQLExecutor, am I right? Anyway, it worked! Thanks.


oscard
Influencer
Forum|alt.badge.img+22
  • Influencer
  • November 28, 2019

Thank you @oscard for your response, but I reckon you meant adding sampler after SQLExecutor, am I right? Anyway, it worked! Thanks.

It would work both ways, but adding the sampler before the SQLExecutor would mean less work for the database and less data to be processed by FME.


Forum|alt.badge.img
  • Author
  • December 1, 2019

Thank you @oscard for your response, but I reckon you meant adding sampler after SQLExecutor, am I right? Anyway, it worked! Thanks.

Can you please explain how do you do that? I mean I don't have duplication before SQLExecutor so, it would be again 2 records after using Sampler and then result would be 4 records.


oscard
Influencer
Forum|alt.badge.img+22
  • Influencer
  • December 2, 2019

Can you please explain how do you do that? I mean I don't have duplication before SQLExecutor so, it would be again 2 records after using Sampler and then result would be 4 records.

Your SQL sentence in the SQLExecutor has zero dependency on attributes from the input (three is no where clause, for example); so the output is going to be always the same no matter the input.

 

 

You have 2 features that enter the SQLExecutor, so the SELECT sentence is executed twice. What you should do is filter the input to keep just one. That could be achieved using a Sampler (it is not a DuplicateRemover). To keep just the first feature: