Skip to main content
Solved

Add custom table insert feature

  • February 22, 2023
  • 6 replies
  • 380 views

rvgfox
Problem Solver
Forum|alt.badge.img+4
  • Problem Solver
  • 237 replies

Can you explain how and for what it can be used?

Best answer by tld

I tend to avoid Query tables containing busines logic in order not to put any additonal load on the source system. As for the custom view approach, you would get a regular table insert. I like the Custom Table insert so that I have the code with the table instead of having to navigate to Views to find it. 

6 replies

Christian Hauggaard
Community Manager
Forum|alt.badge.img+5

Hi @rvgfox 

Please see this article about custom table inserts. It is used to insert data into a table based on a custom SQL script. For example, the below shows a custom insert based on a union statement from three tables.

 


rory.smith
TimeXtender Xpert
Forum|alt.badge.img+8
  • TimeXtender Xpert
  • 736 replies
  • February 23, 2023

Note that Custom Table Inserts do not keep lineage (you would need to use Advanced > Object Dependencies). It is usually better to use a view in the layer below or same layer as those can keep lineage intact.


rvgfox
Problem Solver
Forum|alt.badge.img+4
  • Author
  • Problem Solver
  • 237 replies
  • February 27, 2023

Hi @Christian Hauggaard Can you explain for what we can use this feature?


tld
Contributor
Forum|alt.badge.img+1
  • Contributor
  • 13 replies
  • February 27, 2023

There are several use-cases. 

Here is one that i used it for recently: I had a table that contained a primary key, a timestamp, a status (and other fields). I only need the last record for every Primary Key for each day. I made a custom table insert for that. I could also have made a custom view, but with the custom table insert I could implement the rest of the business logic the TimeXtender-way instead of doing T-SQL in the view.


rory.smith
TimeXtender Xpert
Forum|alt.badge.img+8
  • TimeXtender Xpert
  • 736 replies
  • February 27, 2023

I would still use Custom Views in that scenario: only use the Custom View for the selection of the last record per key. You can drag any Custom View onto the Tables node to make a physical table out of it and do any regular transformations there. The filling of that table is done through the view.

Alternatively you can use a Query Table on the source to do the selection logic there and remove the need for one of the physical tables.


tld
Contributor
Forum|alt.badge.img+1
  • Contributor
  • 13 replies
  • Answer
  • February 27, 2023

I tend to avoid Query tables containing busines logic in order not to put any additonal load on the source system. As for the custom view approach, you would get a regular table insert. I like the Custom Table insert so that I have the code with the table instead of having to navigate to Views to find it.