Clarifying use case for transformers

I am having trouble reconciling the accepted answer with how the Retool documentation describes query transforms.

From https://docs.retool.com/queries/guides/transformers:

Query transformers work the same way as regular transformers. In the transformer, you are provided a field data which contains the results of the query without any modification. The return value from the transformer you write becomes the value of yourQuery.data in the rest of the app.

To paraphrase the documention, the purpose of a query transform is to transform the result of running a query. That is, the transform executes after the query. Is that correct?

The accepted answer to the OP's question implies you use a transform to convert the data before the bulk insert.

Can someone confirm you really can use a transform to convert NULL data before a bulk insert?

2 Likes

Hey @Bill_Smith! Welcome to the community. :slightly_smiling_face: I've split out your question into a new topic because I think it's a good opportunity to clarify what can oftentimes be a little confusing.

Your summary and initial understanding are correct - transformers execute after a query in order to modify the returned data in some way. This is often a 1:1 mapping but doesn't have to be. In this case, OP wrote one query to retrieve data and a second to insert that same data into a separate database. They ended up solving their problem by inserting a transformer between those two queries, so that it operated on the results of the first and formatted it correctly for insertion into the second.

I hope that clarifies everything! Happy to answer any further questions.

1 Like

Thanks for clarifying, @Darren.

1 Like